override storage to access sth details
[dbsrgits/DBIx-Class-RowCountStatistics.git] / lib / CtrlO / DBIC / Cursor / RowCountStatistics / Storage.pm
diff --git a/lib/CtrlO/DBIC/Cursor/RowCountStatistics/Storage.pm b/lib/CtrlO/DBIC/Cursor/RowCountStatistics/Storage.pm
new file mode 100644 (file)
index 0000000..005a92b
--- /dev/null
@@ -0,0 +1,41 @@
+use strict;
+use warnings;
+
+package CtrlO::DBIC::Cursor::RowCountStatistics::Storage;
+use Class::Method::Modifiers;
+
+sub new {
+    my ($class, $original) = @_;
+    return bless {
+        original => $original,
+    }, $class;
+}
+
+sub _cached_sql {
+    my ($self) = @_;
+    return $self->{cached_sql};
+}
+
+sub throw_exception {
+    my $self = shift;
+    return $self->{original}->throw_exception(@_);
+}
+
+sub _select {
+    my $self = shift;
+    my @res = $self->{original}->_select(@_);
+    $self->{cached_sql} = $res[1]{Statement};
+    return @res;
+}
+
+sub debug {
+    my $self = shift;
+    return $self->{original}->debug(@_);
+}
+
+sub debugobj {
+    my $self = shift;
+    return $self->{original}->debugobj(@_);
+}
+
+1;