Commit | Line | Data |
231ba12b |
1 | use strict; |
2 | use warnings; |
3 | |
4 | package CtrlO::DBIC::Cursor::RowCountStatistics; |
5 | use Class::Method::Modifiers; |
6 | |
7 | use parent 'DBIx::Class::Storage::DBI::Cursor'; |
8 | |
9 | our $VERSION = '0.000001'; # 0.0.1 |
10 | $VERSION = eval $VERSION; |
11 | |
12 | after next => sub { |
13 | my ($self) = @_; |
14 | $self->{_ctrlo_rcs_count}++ |
15 | unless $self->{_done}; |
16 | }; |
17 | |
18 | before __finish_sth => sub { |
19 | my ($self) = @_; |
20 | my $sql = $self->sth->{Statement}; |
21 | $self->storage->debugobj->query_complete( |
22 | $self->{_ctrlo_rcs_count} || 0, |
23 | $sql, |
24 | # TODO pass bind params |
25 | ) if $self->storage->debug; |
26 | }; |
27 | |
28 | 1; |
29 | |
30 | =head1 NAME |
31 | |
32 | CtrlO::DBIC::Cursor::RowCountStatistics - Description goes here |
33 | |
34 | =head1 SYNOPSIS |
35 | |
36 | =head1 DESCRIPTION |
37 | |
38 | =head1 AUTHOR |
39 | |
40 | r.sedlacek@shadowcat.co.uk |
41 | |
42 | =head1 CONTRIBUTORS |
43 | |
44 | None yet - maybe this software is perfect! (ahahahahahahahahaha) |
45 | |
46 | =head1 COPYRIGHT |
47 | |
48 | Copyright (c) 2015 the CtrlO::DBIC::Cursor::RowCountStatistics L</AUTHOR> and L</CONTRIBUTORS> |
49 | as listed above. |
50 | |
51 | =head1 LICENSE |
52 | |
53 | This library is free software and may be distributed under the same terms |
54 | as perl itself. |