| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package DBIx::Simple::Inject; |
|
2
|
1
|
|
|
1
|
|
22
|
use 5.008001; |
|
|
1
|
|
|
|
|
3
|
|
|
|
1
|
|
|
|
|
30
|
|
|
3
|
1
|
|
|
1
|
|
5
|
use strict; |
|
|
1
|
|
|
|
|
1
|
|
|
|
1
|
|
|
|
|
34
|
|
|
4
|
1
|
|
|
1
|
|
5
|
use warnings; |
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
61
|
|
|
5
|
|
|
|
|
|
|
our $VERSION = '0.04'; |
|
6
|
1
|
|
|
1
|
|
857
|
use parent 'DBI'; |
|
|
1
|
|
|
|
|
277
|
|
|
|
1
|
|
|
|
|
4
|
|
|
7
|
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
package DBIx::Simple::Inject::db; |
|
9
|
1
|
|
|
1
|
|
19851
|
use strict; |
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
52
|
|
|
10
|
|
|
|
|
|
|
our @ISA = qw(DBI::db); |
|
11
|
|
|
|
|
|
|
|
|
12
|
1
|
|
|
1
|
|
928
|
use Class::Load; |
|
|
1
|
|
|
|
|
41729
|
|
|
|
1
|
|
|
|
|
60
|
|
|
13
|
1
|
|
|
1
|
|
978
|
use DBIx::Simple; |
|
|
1
|
|
|
|
|
4833
|
|
|
|
1
|
|
|
|
|
28
|
|
|
14
|
1
|
|
|
1
|
|
8
|
use Scalar::Util qw/weaken/; |
|
|
1
|
|
|
|
|
1
|
|
|
|
1
|
|
|
|
|
265
|
|
|
15
|
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
sub simple { |
|
17
|
0
|
|
|
0
|
|
|
my ($dbh) = @_; |
|
18
|
0
|
|
0
|
|
|
|
$dbh->{private_dbixsimple_object} ||= do { |
|
19
|
0
|
|
|
|
|
|
my $dbis = DBIx::Simple->connect($dbh); |
|
20
|
0
|
|
|
|
|
|
weaken($dbis->{dbh}); |
|
21
|
|
|
|
|
|
|
|
|
22
|
0
|
0
|
|
|
|
|
for my $k (keys %{ $dbh->{private_dbixsimple} || {} }) { |
|
|
0
|
|
|
|
|
|
|
|
23
|
0
|
|
|
|
|
|
my $v = $dbh->{private_dbixsimple}{$k}; |
|
24
|
|
|
|
|
|
|
# lvalue method |
|
25
|
0
|
0
|
|
|
|
|
$dbis->$k = ref $v eq 'CODE' ? $v->($dbh) |
|
|
|
0
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
: $k eq 'abstract' ? _abstract($dbis->{dbh}, $v) : $v; |
|
27
|
|
|
|
|
|
|
} |
|
28
|
|
|
|
|
|
|
|
|
29
|
0
|
|
|
|
|
|
$dbis; |
|
30
|
|
|
|
|
|
|
}; |
|
31
|
|
|
|
|
|
|
} |
|
32
|
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
sub _abstract { |
|
34
|
0
|
|
|
0
|
|
|
my ($dbh, $class) = @_; |
|
35
|
0
|
|
|
|
|
|
Class::Load::load_class($class); |
|
36
|
0
|
0
|
|
|
|
|
if ($class eq 'SQL::Abstract') { |
|
|
|
0
|
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
37
|
0
|
|
|
|
|
|
$class->new(); |
|
38
|
|
|
|
|
|
|
} elsif ($class eq 'SQL::Abstract::Limit') { |
|
39
|
0
|
|
|
|
|
|
$class->new(limit_dialect => $dbh); |
|
40
|
|
|
|
|
|
|
} elsif ($class eq 'SQL::Maker') { |
|
41
|
0
|
|
|
|
|
|
$class->new(driver => $dbh->{Driver}{Name}); |
|
42
|
|
|
|
|
|
|
} else { |
|
43
|
0
|
|
|
|
|
|
$class->new($dbh); # fallback |
|
44
|
|
|
|
|
|
|
} |
|
45
|
|
|
|
|
|
|
} |
|
46
|
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
{ |
|
48
|
1
|
|
|
1
|
|
5
|
no strict 'refs'; |
|
|
1
|
|
|
|
|
1
|
|
|
|
1
|
|
|
|
|
45
|
|
|
49
|
|
|
|
|
|
|
for my $method ( |
|
50
|
|
|
|
|
|
|
qw( |
|
51
|
|
|
|
|
|
|
error |
|
52
|
|
|
|
|
|
|
query |
|
53
|
|
|
|
|
|
|
begin |
|
54
|
|
|
|
|
|
|
disconnect |
|
55
|
|
|
|
|
|
|
select insert update delete |
|
56
|
|
|
|
|
|
|
iquery |
|
57
|
|
|
|
|
|
|
), |
|
58
|
|
|
|
|
|
|
# unnecessary begin_work(), commit(), rollback(), func() and last_insert_id() |
|
59
|
|
|
|
|
|
|
# there are just alias for DBI::db::* |
|
60
|
|
|
|
|
|
|
) { |
|
61
|
|
|
|
|
|
|
*$method = sub { |
|
62
|
1
|
|
|
1
|
|
4
|
use strict 'refs'; |
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
78
|
|
|
63
|
0
|
|
|
0
|
|
|
shift->simple->$method(@_); |
|
64
|
|
|
|
|
|
|
}; |
|
65
|
|
|
|
|
|
|
} |
|
66
|
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
for my $property ( |
|
68
|
|
|
|
|
|
|
qw( |
|
69
|
|
|
|
|
|
|
keep_statements |
|
70
|
|
|
|
|
|
|
lc_columns |
|
71
|
|
|
|
|
|
|
result_class |
|
72
|
|
|
|
|
|
|
abstract |
|
73
|
|
|
|
|
|
|
), |
|
74
|
|
|
|
|
|
|
) { |
|
75
|
|
|
|
|
|
|
*$property = sub { |
|
76
|
0
|
|
|
0
|
|
|
my ($self, $val) = @_; |
|
77
|
1
|
|
|
1
|
|
4
|
use strict 'refs'; |
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
165
|
|
|
78
|
0
|
0
|
|
|
|
|
if ($val) { |
|
79
|
0
|
|
|
|
|
|
$self->simple->$property = $val; |
|
80
|
|
|
|
|
|
|
} else { |
|
81
|
0
|
|
|
|
|
|
$self->simple->$property; |
|
82
|
|
|
|
|
|
|
} |
|
83
|
|
|
|
|
|
|
}; |
|
84
|
|
|
|
|
|
|
} |
|
85
|
|
|
|
|
|
|
} |
|
86
|
|
|
|
|
|
|
|
|
87
|
|
|
|
|
|
|
package DBIx::Simple::Inject::st; |
|
88
|
|
|
|
|
|
|
our @ISA = qw(DBI::st); |
|
89
|
|
|
|
|
|
|
|
|
90
|
|
|
|
|
|
|
1; |
|
91
|
|
|
|
|
|
|
|
|
92
|
|
|
|
|
|
|
__END__ |