missed commit of version inc
[dbsrgits/DBIx-Class.git] / lib / DBIx / Class / Cursor.pm
CommitLineData
5cf243f6 1package DBIx::Class::Cursor;
1923c0b4 2
3use strict;
4use warnings;
1923c0b4 5
5cf243f6 6=head1 NAME
7
8DBIx::Class::Cursor - Abstract object representing a query cursor on a
9resultset.
10
11=head1 SYNOPSIS
12
13 my $cursor = $schema->resultset('CD')->cursor();
14 my $first_cd = $cursor->next;
15
16=head1 DESCRIPTION
17
18A Cursor represents a query cursor on a L<DBIx::Class::ResultSet> object. It
19allows for traversing the result set with L</next>, retrieving all results with
20L</all> and resetting the cursor with L</reset>.
21
22Usually, you would use the cursor methods built into L<DBIx::Class::ResultSet>
23to traverse it. See L<DBIx::Class::ResultSet/next>,
24L<DBIx::Class::ResultSet/reset> and L<DBIx::Class::ResultSet/all> for more
25information.
26
27=head1 METHODS
28
29=head2 new
30
5cf243f6 31Virtual method. Returns a new L<DBIx::Class::Cursor> object.
32
33=cut
34
1923c0b4 35sub new {
28927b50 36 die "Virtual method!";
1923c0b4 37}
38
5cf243f6 39=head2 next
40
685dad64 41Virtual method. Advances the cursor to the next row. Returns an array of
42column values (the result of L<DBI/fetchrow_array> method).
5cf243f6 43
44=cut
45
1923c0b4 46sub next {
28927b50 47 die "Virtual method!";
1923c0b4 48}
49
5cf243f6 50=head2 reset
51
5cf243f6 52Virtual method. Resets the cursor to the beginning.
53
54=cut
55
1923c0b4 56sub reset {
28927b50 57 die "Virtual method!";
1909f72b 58}
59
5cf243f6 60=head2 all
61
8e23eaf2 62Virtual method. Returns all rows in the L<DBIx::Class::ResultSet>.
5cf243f6 63
64=cut
65
1a14aa3f 66sub all {
67 my ($self) = @_;
68 $self->reset;
69 my @all;
70 while (my @row = $self->next) {
71 push(@all, \@row);
72 }
73 $self->reset;
74 return @all;
75}
76
1923c0b4 771;