[Bast-commits] r5745 - in DBIx-Class/0.08/trunk/lib/DBIx/Class: .
Manual
castaway at dev.catalyst.perl.org
castaway at dev.catalyst.perl.org
Thu Mar 12 20:36:41 GMT 2009
Author: castaway
Date: 2009-03-12 20:36:41 +0000 (Thu, 12 Mar 2009)
New Revision: 5745
Modified:
DBIx-Class/0.08/trunk/lib/DBIx/Class/Manual/FAQ.pod
DBIx-Class/0.08/trunk/lib/DBIx/Class/ResultSet.pm
Log:
Add docs in various places to point out how to get the total count of rows for a paged resultset
Modified: DBIx-Class/0.08/trunk/lib/DBIx/Class/Manual/FAQ.pod
===================================================================
--- DBIx-Class/0.08/trunk/lib/DBIx/Class/Manual/FAQ.pod 2009-03-12 20:24:55 UTC (rev 5744)
+++ DBIx-Class/0.08/trunk/lib/DBIx/Class/Manual/FAQ.pod 2009-03-12 20:36:41 UTC (rev 5745)
@@ -274,7 +274,7 @@
Or, if you have quoting off:
- ->search({ 'YEAR(date_of_birth' => 1979 });
+ ->search({ 'YEAR(date_of_birth)' => 1979 });
=item .. find more help on constructing searches?
@@ -353,6 +353,20 @@
L<DBIx::Class::PK/discard_changes> does just that by re-fetching the row from storage
using the row's primary key.
+=item .. fetch my data a "page" at a time?
+
+Pass the C<rows> and C<page> attributes to your search, eg:
+
+ ->search({}, { rows => 10, page => 1});
+
+=item .. get a count of all rows even when paging?
+
+Call C<pager> on the paged resultset, it will return a L<Data::Page>
+object. Calling C<total_entries> on the pager will return the correct
+total.
+
+C<count> on the resultset will only return the total number in the page.
+
=back
=head2 Inserting and updating data
Modified: DBIx-Class/0.08/trunk/lib/DBIx/Class/ResultSet.pm
===================================================================
--- DBIx-Class/0.08/trunk/lib/DBIx/Class/ResultSet.pm 2009-03-12 20:24:55 UTC (rev 5744)
+++ DBIx-Class/0.08/trunk/lib/DBIx/Class/ResultSet.pm 2009-03-12 20:36:41 UTC (rev 5745)
@@ -1636,6 +1636,9 @@
Return Value a L<Data::Page> object for the current resultset. Only makes
sense for queries with a C<page> attribute.
+To get the full count of entries for a paged resultset, call
+C<total_entries> on the L<Data::Page> object.
+
=cut
sub pager {
@@ -2857,6 +2860,10 @@
If L<rows> attribute is not specified it defualts to 10 rows per page.
+When you have a paged resultset, L</count> will only return the number
+of rows in the page. To get the total, use the L</pager> and call
+C<total_entries> on it.
+
=head2 rows
=over 4
More information about the Bast-commits
mailing list