Commit | Line | Data |
4faaf174 |
1 | package # moar hide |
2 | DBICTest::SQLTracerObj; |
3 | |
4 | use strict; |
5 | use warnings; |
6 | |
7 | use base 'DBIx::Class::Storage::Statistics'; |
8 | |
9 | sub query_start { push @{$_[0]{sqlbinds}}, [ ($_[1] =~ /^\s*(\S+)/)[0], [ $_[1], @{ $_[2]||[] } ] ] } |
10 | |
11 | # who the hell came up with this API >:( |
12 | for my $txn (qw(begin rollback commit)) { |
13 | no strict 'refs'; |
14 | *{"txn_$txn"} = sub { push @{$_[0]{sqlbinds}}, [ uc $txn => [ uc $txn ] ] }; |
15 | } |
16 | |
17 | sub svp_begin { push @{$_[0]{sqlbinds}}, [ SAVEPOINT => [ "SAVEPOINT $_[1]" ] ] } |
18 | sub svp_release { push @{$_[0]{sqlbinds}}, [ RELEASE_SAVEPOINT => [ "RELEASE $_[1]" ] ] } |
19 | sub svp_rollback { push @{$_[0]{sqlbinds}}, [ ROLLBACK_TO_SAVEPOINT => [ "ROLLBACK TO $_[1]" ] ] } |
20 | |
21 | 1; |