Filename | /usr/share/perl5/DBIx/Class/Cursor.pm |
Statements | Executed 7 statements in 342µs |
Calls | P | F | Exclusive Time |
Inclusive Time |
Subroutine |
---|---|---|---|---|---|
1 | 1 | 1 | 15µs | 23µs | BEGIN@3 | DBIx::Class::Cursor::
1 | 1 | 1 | 9µs | 61µs | BEGIN@6 | DBIx::Class::Cursor::
1 | 1 | 1 | 8µs | 12µs | BEGIN@4 | DBIx::Class::Cursor::
0 | 0 | 0 | 0s | 0s | all | DBIx::Class::Cursor::
0 | 0 | 0 | 0s | 0s | new | DBIx::Class::Cursor::
0 | 0 | 0 | 0s | 0s | next | DBIx::Class::Cursor::
0 | 0 | 0 | 0s | 0s | reset | DBIx::Class::Cursor::
Line | State ments |
Time on line |
Calls | Time in subs |
Code |
---|---|---|---|---|---|
1 | package DBIx::Class::Cursor; | ||||
2 | |||||
3 | 2 | 39µs | 2 | 30µs | # spent 23µs (15+7) within DBIx::Class::Cursor::BEGIN@3 which was called:
# once (15µs+7µs) by base::import at line 3 # spent 23µs making 1 call to DBIx::Class::Cursor::BEGIN@3
# spent 7µs making 1 call to strict::import |
4 | 2 | 39µs | 2 | 17µs | # spent 12µs (8+5) within DBIx::Class::Cursor::BEGIN@4 which was called:
# once (8µs+5µs) by base::import at line 4 # spent 12µs making 1 call to DBIx::Class::Cursor::BEGIN@4
# spent 5µs making 1 call to warnings::import |
5 | |||||
6 | 2 | 261µs | 2 | 61µs | # spent 61µs (9+51) within DBIx::Class::Cursor::BEGIN@6 which was called:
# once (9µs+51µs) by base::import at line 6 # spent 61µs making 1 call to DBIx::Class::Cursor::BEGIN@6
# spent 51µs making 1 call to base::import, recursion: max depth 1, sum of overlapping time 51µ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 | |||||
17 | # raw values off the database handle in resultset columns/select order | ||||
18 | my @next_cd_column_values = $cursor->next; | ||||
19 | |||||
20 | # list of all raw values as arrayrefs | ||||
21 | my @all_cds_column_values = $cursor->all; | ||||
22 | |||||
23 | =head1 DESCRIPTION | ||||
24 | |||||
25 | A Cursor represents a query cursor on a L<DBIx::Class::ResultSet> object. It | ||||
26 | allows for traversing the result set with L</next>, retrieving all results with | ||||
27 | L</all> and resetting the cursor with L</reset>. | ||||
28 | |||||
29 | Usually, you would use the cursor methods built into L<DBIx::Class::ResultSet> | ||||
30 | to traverse it. See L<DBIx::Class::ResultSet/next>, | ||||
31 | L<DBIx::Class::ResultSet/reset> and L<DBIx::Class::ResultSet/all> for more | ||||
32 | information. | ||||
33 | |||||
34 | =head1 METHODS | ||||
35 | |||||
36 | =head2 new | ||||
37 | |||||
38 | Virtual method. Returns a new L<DBIx::Class::Cursor> object. | ||||
39 | |||||
40 | =cut | ||||
41 | |||||
42 | sub new { | ||||
43 | die "Virtual method!"; | ||||
44 | } | ||||
45 | |||||
46 | =head2 next | ||||
47 | |||||
48 | Virtual method. Advances the cursor to the next row. Returns an array of | ||||
49 | column values (the result of L<DBI/fetchrow_array> method). | ||||
50 | |||||
51 | =cut | ||||
52 | |||||
53 | sub next { | ||||
54 | die "Virtual method!"; | ||||
55 | } | ||||
56 | |||||
57 | =head2 reset | ||||
58 | |||||
59 | Virtual method. Resets the cursor to the beginning. | ||||
60 | |||||
61 | =cut | ||||
62 | |||||
63 | sub reset { | ||||
64 | die "Virtual method!"; | ||||
65 | } | ||||
66 | |||||
67 | =head2 all | ||||
68 | |||||
69 | Virtual method. Returns all rows in the L<DBIx::Class::ResultSet>. | ||||
70 | |||||
71 | =cut | ||||
72 | |||||
73 | sub all { | ||||
74 | my ($self) = @_; | ||||
75 | $self->reset; | ||||
76 | my @all; | ||||
77 | while (my @row = $self->next) { | ||||
78 | push(@all, \@row); | ||||
79 | } | ||||
80 | $self->reset; | ||||
81 | return @all; | ||||
82 | } | ||||
83 | |||||
84 | =head1 FURTHER QUESTIONS? | ||||
85 | |||||
86 | Check the list of L<additional DBIC resources|DBIx::Class/GETTING HELP/SUPPORT>. | ||||
87 | |||||
88 | =head1 COPYRIGHT AND LICENSE | ||||
89 | |||||
90 | This module is free software L<copyright|DBIx::Class/COPYRIGHT AND LICENSE> | ||||
91 | by the L<DBIx::Class (DBIC) authors|DBIx::Class/AUTHORS>. You can | ||||
92 | redistribute it and/or modify it under the same terms as the | ||||
93 | L<DBIx::Class library|DBIx::Class/COPYRIGHT AND LICENSE>. | ||||
94 | |||||
95 | =cut | ||||
96 | |||||
97 | 1 | 3µs | 1; |