Commit | Line | Data |
1dc93d17 |
1 | package DBIx::Class::Storage::PrettyPrinter; |
2 | |
3 | use base 'DBIx::Class::Storage::Statistics'; |
4 | |
5 | use SQL::Abstract::Tree; |
6 | |
7 | __PACKAGE__->mk_group_accessors( simple => '_sqlat' ); |
8 | |
9 | sub new { |
10 | my $class = shift; |
11 | |
12 | my $sqlat = SQL::Abstract::Tree->new(shift @_); |
13 | my $self = $class->next::method(@_); |
14 | |
15 | $self->_sqlat($sqlat); |
16 | |
17 | return $self |
18 | } |
19 | |
20 | sub query_start { |
21 | my $self = shift; |
22 | my $string = shift; |
23 | |
24 | my $formatted = $self->_sqlat->format($string); |
25 | |
26 | $self->next::method($formatted, @_); |
27 | } |
28 | |
29 | 1; |