[Bps-public-commit] r10359 - DBIx-SearchBuilder/trunk
ruz at bestpractical.com
ruz at bestpractical.com
Tue Jan 15 17:53:33 EST 2008
Author: ruz
Date: Tue Jan 15 17:53:33 2008
New Revision: 10359
Modified:
DBIx-SearchBuilder/trunk/SearchBuilder.pm
Log:
SearchBuilder::CountAll()
* must_redo_search means that what is in memory is not actual and have to recount
* if paging is enabled then we have to fresh up count_all
Modified: DBIx-SearchBuilder/trunk/SearchBuilder.pm
==============================================================================
--- DBIx-SearchBuilder/trunk/SearchBuilder.pm (original)
+++ DBIx-SearchBuilder/trunk/SearchBuilder.pm Tue Jan 15 17:53:33 2008
@@ -1427,13 +1427,19 @@
# If we haven't actually got all objects loaded in memory, we
# really just want to do a quick count from the database.
- if ( $self->{'must_redo_search'} || !$self->{'count_all'}) {
+ # or if we have paging enabled then we count as well and store it in count_all
+ if ( $self->{'must_redo_search'} || ( $self->RowsPerPage && !$self->{'count_all'} ) ) {
# If we haven't already asked the database for the row count, do that
- $self->_DoCount(1) unless ( $self->{'count_all'} );
+ $self->_DoCount(1);
#Report back the raw # of rows in the database
return ( $self->{'count_all'} );
}
+
+ # if we have paging enabled and have count_all then return it
+ elsif ( $self->RowsPerPage ) {
+ return ( $self->{'count_all'} );
+ }
# If we have loaded everything from the DB we have an
# accurate count already.
More information about the Bps-public-commit
mailing list