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