From: Robert Sedlacek Date: Wed, 26 Aug 2015 17:43:56 +0000 (+0000) Subject: whitespace fixes and some code comments X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=7135993c3a0a257e73ea2f0029b2112441cce2c4;p=dbsrgits%2FDBIx-Class-RowCountStatistics.git whitespace fixes and some code comments --- diff --git a/lib/CtrlO/DBIC/Cursor/RowCountStatistics.pm b/lib/CtrlO/DBIC/Cursor/RowCountStatistics.pm index 3edfd95..99d4170 100644 --- a/lib/CtrlO/DBIC/Cursor/RowCountStatistics.pm +++ b/lib/CtrlO/DBIC/Cursor/RowCountStatistics.pm @@ -11,9 +11,12 @@ use parent 'DBIx::Class::Storage::DBI::Cursor'; our $VERSION = '0.000001'; # 0.0.1 $VERSION = eval $VERSION; +# Wrap the original ::Storage::DBI we received so we can extract data +# from it's usage by the Cursor. around new => sub { my $orig = shift; my ($class, $storage, @rest) = @_; + return $orig->( $class, CtrlO::DBIC::Cursor::RowCountStatistics::Storage->new($storage), @@ -30,7 +33,11 @@ after next => sub { around all => sub { my $orig = shift; my ($self) = @_; + my @rows = $orig->(@_); + + # ->all does its own finalization, so we fire the complete event + # right here. $self->_emit_query_complete(scalar(@rows)); return @rows; }; @@ -43,6 +50,7 @@ before __finish_sth => sub { sub _emit_query_complete { my ($self, $count) = @_; + $self->storage->debugobj->query_complete( $count, $self->storage->_cached_sql,