| Filename | /2home/ss5/perl5/perlbrew/perls/perl-5.12.3/lib/site_perl/5.12.3/DBIx/Class/Cursor.pm |
| Statements | Executed 10 statements in 179µs |
| Calls | P | F | Exclusive Time |
Inclusive Time |
Subroutine |
|---|---|---|---|---|---|
| 1 | 1 | 1 | 12µs | 14µs | DBIx::Class::Cursor::BEGIN@3 |
| 1 | 1 | 1 | 7µs | 83µs | DBIx::Class::Cursor::BEGIN@6 |
| 1 | 1 | 1 | 7µs | 14µs | DBIx::Class::Cursor::BEGIN@4 |
| 0 | 0 | 0 | 0s | 0s | DBIx::Class::Cursor::all |
| 0 | 0 | 0 | 0s | 0s | DBIx::Class::Cursor::new |
| 0 | 0 | 0 | 0s | 0s | DBIx::Class::Cursor::next |
| 0 | 0 | 0 | 0s | 0s | DBIx::Class::Cursor::reset |
| Line | State ments |
Time on line |
Calls | Time in subs |
Code |
|---|---|---|---|---|---|
| 1 | package DBIx::Class::Cursor; | ||||
| 2 | |||||
| 3 | 3 | 18µs | 2 | 16µs | # spent 14µs (12+2) within DBIx::Class::Cursor::BEGIN@3 which was called:
# once (12µs+2µs) by base::import at line 3 # spent 14µs making 1 call to DBIx::Class::Cursor::BEGIN@3
# spent 2µs making 1 call to strict::import |
| 4 | 3 | 21µs | 2 | 22µs | # spent 14µs (7+7) within DBIx::Class::Cursor::BEGIN@4 which was called:
# once (7µs+7µs) by base::import at line 4 # spent 14µs making 1 call to DBIx::Class::Cursor::BEGIN@4
# spent 8µs making 1 call to warnings::import |
| 5 | |||||
| 6 | 3 | 138µs | 2 | 83µs | # spent 83µs (7+76) within DBIx::Class::Cursor::BEGIN@6 which was called:
# once (7µs+76µs) by base::import at line 6 # spent 83µs making 1 call to DBIx::Class::Cursor::BEGIN@6
# spent 76µs making 1 call to base::import, recursion: max depth 1, sum of overlapping time 76µs |
| 7 | |||||
| 8 | =head1 NAME | ||||
| 9 | |||||
| 10 | DBIx::Class::Cursor - Abstract object representing a query cursor on a | ||||
| 11 | resultset. | ||||
| 12 | |||||
| 13 | =head1 SYNOPSIS | ||||
| 14 | |||||
| 15 | my $cursor = $schema->resultset('CD')->cursor(); | ||||
| 16 | my $first_cd = $cursor->next; | ||||
| 17 | |||||
| 18 | =head1 DESCRIPTION | ||||
| 19 | |||||
| 20 | A Cursor represents a query cursor on a L<DBIx::Class::ResultSet> object. It | ||||
| 21 | allows for traversing the result set with L</next>, retrieving all results with | ||||
| 22 | L</all> and resetting the cursor with L</reset>. | ||||
| 23 | |||||
| 24 | Usually, you would use the cursor methods built into L<DBIx::Class::ResultSet> | ||||
| 25 | to traverse it. See L<DBIx::Class::ResultSet/next>, | ||||
| 26 | L<DBIx::Class::ResultSet/reset> and L<DBIx::Class::ResultSet/all> for more | ||||
| 27 | information. | ||||
| 28 | |||||
| 29 | =head1 METHODS | ||||
| 30 | |||||
| 31 | =head2 new | ||||
| 32 | |||||
| 33 | Virtual method. Returns a new L<DBIx::Class::Cursor> object. | ||||
| 34 | |||||
| 35 | =cut | ||||
| 36 | |||||
| 37 | sub new { | ||||
| 38 | die "Virtual method!"; | ||||
| 39 | } | ||||
| 40 | |||||
| 41 | =head2 next | ||||
| 42 | |||||
| 43 | Virtual method. Advances the cursor to the next row. Returns an array of | ||||
| 44 | column values (the result of L<DBI/fetchrow_array> method). | ||||
| 45 | |||||
| 46 | =cut | ||||
| 47 | |||||
| 48 | sub next { | ||||
| 49 | die "Virtual method!"; | ||||
| 50 | } | ||||
| 51 | |||||
| 52 | =head2 reset | ||||
| 53 | |||||
| 54 | Virtual method. Resets the cursor to the beginning. | ||||
| 55 | |||||
| 56 | =cut | ||||
| 57 | |||||
| 58 | sub reset { | ||||
| 59 | die "Virtual method!"; | ||||
| 60 | } | ||||
| 61 | |||||
| 62 | =head2 all | ||||
| 63 | |||||
| 64 | Virtual method. Returns all rows in the L<DBIx::Class::ResultSet>. | ||||
| 65 | |||||
| 66 | =cut | ||||
| 67 | |||||
| 68 | sub all { | ||||
| 69 | my ($self) = @_; | ||||
| 70 | $self->reset; | ||||
| 71 | my @all; | ||||
| 72 | while (my @row = $self->next) { | ||||
| 73 | push(@all, \@row); | ||||
| 74 | } | ||||
| 75 | $self->reset; | ||||
| 76 | return @all; | ||||
| 77 | } | ||||
| 78 | |||||
| 79 | 1 | 2µs | 1; |