File | /wise/base/static/lib/perl5/site_perl/5.10.0/DBIx/Class/Cursor.pm | Statements Executed | 7 | Total Time | 0.000182 seconds |
Calls | P | F | Exclusive Time |
Inclusive Time |
Subroutine | |
---|---|---|---|---|---|---|
0 | 0 | 0 | 0 | 0 | DBIx::Class::Cursor:: | BEGIN |
0 | 0 | 0 | 0 | 0 | DBIx::Class::Cursor:: | all |
0 | 0 | 0 | 0 | 0 | DBIx::Class::Cursor:: | new |
0 | 0 | 0 | 0 | 0 | DBIx::Class::Cursor:: | next |
0 | 0 | 0 | 0 | 0 | DBIx::Class::Cursor:: | reset |
Line | Stmts. | Exclusive Time | Avg. | Code |
---|---|---|---|---|
1 | package DBIx::Class::Cursor; | |||
2 | ||||
3 | 3 | 4.1e-5 | 1.4e-5 | use strict; # spent 21µs making 1 call to strict::import |
4 | 3 | 0.00014 | 4.6e-5 | use warnings; # spent 31µs making 1 call to warnings::import |
5 | ||||
6 | =head1 NAME | |||
7 | ||||
8 | DBIx::Class::Cursor - Abstract object representing a query cursor on a | |||
9 | resultset. | |||
10 | ||||
11 | =head1 SYNOPSIS | |||
12 | ||||
13 | my $cursor = $schema->resultset('CD')->cursor(); | |||
14 | my $first_cd = $cursor->next; | |||
15 | ||||
16 | =head1 DESCRIPTION | |||
17 | ||||
18 | A Cursor represents a query cursor on a L<DBIx::Class::ResultSet> object. It | |||
19 | allows for traversing the result set with L</next>, retrieving all results with | |||
20 | L</all> and resetting the cursor with L</reset>. | |||
21 | ||||
22 | Usually, you would use the cursor methods built into L<DBIx::Class::ResultSet> | |||
23 | to traverse it. See L<DBIx::Class::ResultSet/next>, | |||
24 | L<DBIx::Class::ResultSet/reset> and L<DBIx::Class::ResultSet/all> for more | |||
25 | information. | |||
26 | ||||
27 | =head1 METHODS | |||
28 | ||||
29 | =head2 new | |||
30 | ||||
31 | Virtual method. Returns a new L<DBIx::Class::Cursor> object. | |||
32 | ||||
33 | =cut | |||
34 | ||||
35 | sub new { | |||
36 | die "Virtual method!"; | |||
37 | } | |||
38 | ||||
39 | =head2 next | |||
40 | ||||
41 | Virtual method. Advances the cursor to the next row. Returns an array of | |||
42 | column values (the result of L<DBI/fetchrow_array> method). | |||
43 | ||||
44 | =cut | |||
45 | ||||
46 | sub next { | |||
47 | die "Virtual method!"; | |||
48 | } | |||
49 | ||||
50 | =head2 reset | |||
51 | ||||
52 | Virtual method. Resets the cursor to the beginning. | |||
53 | ||||
54 | =cut | |||
55 | ||||
56 | sub reset { | |||
57 | die "Virtual method!"; | |||
58 | } | |||
59 | ||||
60 | =head2 all | |||
61 | ||||
62 | Virtual method. Returns all rows in the L<DBIx::Class::ResultSet>. | |||
63 | ||||
64 | =cut | |||
65 | ||||
66 | sub 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 | ||||
77 | 1 | 3.0e-6 | 3.0e-6 | 1; |