[thelist] RecordCount

Veronica Yuill veronicay at archetype-it.com
Thu Mar 21 10:49:01 CST 2002


At 16:28 21/03/2002 +0000, you wrote:
>Rudy - your rules - yeh, i know about those, but I nede to actually get all
>the values from the database - thats why ive used the 'star' - well pointed
>out though.

Even so, it's better to specify the columns you want. Several reasons:
1) self-documenting code
2) if you later add columns to the table which you don't need for this
query, you won't needlessly return them
3) you'll find it a darn sight easier to work with GetRows if you know what
columns you returned, in what order. GetRows puts everything into a 2-d
array, and you need to address the columns by position in the array.
4) if you were to insert a new column into the middle of the table, and
still used * and GetRows, your values would be muddled up. If you specify
particular columns in a particular order, this won't happen.

Also, from your original code, it looked to me as if you didn't need the
actual values (documents) till the *next* page -- from this query you only
needed the ID of the group (to pass to the next page), the group name, and
the record count. If this is the case, Rudy's approach is far more
efficient. If it isn't, then Getrows is a good way to go.

HTH

Veronica Yuill                 email: veronicay at archetype-it.com
Archetype Information Technology Ltd  http://www.archetype-it.com/english/
------------------------------------------------------------------
Dynamic websites for fast-moving businesses




More information about the thelist mailing list