line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package DBIx::Foo; |
2
|
|
|
|
|
|
|
|
3
|
4
|
|
|
4
|
|
2169291
|
use strict; |
|
4
|
|
|
|
|
13
|
|
|
4
|
|
|
|
|
182
|
|
4
|
|
|
|
|
|
|
|
5
|
4
|
|
|
4
|
|
5390
|
use DBI; |
|
4
|
|
|
|
|
19512
|
|
|
4
|
|
|
|
|
260
|
|
6
|
4
|
|
|
4
|
|
3574
|
use DBIx::Foo::SearchQuery; |
|
4
|
|
|
|
|
15
|
|
|
4
|
|
|
|
|
142
|
|
7
|
4
|
|
|
4
|
|
3142
|
use DBIx::Foo::SimpleQuery; |
|
4
|
|
|
|
|
14
|
|
|
4
|
|
|
|
|
393
|
|
8
|
4
|
|
|
4
|
|
4249
|
use DBIx::Foo::UpdateQuery; |
|
4
|
|
|
|
|
13
|
|
|
4
|
|
|
|
|
140
|
|
9
|
|
|
|
|
|
|
|
10
|
4
|
|
|
4
|
|
24
|
use Log::Any qw($log); |
|
4
|
|
|
|
|
8
|
|
|
4
|
|
|
|
|
20
|
|
11
|
|
|
|
|
|
|
|
12
|
4
|
|
|
4
|
|
237
|
use Exporter; |
|
4
|
|
|
|
|
8
|
|
|
4
|
|
|
|
|
2160
|
|
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
our @ISA = qw(Exporter); |
15
|
|
|
|
|
|
|
our @EXPORT_OK = qw(selectrow selectrow_array selectrow_hashref selectall selectall_arrayref selectall_hashref dbh_do do err last_insert_id); |
16
|
|
|
|
|
|
|
our %EXPORT_TAGS = (all => [@EXPORT_OK]); |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
our $VERSION = '0.03'; |
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
sub new { |
21
|
0
|
|
|
0
|
0
|
0
|
my ($class) = shift; |
22
|
0
|
|
|
|
|
0
|
$class->connect(@_); |
23
|
|
|
|
|
|
|
} |
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
sub connect { |
26
|
3
|
|
|
3
|
0
|
740
|
my ($class, @arguments) = @_; |
27
|
|
|
|
|
|
|
|
28
|
3
|
|
|
|
|
9
|
my $self = {}; |
29
|
|
|
|
|
|
|
|
30
|
3
|
50
|
33
|
|
|
128
|
if (defined $arguments[0] and UNIVERSAL::isa($arguments[0], 'DBI::db')) { |
31
|
0
|
|
|
|
|
0
|
$self->{dont_disconnect} = 1; |
32
|
0
|
|
|
|
|
0
|
$self->{dbh} = shift @arguments; |
33
|
0
|
0
|
|
|
|
0
|
Carp::carp("Additional arguments for $class->connect are ignored") if @arguments; |
34
|
|
|
|
|
|
|
} else { |
35
|
3
|
50
|
33
|
|
|
30
|
$arguments[3]->{PrintError} = 0 |
36
|
|
|
|
|
|
|
unless defined $arguments[3] and exists $arguments[3]{PrintError}; |
37
|
3
|
50
|
33
|
|
|
28
|
$arguments[3]->{RaiseError} = 1 |
38
|
|
|
|
|
|
|
unless defined $arguments[3] and exists $arguments[3]{RaiseError}; |
39
|
3
|
|
|
|
|
35
|
$self->{dbh} = DBI->connect(@arguments); |
40
|
|
|
|
|
|
|
} |
41
|
|
|
|
|
|
|
|
42
|
3
|
50
|
|
|
|
17494
|
return undef unless $self->{dbh}; |
43
|
|
|
|
|
|
|
|
44
|
3
|
|
|
|
|
76
|
$self->{dbd} = $self->{dbh}->{Driver}->{Name}; |
45
|
3
|
|
|
|
|
14
|
bless $self, $class; |
46
|
|
|
|
|
|
|
|
47
|
3
|
|
|
|
|
13
|
return $self; |
48
|
|
|
|
|
|
|
} |
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
sub disconnect { |
51
|
2
|
|
|
2
|
0
|
1688
|
my $self = shift; |
52
|
2
|
|
|
|
|
60
|
$self->{dbh}->disconnect(); |
53
|
|
|
|
|
|
|
} |
54
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
sub dbh { |
56
|
100
|
|
|
100
|
0
|
178
|
my $self = shift; |
57
|
100
|
|
|
|
|
1187
|
return $self->{dbh}; |
58
|
|
|
|
|
|
|
} |
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
sub do { |
61
|
24
|
|
|
24
|
0
|
33595
|
return shift->dbh_do(@_); # just an alias |
62
|
|
|
|
|
|
|
} |
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
sub err { |
65
|
6
|
|
|
6
|
0
|
7
|
my $self = shift; |
66
|
6
|
|
|
|
|
33
|
return $self->{dbh}->err; |
67
|
|
|
|
|
|
|
} |
68
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
sub last_insert_id { |
70
|
2
|
|
|
2
|
0
|
5
|
my ($self, @args) = @_; |
71
|
2
|
|
|
|
|
12
|
return $self->{dbh}->last_insert_id(@args); |
72
|
|
|
|
|
|
|
} |
73
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
sub update_query { |
75
|
1
|
|
|
1
|
0
|
2
|
my ($self, $table) = @_; |
76
|
1
|
|
|
|
|
10
|
return DBIx::Foo::UpdateQuery->new($table, $self); |
77
|
|
|
|
|
|
|
} |
78
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
1; |
80
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
__END__ |