line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package # hide from PAUSE |
2
|
|
|
|
|
|
|
DBIx::Class::CDBICompat::ImaDBI; |
3
|
|
|
|
|
|
|
|
4
|
2
|
|
|
2
|
|
415
|
use strict; |
|
2
|
|
|
|
|
5
|
|
|
2
|
|
|
|
|
47
|
|
5
|
2
|
|
|
2
|
|
9
|
use warnings; |
|
2
|
|
|
|
|
5
|
|
|
2
|
|
|
|
|
45
|
|
6
|
2
|
|
|
2
|
|
231
|
use DBIx::ContextualFetch; |
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
use base 'DBIx::Class'; |
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
use DBIx::Class::_Util qw(quote_sub perlstring); |
11
|
|
|
|
|
|
|
use namespace::clean; |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
__PACKAGE__->mk_classdata('sql_transformer_class' => |
14
|
|
|
|
|
|
|
'DBIx::Class::CDBICompat::SQLTransformer'); |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
sub db_Main { |
17
|
|
|
|
|
|
|
return $_[0]->storage->dbh; |
18
|
|
|
|
|
|
|
} |
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
sub connection { |
21
|
|
|
|
|
|
|
my ($class, @info) = @_; |
22
|
|
|
|
|
|
|
$info[3] = { %{ $info[3] || {}} }; |
23
|
|
|
|
|
|
|
$info[3]->{RootClass} = 'DBIx::ContextualFetch'; |
24
|
|
|
|
|
|
|
return $class->next::method(@info); |
25
|
|
|
|
|
|
|
} |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
sub __driver { |
28
|
|
|
|
|
|
|
return $_[0]->storage->dbh->{Driver}->{Name}; |
29
|
|
|
|
|
|
|
} |
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
sub set_sql { |
32
|
|
|
|
|
|
|
my ($class, $name, $sql) = @_; |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
quote_sub "${class}::sql_${name}", sprintf( <<'EOC', perlstring $sql ); |
35
|
|
|
|
|
|
|
my $class = shift; |
36
|
|
|
|
|
|
|
return $class->storage->dbh_do( |
37
|
|
|
|
|
|
|
_prepare_sth => $class->transform_sql(%s, @_) |
38
|
|
|
|
|
|
|
); |
39
|
|
|
|
|
|
|
EOC |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
if ($sql =~ /select/i) { # FIXME - this should be anchore surely...? |
43
|
|
|
|
|
|
|
quote_sub "${class}::search_${name}", sprintf( <<'EOC', "sql_$name" ); |
44
|
|
|
|
|
|
|
my ($class, @args) = @_; |
45
|
|
|
|
|
|
|
$class->sth_to_objects( $class->%s, \@args); |
46
|
|
|
|
|
|
|
EOC |
47
|
|
|
|
|
|
|
} |
48
|
|
|
|
|
|
|
} |
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
sub sth_to_objects { |
51
|
|
|
|
|
|
|
my ($class, $sth, $execute_args) = @_; |
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
$sth->execute(@$execute_args); |
54
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
my (@ret, $rsrc); |
56
|
|
|
|
|
|
|
while (my $row = $sth->fetchrow_hashref) { |
57
|
|
|
|
|
|
|
push(@ret, $class->inflate_result( |
58
|
|
|
|
|
|
|
( $rsrc ||= $class->result_source ), |
59
|
|
|
|
|
|
|
$row |
60
|
|
|
|
|
|
|
)); |
61
|
|
|
|
|
|
|
} |
62
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
return @ret; |
64
|
|
|
|
|
|
|
} |
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
sub transform_sql { |
67
|
|
|
|
|
|
|
my ($class, $sql, @args) = @_; |
68
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
my $tclass = $class->sql_transformer_class; |
70
|
|
|
|
|
|
|
$class->ensure_class_loaded($tclass); |
71
|
|
|
|
|
|
|
my $t = $tclass->new($class, $sql, @args); |
72
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
return sprintf($t->sql, $t->args); |
74
|
|
|
|
|
|
|
} |
75
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
package |
77
|
|
|
|
|
|
|
DBIx::ContextualFetch::st; # HIDE FROM PAUSE THIS IS NOT OUR CLASS |
78
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
no warnings 'redefine'; |
80
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
sub _untaint_execute { |
82
|
|
|
|
|
|
|
my $sth = shift; |
83
|
|
|
|
|
|
|
my $old_value = $sth->{Taint}; |
84
|
|
|
|
|
|
|
$sth->{Taint} = 0; |
85
|
|
|
|
|
|
|
my $ret; |
86
|
|
|
|
|
|
|
{ |
87
|
|
|
|
|
|
|
no warnings 'uninitialized'; |
88
|
|
|
|
|
|
|
$ret = $sth->SUPER::execute(@_); |
89
|
|
|
|
|
|
|
} |
90
|
|
|
|
|
|
|
$sth->{Taint} = $old_value; |
91
|
|
|
|
|
|
|
return $ret; |
92
|
|
|
|
|
|
|
} |
93
|
|
|
|
|
|
|
|
94
|
|
|
|
|
|
|
1; |