| 1 | package DBIx::Foo; | ||||||||||||||||||||||||||||
| 2 | |||||||||||||||||||||||||||||
| 3 | 4 | ▶ | use strict; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 4 | |||||||||||||||||||||||||||||
| 5 | 4 | ▶ | use DBI; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 6 | 4 | ▶ | use DBIx::Foo::SearchQuery; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 7 | 4 | ▶ | use DBIx::Foo::SimpleQuery; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 8 | 4 | ▶ | use DBIx::Foo::UpdateQuery; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 9 | |||||||||||||||||||||||||||||
| 10 | 4 | ▶ | use Log::Any qw($log); | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 11 | |||||||||||||||||||||||||||||
| 12 | 4 | ▶ | use Exporter; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 13 | |||||||||||||||||||||||||||||
| 14 | 4 | our @ISA = qw(Exporter); | |||||||||||||||||||||||||||
| 15 | 4 | our @EXPORT_OK = qw(selectrow selectrow_array selectrow_hashref selectall selectall_arrayref selectall_hashref dbh_do do err last_insert_id); | |||||||||||||||||||||||||||
| 16 | 4 | our %EXPORT_TAGS = (all => [@EXPORT_OK]); | |||||||||||||||||||||||||||
| 17 | |||||||||||||||||||||||||||||
| 18 | 4 | our $VERSION = '0.03_1'; | |||||||||||||||||||||||||||
| 19 | |||||||||||||||||||||||||||||
| 20 | 0 | ▶ | sub new { | ||||||||||||||||||||||||||
|
Subroutine
new: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||
| 21 | 0 | my ($class) = shift; | |||||||||||||||||||||||||||
| 22 | 0 | $class->connect(@_); | |||||||||||||||||||||||||||
| 23 | } | ||||||||||||||||||||||||||||
| 24 | |||||||||||||||||||||||||||||
| 25 | 3 | ▶ | sub connect { | ||||||||||||||||||||||||||
|
Subroutine
connect: called CC=9 SCAR=28.5
Pod
undocumented
| |||||||||||||||||||||||||||||
| 26 | 3 | my ($class, @arguments) = @_; | |||||||||||||||||||||||||||
| 27 | |||||||||||||||||||||||||||||
| 28 | 3 | my $self = {}; | |||||||||||||||||||||||||||
| 29 | |||||||||||||||||||||||||||||
| 30 | 3 | ▶ | if (defined $arguments[0] and UNIVERSAL::isa($arguments[0], 'DBI::db')) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
defined $arguments[0] and UNIVERSAL::isa($arguments[0], "DBI::db")
MC/DC0%0/2
defined $arguments[0] and UNIVERSAL::isa($arguments[0], "DBI::db")
defined $arguments[0]
UNIVERSAL::isa($arguments[0], "DBI::db")
Truth table33%1/3
A and B
A= defined $arguments[0]B= UNIVERSAL::isa($arguments[0], "DBI::db")
| |||||||||||||||||||||||||||||
| 31 | 0 | $self->{dont_disconnect} = 1; | |||||||||||||||||||||||||||
| 32 | 0 | $self->{dbh} = shift @arguments; | |||||||||||||||||||||||||||
| 33 | 0 | ▶ | Carp::carp("Additional arguments for $class->connect are ignored") if @arguments; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 34 | } else { | ||||||||||||||||||||||||||||
| 35 | $arguments[3]->{PrintError} = 0 | ||||||||||||||||||||||||||||
| 36 | 3 | ▶ | unless defined $arguments[3] and exists $arguments[3]{PrintError}; | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
defined $arguments[3] and exists $arguments[3]{"PrintError"}
MC/DC0%0/2
defined $arguments[3] and exists $arguments[3]{"PrintError"}
defined $arguments[3]
exists $arguments[3]{"PrintError"}
Truth table33%1/3
A and B
A= defined $arguments[3]B= exists $arguments[3]{"PrintError"}
| |||||||||||||||||||||||||||||
| 37 | $arguments[3]->{RaiseError} = 1 | ||||||||||||||||||||||||||||
| 38 | 3 | ▶ | unless defined $arguments[3] and exists $arguments[3]{RaiseError}; | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
defined $arguments[3] and exists $arguments[3]{"RaiseError"}
MC/DC0%0/2
defined $arguments[3] and exists $arguments[3]{"RaiseError"}
defined $arguments[3]
exists $arguments[3]{"RaiseError"}
Truth table33%1/3
A and B
A= defined $arguments[3]B= exists $arguments[3]{"RaiseError"}
| |||||||||||||||||||||||||||||
| 39 | 3 | $self->{dbh} = DBI->connect(@arguments); | |||||||||||||||||||||||||||
| 40 | } | ||||||||||||||||||||||||||||
| 41 | |||||||||||||||||||||||||||||
| 42 | 3 | ▶ | return undef unless $self->{dbh}; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 43 | |||||||||||||||||||||||||||||
| 44 | 3 | $self->{dbd} = $self->{dbh}->{Driver}->{Name}; | |||||||||||||||||||||||||||
| 45 | 3 | bless $self, $class; | |||||||||||||||||||||||||||
| 46 | |||||||||||||||||||||||||||||
| 47 | 3 | return $self; | |||||||||||||||||||||||||||
| 48 | } | ||||||||||||||||||||||||||||
| 49 | |||||||||||||||||||||||||||||
| 50 | 2 | ▶ | sub disconnect { | ||||||||||||||||||||||||||
|
Subroutine
disconnect: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||
| 51 | 2 | my $self = shift; | |||||||||||||||||||||||||||
| 52 | 2 | $self->{dbh}->disconnect(); | |||||||||||||||||||||||||||
| 53 | } | ||||||||||||||||||||||||||||
| 54 | |||||||||||||||||||||||||||||
| 55 | 100 | ▶ | sub dbh { | ||||||||||||||||||||||||||
|
Subroutine
dbh: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||
| 56 | 100 | my $self = shift; | |||||||||||||||||||||||||||
| 57 | 100 | return $self->{dbh}; | |||||||||||||||||||||||||||
| 58 | } | ||||||||||||||||||||||||||||
| 59 | |||||||||||||||||||||||||||||
| 60 | 24 | ▶ | sub do { | ||||||||||||||||||||||||||
|
Subroutine
do: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||
| 61 | 24 | return shift->dbh_do(@_); # just an alias | |||||||||||||||||||||||||||
| 62 | } | ||||||||||||||||||||||||||||
| 63 | |||||||||||||||||||||||||||||
| 64 | 6 | ▶ | sub err { | ||||||||||||||||||||||||||
|
Subroutine
err: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||
| 65 | 6 | my $self = shift; | |||||||||||||||||||||||||||
| 66 | 6 | return $self->{dbh}->err; | |||||||||||||||||||||||||||
| 67 | } | ||||||||||||||||||||||||||||
| 68 | |||||||||||||||||||||||||||||
| 69 | 2 | ▶ | sub last_insert_id { | ||||||||||||||||||||||||||
|
Subroutine
last_insert_id: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||
| 70 | 2 | my ($self, @args) = @_; | |||||||||||||||||||||||||||
| 71 | 2 | return $self->{dbh}->last_insert_id(@args); | |||||||||||||||||||||||||||
| 72 | } | ||||||||||||||||||||||||||||
| 73 | |||||||||||||||||||||||||||||
| 74 | 1 | ▶ | sub update_query { | ||||||||||||||||||||||||||
|
Subroutine
update_query: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||
| 75 | 1 | my ($self, $table) = @_; | |||||||||||||||||||||||||||
| 76 | 1 | return DBIx::Foo::UpdateQuery->new($table, $self); | |||||||||||||||||||||||||||
| 77 | } | ||||||||||||||||||||||||||||
| 78 | |||||||||||||||||||||||||||||
| 79 | 4 | 1; | |||||||||||||||||||||||||||
| 80 | |||||||||||||||||||||||||||||
| 81 | __END__ | ||||||||||||||||||||||||||||