Login ProductsSalesSupportDownloadsAbout |
Home » Technical Support » ElevateDB Technical Support » Support Forums » ElevateDB Enhancement Requests and Suggestions » View Thread |
Messages 1 to 10 of 11 total |
database & session .Execute |
Thu, Jul 8 2010 3:41 AM | Permanent Link |
Roy Lambert NLH Associates Team Elevate | I don't know how much more efficient it would be but I often find myself wanting a quick count of a table (generally with a WHERE clause thrown in) and I have to use SELECT somefield rather than COUNT(*) since the latter just returns 1, and always will.
I can easily make up a generic query myself (and probably will) but it might be useful to others to have it built in something like session/database.HowManyRows(tablename, whereclause) OTOH if COUNT(*) is no more efficient then forget it Roy Lambert |
Thu, Jul 8 2010 1:54 PM | Permanent Link |
Tim Young [Elevate Software] Elevate Software, Inc. timyoung@elevatesoft.com | Roy,
<< I don't know how much more efficient it would be but I often find myself wanting a quick count of a table (generally with a WHERE clause thrown in) and I have to use SELECT somefield rather than COUNT(*) since the latter just returns 1, and always will. >> I'm not sure what you're saying here. I just tried SELECT COUNT(*) FROM MyTable on a table with 5 rows, and it returned 5, as expected. -- Tim Young Elevate Software www.elevatesoft.com |
Fri, Jul 9 2010 2:33 AM | Permanent Link |
Roy Lambert NLH Associates Team Elevate | Tim
>I'm not sure what you're saying here. I just tried SELECT COUNT(*) FROM >MyTable on a table with 5 rows, and it returned 5, as expected. database.Execute('SELECT COUNT(*) FROM....') = 1 Roy Lambert |
Mon, Jul 12 2010 3:28 PM | Permanent Link |
Tim Young [Elevate Software] Elevate Software, Inc. timyoung@elevatesoft.com | Roy,
<< database.Execute('SELECT COUNT(*) FROM....') = 1 >> Just skip the COUNT(*) then, and run the query as normal. -- Tim Young Elevate Software www.elevatesoft.com |
Tue, Jul 13 2010 3:32 AM | Permanent Link |
Roy Lambert NLH Associates Team Elevate | Tim
Right now we both know what I'm talking about - back to the original suggestion Roy Lambert |
Tue, Jul 13 2010 6:35 PM | Permanent Link |
Tim Young [Elevate Software] Elevate Software, Inc. timyoung@elevatesoft.com | Roy,
<< Right now we both know what I'm talking about - back to the original suggestion>> Well, the original suggestion is to have EDB put in the SELECT, *, FROM, and WHERE keywords for you. That's not exactly saving a lot of effort. -- Tim Young Elevate Software www.elevatesoft.com |
Wed, Jul 14 2010 3:07 AM | Permanent Link |
Roy Lambert NLH Associates Team Elevate | Tim
><< Right now we both know what I'm talking about - back to the original >suggestion>> > >Well, the original suggestion is to have EDB put in the SELECT, *, FROM, and >WHERE keywords for you. That's not exactly saving a lot of effort. Two points: 1. I've just remembered that COUNT(*) and COUNT(field) may not give the same results (it will be the same if you choose a key field) 2. As you word it you are correct, but if you want to use COUNT(*) then the correct effort analysis is: a) instantiate a query b) link the query to the session c) link the query to the database d) add the sql to the query e) run the query f) read the query results into a local variable g) close the query h) free the query OK I know I can easily write a function and add it to my pack to do the same The other part of the original suggestion was an implied question: is it more efficient to do COUNT(*) and extract the result than COUNT(field) and recordcount the results? Roy Lambert |
Thu, Jul 15 2010 6:45 PM | Permanent Link |
Tim Young [Elevate Software] Elevate Software, Inc. timyoung@elevatesoft.com | Roy,
<< The other part of the original suggestion was an implied question: is it more efficient to do COUNT(*) and extract the result than COUNT(field) and recordcount the results? >> You can't use COUNT(Column) like that since it works just like COUNT(*), except that it counts a specific column instead of the rows. If you want to use the RecordCount approach, you only need to use the SELECT * FROM MyTable WHERE... approach and execute it with the Execute method. -- Tim Young Elevate Software www.elevatesoft.com |
Fri, Jul 16 2010 3:56 AM | Permanent Link |
Roy Lambert NLH Associates Team Elevate | Tim
>You can't use COUNT(Column) like that since it works just like COUNT(*), >except that it counts a specific column instead of the rows. If you want to >use the RecordCount approach, you only need to use the SELECT * FROM MyTable >WHERE... approach and execute it with the Execute method. That is deadly slow since the .Execute methods don't ask for a sensitive result. Fear not I'll roll my own. I just need to decide wether to use a little stand alone function, subclass TEDBSession & TEDBDatabase or hack edbcomps. Roy Lambert |
Sat, Jul 17 2010 11:09 AM | Permanent Link |
Tim Young [Elevate Software] Elevate Software, Inc. timyoung@elevatesoft.com | Roy,
<< That is deadly slow since the .Execute methods don't ask for a sensitive result. >> They do now. -- Tim Young Elevate Software www.elevatesoft.com |
Page 1 of 2 | Next Page » | |
Jump to Page: 1 2 |
This web page was last updated on Tuesday, May 7, 2024 at 06:25 PM | Privacy PolicySite Map © 2024 Elevate Software, Inc. All Rights Reserved Questions or comments ? E-mail us at info@elevatesoft.com |