Menu

#358 Replace use of RS.last to count rows

XUI 3.2
open
7
2007-10-19
2007-10-19
No

Replace the use of RS.last() to count the rows retrieved from the database as it is error prone, and in some instances requires a scrollable cursor (which may not be supported on all databases or may be inefficient).

Encapsulate retrieval in a method so that the implementation can be refined by the subclasses - the CachedDatabaseTable may not need to use .last() as it iterates the rows in its cacheData method.

Use an ArrayList or Vector (for 1.1.8) internally in CachedDatabaseTable to avoid the need for the call to last. This should give a more accurate count of the rows.

For uncached result sets this probably has no downside as the retrieve method closes the result set (but this is probably a BUG as any subsequent call will fail unless the result set implements some sort of disconnected row set).

Discussion


Log in to post a comment.

MongoDB Logo MongoDB