NAME
DBIX::Class::ResultSet - Responsible for fetching and creating resultset.
SYNOPSIS;
$rs=MyApp::DB::Class->search(registered=>1);
DESCRIPTION
The resultset is also known as an iterator.
METHODS
- new <db_class> <attrs>
-
The resultset constructor. Takes a db class and an attribute hash (see below for more info on attributes)
- cursor
-
Return a storage driven cursor to the given resultset.
- slice <first> <last>
-
return a number of elements from the given resultset.
- next
-
Returns the next element in this resultset.
- count
-
Performs an SQL count with the same query as the resultset was built with to find the number of elements.
- all
-
Returns all elements in the resultset. Is called implictly if the search method is used in list context.
- reset
-
Reset this resultset's cursor, so you can iterate through the elements again.
- first
-
resets the resultset and returns the first element.
- delete
-
Deletes all elements in the resultset.
- pager
-
Returns a Data::Page object for the current resultset. Only makes sense for queries with page turned on.
- page <page>
-
Returns a new resultset representing a given page.
Attributes
The resultset is responsible for handling the various attributes that can be passed in with the search functions. Here's an overview of them:
- order_by
-
Which column to order the results by.
- cols
-
Which cols should be retrieved on the first search.
- join
-
Contains a list of relations that should be joined for this query. Can also contain a hash referece to refer to that relation's relations.
- from
-
This attribute can contain a arrayref of elements. each element can be another arrayref, to nest joins, or it can be a hash which represents the two sides of the join.
*NOTE* Use this on your own risk. This allows you to shoot your foot off!
- page
-
Should the resultset be paged? This can also be enabled by using the 'page' option.
- rows
-
For paged resultsset, how many rows per page
- offset
-
For paged resultsset, which page to start on.
1;