Fugu/SQL.pm untested

filter: Statementstmt 0.0% 0 / 18 Branchbran n/a Conditioncond n/a MC/DCmcdc n/a Subroutinesub 0.0% 0 / 6 Podpod 0.0% 0 / 4 totaltotal 0.0% 0 / 28 CC 1 SCAR 6.9
CC
1
Cov
0%
new
2.0
run
2.0
set_dbh
2.0
CRAP 2.0
1 use strict;
2 use warnings;
3  
4 package App::Squid::Redirector::Fugu::SQL;
5  
6 sub new {
7 my $class = shift;
8 return bless({}, $class);
9 }
10  
11 sub run {
12 my($self, $query, $fn) = @_;
13
14 my $sth = $self->{dbh}->prepare($query);
15 $sth->execute();
16
17 # function will receive sth as param
18 &$fn($sth);
19
20 $sth->finish();
21 }
22  
23 sub set_dbh {
24 my($self, $dbh) = @_;
25 $self->{dbh} = $dbh;
26 }
27  
28 sub set_logger {
29 my($self, $logger) = @_;
30 $self->{logger} = $logger;
31 }
32  
33 1;