From: Jess Robinson Date: Thu, 12 Mar 2009 20:36:41 +0000 (+0000) Subject: Add docs in various places to point out how to get the total count of rows for a... X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=dc64f1b5181dd959363bb2e3ad8363b1081792f6;p=dbsrgits%2FDBIx-Class-Historic.git Add docs in various places to point out how to get the total count of rows for a paged resultset --- diff --git a/lib/DBIx/Class/Manual/FAQ.pod b/lib/DBIx/Class/Manual/FAQ.pod index 273397a..7d4505e 100644 --- a/lib/DBIx/Class/Manual/FAQ.pod +++ b/lib/DBIx/Class/Manual/FAQ.pod @@ -274,7 +274,7 @@ replaced with the following.) 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 @@ to get a new, fresh copy of the row, just re-fetch the row from storage. L 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 and C attributes to your search, eg: + + ->search({}, { rows => 10, page => 1}); + +=item .. get a count of all rows even when paging? + +Call C on the paged resultset, it will return a L +object. Calling C on the pager will return the correct +total. + +C on the resultset will only return the total number in the page. + =back =head2 Inserting and updating data diff --git a/lib/DBIx/Class/ResultSet.pm b/lib/DBIx/Class/ResultSet.pm index 5969744..8854542 100644 --- a/lib/DBIx/Class/ResultSet.pm +++ b/lib/DBIx/Class/ResultSet.pm @@ -1636,6 +1636,9 @@ sub _normalize_populate_args { Return Value a L object for the current resultset. Only makes sense for queries with a C attribute. +To get the full count of entries for a paged resultset, call +C on the L object. + =cut sub pager { @@ -2857,6 +2860,10 @@ on it. If L attribute is not specified it defualts to 10 rows per page. +When you have a paged resultset, L will only return the number +of rows in the page. To get the total, use the L and call +C on it. + =head2 rows =over 4