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
|
2
|
|
|
2
|
|
1264
|
use Log::Log4perl qw/get_logger/; |
|
2
|
|
|
|
|
50112
|
|
|
2
|
|
|
|
|
22
|
|
11
|
2
|
|
|
2
|
|
126
|
use base 'Rose::DB::Object::Manager'; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
571
|
|
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
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
23
|
0
|
|
|
|
|
|
my %args = @_; |
24
|
|
|
|
|
|
|
|
25
|
0
|
|
|
|
|
|
my $sql = $args{sql}; |
26
|
0
|
|
|
|
|
|
my @bind = @{ $args{args} }; |
|
0
|
|
|
|
|
|
|
27
|
0
|
|
|
|
|
|
for my $b (@bind) { |
28
|
0
|
0
|
|
|
|
|
if (!defined($b)) { |
29
|
0
|
|
|
|
|
|
$sql =~ s/\?/NULL/; |
30
|
|
|
|
|
|
|
} else { |
31
|
0
|
|
|
|
|
|
$sql =~ s/\?/'$b'/; |
32
|
|
|
|
|
|
|
} |
33
|
|
|
|
|
|
|
} |
34
|
|
|
|
|
|
|
# TODO improve the above to really quote things |
35
|
|
|
|
|
|
|
|
36
|
0
|
|
|
|
|
|
local $Log::Log4perl::caller_depth = $Log::Log4perl::caller_depth + 1; |
37
|
0
|
|
0
|
|
|
|
get_logger('db.query')->debug('get_objects_from_sql '.(ref $self || $self)); |
38
|
0
|
|
|
|
|
|
get_logger('db.query')->debug($sql); |
39
|
|
|
|
|
|
|
|
40
|
0
|
|
|
|
|
|
$self->SUPER::get_objects_from_sql(%args); |
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
} |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
=back |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
=cut |
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
1; |
49
|
|
|
|
|
|
|
|