File | /wise/base/static/lib/perl5/site_perl/5.10.0/DBIx/Class/Storage/DBI/Cursor.pm | Statements Executed | 665809 | Total Time | 76.824095000002 seconds |
Calls | P | F | Exclusive Time |
Inclusive Time |
Subroutine | |
---|---|---|---|---|---|---|
55479 | 1 | 1 | 1.20293 | 559.82232 | DBIx::Class::Storage::DBI::Cursor:: | _dbh_next |
55479 | 2 | 1 | 0.45418 | 565.71995 | DBIx::Class::Storage::DBI::Cursor:: | next |
55479 | 1 | 1 | 0.30403 | 0.30403 | DBIx::Class::Storage::DBI::Cursor:: | _check_dbh_gen |
4 | 1 | 1 | 8.3e-5 | 8.3e-5 | DBIx::Class::Storage::DBI::Cursor:: | new |
1 | 1 | 1 | 1.3e-5 | 2.2e-5 | DBIx::Class::Storage::DBI::Cursor:: | reset |
1 | 1 | 1 | 9.0e-6 | 9.0e-6 | DBIx::Class::Storage::DBI::Cursor:: | _soft_reset |
0 | 0 | 0 | 0 | 0 | DBIx::Class::Storage::DBI::Cursor:: | BEGIN |
0 | 0 | 0 | 0 | 0 | DBIx::Class::Storage::DBI::Cursor:: | DESTROY |
0 | 0 | 0 | 0 | 0 | DBIx::Class::Storage::DBI::Cursor:: | _dbh_all |
0 | 0 | 0 | 0 | 0 | DBIx::Class::Storage::DBI::Cursor:: | all |
Line | Stmts. | Exclusive Time | Avg. | Code |
---|---|---|---|---|
1 | package DBIx::Class::Storage::DBI::Cursor; | |||
2 | ||||
3 | 3 | 3.2e-5 | 1.1e-5 | use base qw/DBIx::Class::Cursor/; # spent 1.03ms making 1 call to base::import |
4 | ||||
5 | 3 | 4.9e-5 | 1.6e-5 | use strict; # spent 39µs making 1 call to strict::import |
6 | 3 | 0.00064 | 0.00021 | use warnings; # spent 19µs making 1 call to warnings::import |
7 | ||||
8 | =head1 NAME | |||
9 | ||||
10 | DBIx::Class::Storage::DBI::Cursor - 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 | Returns a new L<DBIx::Class::Storage::DBI::Cursor> object. | |||
34 | ||||
35 | =cut | |||
36 | ||||
37 | # spent 83µs within DBIx::Class::Storage::DBI::Cursor::new which was called 4 times, avg 21µs/call:
# 4 times (83µs+0) by DBIx::Class::Storage::DBI::select at line 1160 of /wise/base/static/lib/perl5/site_perl/5.10.0/DBIx/Class/Storage/DBI.pm, avg 21µs/call | |||
38 | 4 | 1.4e-5 | 3.5e-6 | my ($class, $storage, $args, $attrs) = @_; |
39 | #use Data::Dumper; warn Dumper(@_); | |||
40 | 4 | 4.0e-6 | 1.0e-6 | $class = ref $class if ref $class; |
41 | 4 | 2.5e-5 | 6.3e-6 | my $new = { |
42 | storage => $storage, | |||
43 | args => $args, | |||
44 | pos => 0, | |||
45 | attrs => $attrs, | |||
46 | _dbh_gen => $storage->{_dbh_gen}, | |||
47 | }; | |||
48 | ||||
49 | 4 | 2.3e-5 | 5.8e-6 | return bless ($new, $class); |
50 | } | |||
51 | ||||
52 | =head2 next | |||
53 | ||||
54 | =over 4 | |||
55 | ||||
56 | =item Arguments: none | |||
57 | ||||
58 | =item Return Value: \@row_columns | |||
59 | ||||
60 | =back | |||
61 | ||||
62 | Advances the cursor to the next row and returns an array of column | |||
63 | values (the result of L<DBI/fetchrow_array> method). | |||
64 | ||||
65 | =cut | |||
66 | ||||
67 | # spent 560s (1.20+559) within DBIx::Class::Storage::DBI::Cursor::_dbh_next which was called 55479 times, avg 10.1ms/call:
# 55479 times (1.20s+559s) by DBIx::Class::Storage::DBI::dbh_do at line 593 of /wise/base/static/lib/perl5/site_perl/5.10.0/DBIx/Class/Storage/DBI.pm, avg 10.1ms/call | |||
68 | 55479 | 0.08260 | 1.5e-6 | my ($storage, $dbh, $self) = @_; |
69 | ||||
70 | 55479 | 0.22938 | 4.1e-6 | $self->_check_dbh_gen; # spent 304ms making 55479 calls to DBIx::Class::Storage::DBI::Cursor::_check_dbh_gen, avg 5µs/call |
71 | 55479 | 0.08703 | 1.6e-6 | if ($self->{attrs}{rows} && $self->{pos} >= $self->{attrs}{rows}) { |
72 | $self->{sth}->finish if $self->{sth}->{Active}; | |||
73 | delete $self->{sth}; | |||
74 | $self->{done} = 1; | |||
75 | } | |||
76 | 55479 | 0.03544 | 6.4e-7 | return if $self->{done}; |
77 | 55479 | 0.03682 | 6.6e-7 | unless ($self->{sth}) { |
78 | 4 | 0.00027 | 6.8e-5 | $self->{sth} = ($storage->_select(@{$self->{args}}))[1]; # spent 483s making 4 calls to DBIx::Class::Storage::DBI::MultiDistinctEmulation::_select, avg 121s/call |
79 | 4 | 1.0e-5 | 2.5e-6 | if ($self->{attrs}{software_limit}) { |
80 | if (my $offset = $self->{attrs}{offset}) { | |||
81 | $self->{sth}->fetch for 1 .. $offset; | |||
82 | } | |||
83 | } | |||
84 | } | |||
85 | 55479 | 75.27506 | 0.00136 | my @row = $self->{sth}->fetchrow_array; # spent 74.9s making 55479 calls to DBI::st::fetchrow_array, avg 1.35ms/call |
86 | 55479 | 0.06771 | 1.2e-6 | if (@row) { |
87 | $self->{pos}++; | |||
88 | } else { | |||
89 | 1 | 2.0e-6 | 2.0e-6 | delete $self->{sth}; |
90 | 1 | 2.0e-6 | 2.0e-6 | $self->{done} = 1; |
91 | } | |||
92 | 55479 | 0.23479 | 4.2e-6 | return @row; |
93 | } | |||
94 | ||||
95 | # spent 566s (454ms+565) within DBIx::Class::Storage::DBI::Cursor::next which was called 55479 times, avg 10.2ms/call:
# 55477 times (454ms+183s) by DBIx::Class::ResultSet::next at line 758 of /wise/base/static/lib/perl5/site_perl/5.10.0/DBIx/Class/ResultSet.pm, avg 3.30ms/call
# 2 times (23µs+383s) by DBIx::Class::ResultSet::_count at line 995 of /wise/base/static/lib/perl5/site_perl/5.10.0/DBIx/Class/ResultSet.pm, avg 191s/call | |||
96 | 55479 | 0.05782 | 1.0e-6 | my ($self) = @_; |
97 | 55479 | 0.52901 | 9.5e-6 | $self->{storage}->dbh_do($self->can('_dbh_next'), $self); # spent 565s making 55479 calls to DBIx::Class::Storage::DBI::dbh_do, avg 10.2ms/call
# spent 178ms making 55479 calls to UNIVERSAL::can, avg 3µs/call |
98 | } | |||
99 | ||||
100 | =head2 all | |||
101 | ||||
102 | =over 4 | |||
103 | ||||
104 | =item Arguments: none | |||
105 | ||||
106 | =item Return Value: \@row_columns+ | |||
107 | ||||
108 | =back | |||
109 | ||||
110 | Returns a list of arrayrefs of column values for all rows in the | |||
111 | L<DBIx::Class::ResultSet>. | |||
112 | ||||
113 | =cut | |||
114 | ||||
115 | sub _dbh_all { | |||
116 | my ($storage, $dbh, $self) = @_; | |||
117 | ||||
118 | $self->_check_dbh_gen; | |||
119 | $self->{sth}->finish if $self->{sth}->{Active}; | |||
120 | delete $self->{sth}; | |||
121 | my ($rv, $sth) = $storage->_select(@{$self->{args}}); | |||
122 | return @{$sth->fetchall_arrayref}; | |||
123 | } | |||
124 | ||||
125 | sub all { | |||
126 | my ($self) = @_; | |||
127 | if ($self->{attrs}{software_limit} | |||
128 | && ($self->{attrs}{offset} || $self->{attrs}{rows})) { | |||
129 | return $self->SUPER::all; | |||
130 | } | |||
131 | $self->{storage}->dbh_do($self->can('_dbh_all'), $self); | |||
132 | } | |||
133 | ||||
134 | =head2 reset | |||
135 | ||||
136 | Resets the cursor to the beginning of the L<DBIx::Class::ResultSet>. | |||
137 | ||||
138 | =cut | |||
139 | ||||
140 | # spent 22µs (13+9) within DBIx::Class::Storage::DBI::Cursor::reset which was called
# once (13µs+9µs) by DBIx::Class::ResultSet::reset at line 1077 of /wise/base/static/lib/perl5/site_perl/5.10.0/DBIx/Class/ResultSet.pm | |||
141 | 1 | 2.0e-6 | 2.0e-6 | my ($self) = @_; |
142 | ||||
143 | # No need to care about failures here | |||
144 | 2 | 3.0e-6 | 1.5e-6 | eval { $self->{sth}->finish if $self->{sth} && $self->{sth}->{Active} }; |
145 | 1 | 8.0e-6 | 8.0e-6 | $self->_soft_reset; # spent 9µs making 1 call to DBIx::Class::Storage::DBI::Cursor::_soft_reset |
146 | } | |||
147 | ||||
148 | # spent 9µs within DBIx::Class::Storage::DBI::Cursor::_soft_reset which was called
# once (9µs+0) by DBIx::Class::Storage::DBI::Cursor::reset at line 145 | |||
149 | 1 | 1.0e-6 | 1.0e-6 | my ($self) = @_; |
150 | ||||
151 | 1 | 0 | 0 | delete $self->{sth}; |
152 | 1 | 0 | 0 | delete $self->{done}; |
153 | 1 | 1.0e-6 | 1.0e-6 | $self->{pos} = 0; |
154 | 1 | 2.0e-6 | 2.0e-6 | return $self; |
155 | } | |||
156 | ||||
157 | # spent 304ms within DBIx::Class::Storage::DBI::Cursor::_check_dbh_gen which was called 55479 times, avg 5µs/call:
# 55479 times (304ms+0) by DBIx::Class::Storage::DBI::Cursor::_dbh_next at line 70, avg 5µs/call | |||
158 | 55479 | 0.04817 | 8.7e-7 | my ($self) = @_; |
159 | ||||
160 | 55479 | 0.13890 | 2.5e-6 | if($self->{_dbh_gen} != $self->{storage}->{_dbh_gen}) { |
161 | $self->{_dbh_gen} = $self->{storage}->{_dbh_gen}; | |||
162 | $self->_soft_reset; | |||
163 | } | |||
164 | } | |||
165 | ||||
166 | sub DESTROY { | |||
167 | 4 | 1.2e-5 | 3.0e-6 | my ($self) = @_; |
168 | ||||
169 | # None of the reasons this would die matter if we're in DESTROY anyways | |||
170 | 4 | 3.0e-6 | 7.5e-7 | local $@; |
171 | 8 | 0.00028 | 3.5e-5 | eval { $self->{sth}->finish if $self->{sth} && $self->{sth}->{Active} }; # spent 132µs making 3 calls to DBI::st::finish, avg 44µs/call
# spent 66µs making 3 calls to DBI::common::FETCH, avg 22µs/call |
172 | } | |||
173 | ||||
174 | 1 | 3.0e-6 | 3.0e-6 | 1; |