File Coverage

blib/lib/Rose/Planter/Gardener.pm
Criterion Covered Total %
statement 6 6 100.0
branch n/a
condition n/a
subroutine 2 2 100.0
pod n/a
total 8 8 100.0


line stmt bran cond sub pod time code
1             =head1 NAME
2              
3             Rose::Planter::Gardener -- base class for manager classes
4              
5             =over
6              
7             =cut
8              
9             package Rose::Planter::Gardener;
10 1     1   4164 use Log::Log4perl qw/get_logger/;
  1         66660  
  1         7  
11 1     1   121 use base 'Rose::DB::Object::Manager';
  1         2  
  1         814  
12              
13             =item get_objects_from_sql
14              
15             Log queries to the category db.query
16             before calling the parent method.
17              
18             =cut
19              
20             sub get_objects_from_sql {
21              
22             my $self = shift;
23             my %args = @_;
24              
25             my $sql = $args{sql};
26             my @bind = @{ $args{args} };
27             for my $b (@bind) {
28             if (!defined($b)) {
29             $sql =~ s/\?/NULL/;
30             } else {
31             $sql =~ s/\?/'$b'/;
32             }
33             }
34             # TODO improve the above to really quote things
35              
36             local $Log::Log4perl::caller_depth = $Log::Log4perl::caller_depth + 1;
37             get_logger('db.query')->debug('get_objects_from_sql '.(ref $self || $self));
38             get_logger('db.query')->debug($sql);
39              
40             $self->SUPER::get_objects_from_sql(%args);
41              
42             }
43              
44             =back
45              
46             =cut
47              
48             1;
49