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