162021b5d3fe4dd7c9b895c3872b8dd01516c5e0
[dbsrgits/DBIx-Class.git] / t / lib / DBICTest / DBICDebugObj.pm
1 package DBICTest::DBICDebugObj;
2
3 use strict;
4 use warnings;
5
6 use Exporter;
7 use Class::C3;
8
9 use base qw/DBIx::Class::Storage::Statistics/;
10 use base qw/Exporter/;
11 use base qw/Class::Accessor::Fast/;
12
13 __PACKAGE__->mk_accessors( qw/dbictest_sql_ref dbictest_bind_ref/ );
14
15
16 =head2 new(PKG, SQL_REF, BIND_REF, ...)
17
18 Creates a new instance that on subsequent queries will store
19 the generated SQL to the scalar pointed to by SQL_REF and bind
20 values to the array pointed to by BIND_REF.
21
22 =cut
23
24 sub new {
25   my $pkg = shift;
26   my $sql_ref = shift;
27   my $bind_ref = shift;
28
29   my $self = $pkg->SUPER::new(@_);
30
31   $self->debugfh(undef);
32
33   $self->dbictest_sql_ref($sql_ref);
34   $self->dbictest_bind_ref($bind_ref);
35
36   return $self;
37 }
38
39 sub query_start {
40   my $self = shift;
41
42   (${$self->dbictest_sql_ref}, @{$self->dbictest_bind_ref}) = @_;
43 }
44
45 sub query_end { }
46
47 sub txn_start { }
48
49 sub txn_commit { }
50
51 sub txn_rollback { }
52
53 1;