| 1 | # $Id$ | ||||||||||||||||||||||||||||||||||||||||||
| 2 | package DBIx::LogAny; | ||||||||||||||||||||||||||||||||||||||||||
| 3 | 2 | require 5.008; | |||||||||||||||||||||||||||||||||||||||||
| 4 | |||||||||||||||||||||||||||||||||||||||||||
| 5 | 2 | ▶ | use strict; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 6 | 2 | ▶ | use warnings; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 7 | 2 | ▶ | use Carp qw(croak cluck); | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 8 | 2 | ▶ | use Log::Any; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 9 | 2 | ▶ | use Data::Dumper; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 10 | 2 | ▶ | use Scalar::Util qw(blessed); | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 11 | |||||||||||||||||||||||||||||||||||||||||||
| 12 | 2 | ▶ | use DBIx::LogAny::Constants qw (:masks $LogMask); | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 13 | 2 | ▶ | use DBIx::LogAny::db; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 14 | 2 | ▶ | use DBIx::LogAny::st; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 15 | |||||||||||||||||||||||||||||||||||||||||||
| 16 | 2 | our $VERSION = '0.05'; | |||||||||||||||||||||||||||||||||||||||||
| 17 | 2 | require Exporter; | |||||||||||||||||||||||||||||||||||||||||
| 18 | 2 | our @ISA = qw(Exporter DBI); # look in DBI for anything we don't do | |||||||||||||||||||||||||||||||||||||||||
| 19 | |||||||||||||||||||||||||||||||||||||||||||
| 20 | 2 | our @EXPORT = (); # export nothing by default | |||||||||||||||||||||||||||||||||||||||||
| 21 | 2 | our @EXPORT_MASKS = qw(DBIX_LA_LOG_DEFAULT | |||||||||||||||||||||||||||||||||||||||||
| 22 | DBIX_LA_LOG_ALL | ||||||||||||||||||||||||||||||||||||||||||
| 23 | DBIX_LA_LOG_INPUT | ||||||||||||||||||||||||||||||||||||||||||
| 24 | DBIX_LA_LOG_OUTPUT | ||||||||||||||||||||||||||||||||||||||||||
| 25 | DBIX_LA_LOG_CONNECT | ||||||||||||||||||||||||||||||||||||||||||
| 26 | DBIX_LA_LOG_TXN | ||||||||||||||||||||||||||||||||||||||||||
| 27 | DBIX_LA_LOG_ERRCAPTURE | ||||||||||||||||||||||||||||||||||||||||||
| 28 | DBIX_LA_LOG_WARNINGS | ||||||||||||||||||||||||||||||||||||||||||
| 29 | DBIX_LA_LOG_ERRORS | ||||||||||||||||||||||||||||||||||||||||||
| 30 | DBIX_LA_LOG_DBDSPECIFIC | ||||||||||||||||||||||||||||||||||||||||||
| 31 | DBIX_LA_LOG_DELAYBINDPARAM | ||||||||||||||||||||||||||||||||||||||||||
| 32 | DBIX_LA_LOG_SQL | ||||||||||||||||||||||||||||||||||||||||||
| 33 | DBIX_LA_LOG_STORE | ||||||||||||||||||||||||||||||||||||||||||
| 34 | ); | ||||||||||||||||||||||||||||||||||||||||||
| 35 | 2 | our %EXPORT_TAGS= (masks => \@EXPORT_MASKS); | |||||||||||||||||||||||||||||||||||||||||
| 36 | 2 | Exporter::export_ok_tags('masks'); # all tags must be in EXPORT_OK | |||||||||||||||||||||||||||||||||||||||||
| 37 | |||||||||||||||||||||||||||||||||||||||||||
| 38 | sub _dbix_la_debug { | ||||||||||||||||||||||||||||||||||||||||||
| 39 | 15 | ▶ | my ($self, $h, $level, $thing, @args) = @_; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_dbix_la_debug: called CC=11 SCAR=25.9
| |||||||||||||||||||||||||||||||||||||||||||
| 40 | |||||||||||||||||||||||||||||||||||||||||||
| 41 | 15 | ▶ | $h = $self->{private_DBIx_LogAny} if !defined($h); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 42 | |||||||||||||||||||||||||||||||||||||||||||
| 43 | 15 | ▶ | return unless $h->{logger}->is_debug(); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 44 | |||||||||||||||||||||||||||||||||||||||||||
| 45 | 15 | local $Data::Dumper::Indent = 0; | |||||||||||||||||||||||||||||||||||||||||
| 46 | 15 | local $Data::Dumper::Quotekeys = 0; | |||||||||||||||||||||||||||||||||||||||||
| 47 | |||||||||||||||||||||||||||||||||||||||||||
| 48 | $args[0] = $args[0]->{Statement} if blessed($args[0]) and | ||||||||||||||||||||||||||||||||||||||||||
| 49 | blessed($args[0])->isa('DBI::st') and | ||||||||||||||||||||||||||||||||||||||||||
| 50 | 15 | ▶ | defined ($args[0]->{Statement}); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%4/6
builtin::blessed($args[0]) and builtin::blessed($args[0])->isa("DBI::st") and defined $args[0]{"Statement"}
builtin::blessed($args[0]) and builtin::blessed($args[0])->isa("DBI::st")
MC/DC33%1/3
builtin::blessed($args[0]) and builtin::blessed($args[0])->isa("DBI::st") and defined $args[0]{"Statement"}
builtin::blessed($args[0])
builtin::blessed($args[0])->isa("DBI::st")
defined $args[0]{"Statement"}
Truth table50%2/4
A and B and C
A= builtin::blessed($args[0])B= builtin::blessed($args[0])->isa("DBI::st")C= defined $args[0]{"Statement"}
| |||||||||||||||||||||||||||||||||||||||||||
| 51 | |||||||||||||||||||||||||||||||||||||||||||
| 52 | 15 | ▶ | if (scalar(@args) > 1) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 4 branches
| |||||||||||||||||||||||||||||||||||||||||||
| 53 | $h->{logger}->debug( | ||||||||||||||||||||||||||||||||||||||||||
| 54 | 2 | Data::Dumper->Dump([\@args], [$thing])) | |||||||||||||||||||||||||||||||||||||||||
| 55 | } elsif (ref($thing) eq 'CODE') { | ||||||||||||||||||||||||||||||||||||||||||
| 56 | 0 | $h->{logger}->debug($thing); | |||||||||||||||||||||||||||||||||||||||||
| 57 | } elsif (ref($args[0])) { | ||||||||||||||||||||||||||||||||||||||||||
| 58 | $h->{logger}->debug( | ||||||||||||||||||||||||||||||||||||||||||
| 59 | 0 | Data::Dumper->Dump([$args[0]], [$thing])) | |||||||||||||||||||||||||||||||||||||||||
| 60 | } elsif (scalar(@args) == 1) { | ||||||||||||||||||||||||||||||||||||||||||
| 61 | 6 | ▶ | if (!defined($args[0])) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 62 | 0 | $h->{logger}->debug("$thing:"); | |||||||||||||||||||||||||||||||||||||||||
| 63 | } else { | ||||||||||||||||||||||||||||||||||||||||||
| 64 | 6 | $h->{logger}->debug("$thing: " . DBI::neat($args[0])); | |||||||||||||||||||||||||||||||||||||||||
| 65 | } | ||||||||||||||||||||||||||||||||||||||||||
| 66 | } else { | ||||||||||||||||||||||||||||||||||||||||||
| 67 | 7 | $h->{logger}->debug($thing); | |||||||||||||||||||||||||||||||||||||||||
| 68 | } | ||||||||||||||||||||||||||||||||||||||||||
| 69 | 15 | return; | |||||||||||||||||||||||||||||||||||||||||
| 70 | } | ||||||||||||||||||||||||||||||||||||||||||
| 71 | |||||||||||||||||||||||||||||||||||||||||||
| 72 | sub _dbix_la_info { | ||||||||||||||||||||||||||||||||||||||||||
| 73 | 0 | ▶ | my ($self, $level, $thing) = @_; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_dbix_la_info: not called CC=2 SCAR=17.9
| |||||||||||||||||||||||||||||||||||||||||||
| 74 | |||||||||||||||||||||||||||||||||||||||||||
| 75 | 0 | my $h = $self->{private_DBIx_LogAny}; | |||||||||||||||||||||||||||||||||||||||||
| 76 | |||||||||||||||||||||||||||||||||||||||||||
| 77 | 0 | ▶ | return unless $h->{logger}->is_info(); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 78 | |||||||||||||||||||||||||||||||||||||||||||
| 79 | 0 | $h->{logger}->info($thing); | |||||||||||||||||||||||||||||||||||||||||
| 80 | |||||||||||||||||||||||||||||||||||||||||||
| 81 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||
| 82 | } | ||||||||||||||||||||||||||||||||||||||||||
| 83 | sub _dbix_la_warning { | ||||||||||||||||||||||||||||||||||||||||||
| 84 | 0 | ▶ | my ($self, $level, $thing, @args) = @_; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_dbix_la_warning: not called CC=4 SCAR=30.0
| |||||||||||||||||||||||||||||||||||||||||||
| 85 | |||||||||||||||||||||||||||||||||||||||||||
| 86 | 0 | my $h = $self->{private_DBIx_LogAny}; | |||||||||||||||||||||||||||||||||||||||||
| 87 | |||||||||||||||||||||||||||||||||||||||||||
| 88 | 0 | ▶ | return unless $h->{logger}->is_warn(); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 89 | |||||||||||||||||||||||||||||||||||||||||||
| 90 | 0 | local $Data::Dumper::Indent = 0; | |||||||||||||||||||||||||||||||||||||||||
| 91 | 0 | local $Data::Dumper::Quotekeys = 0; | |||||||||||||||||||||||||||||||||||||||||
| 92 | |||||||||||||||||||||||||||||||||||||||||||
| 93 | 0 | ▶ | if (scalar(@args) > 1) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||
| 94 | $h->{logger}->warn( | ||||||||||||||||||||||||||||||||||||||||||
| 95 | 0 | ▶ | sub {Data::Dumper->Dump([\@args], [$thing])}) | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||
| 96 | 0 | } elsif (ref($args[0])) { | |||||||||||||||||||||||||||||||||||||||||
| 97 | $h->{logger}->warn( | ||||||||||||||||||||||||||||||||||||||||||
| 98 | 0 | ▶ | sub {Data::Dumper->Dump([$args[0]], [$thing])}) | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||
| 99 | 0 | } else { | |||||||||||||||||||||||||||||||||||||||||
| 100 | 0 | $h->{logger}->warn("$thing: " . DBI::neat($args[0])); | |||||||||||||||||||||||||||||||||||||||||
| 101 | } | ||||||||||||||||||||||||||||||||||||||||||
| 102 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||
| 103 | } | ||||||||||||||||||||||||||||||||||||||||||
| 104 | |||||||||||||||||||||||||||||||||||||||||||
| 105 | sub _dbix_la_error { | ||||||||||||||||||||||||||||||||||||||||||
| 106 | 0 | ▶ | my ($self, $level, $thing, @args) = @_; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_dbix_la_error: not called CC=5 SCAR=34.0
| |||||||||||||||||||||||||||||||||||||||||||
| 107 | |||||||||||||||||||||||||||||||||||||||||||
| 108 | 0 | my $h = $self->{private_DBIx_LogAny}; | |||||||||||||||||||||||||||||||||||||||||
| 109 | |||||||||||||||||||||||||||||||||||||||||||
| 110 | 0 | ▶ | return unless $h->{logger}->is_error(); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 111 | |||||||||||||||||||||||||||||||||||||||||||
| 112 | 0 | local $Data::Dumper::Indent = 0; | |||||||||||||||||||||||||||||||||||||||||
| 113 | 0 | local $Data::Dumper::Quotekeys = 0; | |||||||||||||||||||||||||||||||||||||||||
| 114 | |||||||||||||||||||||||||||||||||||||||||||
| 115 | 0 | ▶ | if (scalar(@args) > 1) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 3 branches
| |||||||||||||||||||||||||||||||||||||||||||
| 116 | $h->{logger}->error( | ||||||||||||||||||||||||||||||||||||||||||
| 117 | 0 | ▶ | sub {Data::Dumper->Dump([\@args], [$thing])}) | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||
| 118 | 0 | } elsif (ref($thing) eq 'CODE') { | |||||||||||||||||||||||||||||||||||||||||
| 119 | 0 | $h->{logger}->error($thing); | |||||||||||||||||||||||||||||||||||||||||
| 120 | } elsif (ref($args[0])) { | ||||||||||||||||||||||||||||||||||||||||||
| 121 | $h->{logger}->error( | ||||||||||||||||||||||||||||||||||||||||||
| 122 | 0 | ▶ | sub {Data::Dumper->Dump([$args[0]], [$thing])}) | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||
| 123 | 0 | } else { | |||||||||||||||||||||||||||||||||||||||||
| 124 | 0 | $h->{logger}->error("$thing: " . DBI::neat($args[0])); | |||||||||||||||||||||||||||||||||||||||||
| 125 | } | ||||||||||||||||||||||||||||||||||||||||||
| 126 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||
| 127 | } | ||||||||||||||||||||||||||||||||||||||||||
| 128 | |||||||||||||||||||||||||||||||||||||||||||
| 129 | sub _dbix_la_attr_map { | ||||||||||||||||||||||||||||||||||||||||||
| 130 | return { | ||||||||||||||||||||||||||||||||||||||||||
| 131 | 0 | ▶ | dbix_la_logmask => 'logmask', | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_dbix_la_attr_map: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||
| 132 | dbix_la_ignore_err_regexp => 'err_regexp', | ||||||||||||||||||||||||||||||||||||||||||
| 133 | dbix_la_category => 'category', | ||||||||||||||||||||||||||||||||||||||||||
| 134 | dbix_la_logger => 'logger' | ||||||||||||||||||||||||||||||||||||||||||
| 135 | }; | ||||||||||||||||||||||||||||||||||||||||||
| 136 | } | ||||||||||||||||||||||||||||||||||||||||||
| 137 | |||||||||||||||||||||||||||||||||||||||||||
| 138 | sub dbix_la_getattr { | ||||||||||||||||||||||||||||||||||||||||||
| 139 | 0 | ▶ | my ($self, $item) = @_; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
dbix_la_getattr: not called CC=4 SCAR=30.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 140 | |||||||||||||||||||||||||||||||||||||||||||
| 141 | 0 | ▶ | croak ('wrong arguments - dbix_la_getattr(attribute_name)') | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
scalar @_ != 2 or not defined $_[1]
MC/DC0%0/2
scalar @_ != 2 or not defined $_[1]
scalar @_ != 2
not defined $_[1]
Truth table0%0/3
A or not(B)
A= scalar @_ != 2B= not defined $_[1]
| |||||||||||||||||||||||||||||||||||||||||||
| 142 | if (scalar(@_) != 2 || !defined($_[1])); | ||||||||||||||||||||||||||||||||||||||||||
| 143 | |||||||||||||||||||||||||||||||||||||||||||
| 144 | 0 | my $m = _dbix_la_attr_map(); | |||||||||||||||||||||||||||||||||||||||||
| 145 | |||||||||||||||||||||||||||||||||||||||||||
| 146 | 0 | my $h = $self->{private_DBIx_LogAny}; | |||||||||||||||||||||||||||||||||||||||||
| 147 | |||||||||||||||||||||||||||||||||||||||||||
| 148 | 0 | ▶ | if (!exists($m->{$item})) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 149 | 0 | warn "$item does not exist"; | |||||||||||||||||||||||||||||||||||||||||
| 150 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||
| 151 | } | ||||||||||||||||||||||||||||||||||||||||||
| 152 | 0 | return $h->{$m->{$item}}; | |||||||||||||||||||||||||||||||||||||||||
| 153 | } | ||||||||||||||||||||||||||||||||||||||||||
| 154 | |||||||||||||||||||||||||||||||||||||||||||
| 155 | sub dbix_la_setattr { | ||||||||||||||||||||||||||||||||||||||||||
| 156 | 0 | ▶ | my ($self, $item, $value) = @_; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
dbix_la_setattr: not called CC=4 SCAR=30.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 157 | |||||||||||||||||||||||||||||||||||||||||||
| 158 | 0 | ▶ | croak ('wrong arguments - dbix_la_setattr(attribute_name, value)') | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
scalar @_ != 3 or not defined $_[1]
MC/DC0%0/2
scalar @_ != 3 or not defined $_[1]
scalar @_ != 3
not defined $_[1]
Truth table0%0/3
A or not(B)
A= scalar @_ != 3B= not defined $_[1]
| |||||||||||||||||||||||||||||||||||||||||||
| 159 | if (scalar(@_) != 3 || !defined($_[1])); | ||||||||||||||||||||||||||||||||||||||||||
| 160 | |||||||||||||||||||||||||||||||||||||||||||
| 161 | 0 | my $m = _dbix_la_attr_map(); | |||||||||||||||||||||||||||||||||||||||||
| 162 | |||||||||||||||||||||||||||||||||||||||||||
| 163 | 0 | my $h = $self->{private_DBIx_LogAny}; | |||||||||||||||||||||||||||||||||||||||||
| 164 | |||||||||||||||||||||||||||||||||||||||||||
| 165 | 0 | ▶ | if (!exists($m->{$item})) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 166 | 0 | warn "$item does not exist"; | |||||||||||||||||||||||||||||||||||||||||
| 167 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||
| 168 | } | ||||||||||||||||||||||||||||||||||||||||||
| 169 | 0 | $h->{$m->{$item}} = $value; | |||||||||||||||||||||||||||||||||||||||||
| 170 | 0 | 1; | |||||||||||||||||||||||||||||||||||||||||
| 171 | } | ||||||||||||||||||||||||||||||||||||||||||
| 172 | |||||||||||||||||||||||||||||||||||||||||||
| 173 | sub connect { | ||||||||||||||||||||||||||||||||||||||||||
| 174 | |||||||||||||||||||||||||||||||||||||||||||
| 175 | 1 | ▶ | my ($drh, $dsn, $user, $pass, $attr) = @_; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
connect: called CC=10 SCAR=25.8
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 176 | |||||||||||||||||||||||||||||||||||||||||||
| 177 | 1 | my $dbh = $drh->SUPER::connect($dsn, $user, $pass, $attr); | |||||||||||||||||||||||||||||||||||||||||
| 178 | 1 | ▶ | return $dbh if (!$dbh); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 179 | |||||||||||||||||||||||||||||||||||||||||||
| 180 | 1 | my $h = $dbh->{private_DBIx_LogAny}; | |||||||||||||||||||||||||||||||||||||||||
| 181 | |||||||||||||||||||||||||||||||||||||||||||
| 182 | 1 | ▶ | if ($h->{logmask} & DBIX_LA_LOG_CONNECT) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 183 | 1 | local $Data::Dumper::Indent = 0; | |||||||||||||||||||||||||||||||||||||||||
| 184 | $h->{logger}->debug( | ||||||||||||||||||||||||||||||||||||||||||
| 185 | "connect($h->{dbh_no}): " . | ||||||||||||||||||||||||||||||||||||||||||
| 186 | (defined($dsn) ? $dsn : '') . ', ' . | ||||||||||||||||||||||||||||||||||||||||||
| 187 | (defined($user) ? $user : '') . ', ' . | ||||||||||||||||||||||||||||||||||||||||||
| 188 | Data::Dumper->Dump([$attr], [qw(attr)])) | ||||||||||||||||||||||||||||||||||||||||||
| 189 | 1 | ▶ | if $h->{logger}->is_debug; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 3 branches
| |||||||||||||||||||||||||||||||||||||||||||
| 190 | 2 | ▶ | no strict 'refs'; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 191 | 1 | my $v = "DBD::" . $dbh->{Driver}->{Name} . "::VERSION"; | |||||||||||||||||||||||||||||||||||||||||
| 192 | $h->{logger}->info("DBI: " . $DBI::VERSION, | ||||||||||||||||||||||||||||||||||||||||||
| 193 | ", DBIx::LogAny: " . $DBIx::LogAny::VERSION . | ||||||||||||||||||||||||||||||||||||||||||
| 194 | ", Driver: " . $h->{driver} . "(" . | ||||||||||||||||||||||||||||||||||||||||||
| 195 | $$v . ")") | ||||||||||||||||||||||||||||||||||||||||||
| 196 | 1 | ▶ | if $h->{logger}->is_info; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 197 | } | ||||||||||||||||||||||||||||||||||||||||||
| 198 | |||||||||||||||||||||||||||||||||||||||||||
| 199 | # | ||||||||||||||||||||||||||||||||||||||||||
| 200 | # Enable dbms_output for DBD::Oracle else turn off DBDSPECIFIC as we have | ||||||||||||||||||||||||||||||||||||||||||
| 201 | # no support for DBDSPECIFIC in any other drivers. | ||||||||||||||||||||||||||||||||||||||||||
| 202 | # BUT only enable it if the log handle is doing debug as we only call | ||||||||||||||||||||||||||||||||||||||||||
| 203 | # dbms_output_get in that case. | ||||||||||||||||||||||||||||||||||||||||||
| 204 | # | ||||||||||||||||||||||||||||||||||||||||||
| 205 | 1 | $h->{dbd_specific} = 1; | |||||||||||||||||||||||||||||||||||||||||
| 206 | 1 | ▶ | if (($h->{logger}->is_debug()) && | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%2/6
$h->{"logger"}->is_debug and $h->{"logmask"} & 128 and $h->{"driver"} eq "Oracle"
$h->{"logger"}->is_debug and $h->{"logmask"} & 128
MC/DC0%0/3
$h->{"logger"}->is_debug and $h->{"logmask"} & 128 and $h->{"driver"} eq "Oracle"
$h->{"logger"}->is_debug
$h->{"logmask"} & 128
$h->{"driver"} eq "Oracle"
Truth table25%1/4
A and B and C
A= $h->{"logger"}->is_debugB= $h->{"logmask"} & 128C= $h->{"driver"} eq "Oracle"
| |||||||||||||||||||||||||||||||||||||||||||
| 207 | ($h->{logmask} & DBIX_LA_LOG_DBDSPECIFIC) && | ||||||||||||||||||||||||||||||||||||||||||
| 208 | ($h->{driver} eq 'Oracle')) { | ||||||||||||||||||||||||||||||||||||||||||
| 209 | 0 | $dbh->func('dbms_output_enable'); | |||||||||||||||||||||||||||||||||||||||||
| 210 | } else { | ||||||||||||||||||||||||||||||||||||||||||
| 211 | 1 | $h->{logmask} &= ~DBIX_LA_LOG_DBDSPECIFIC; | |||||||||||||||||||||||||||||||||||||||||
| 212 | } | ||||||||||||||||||||||||||||||||||||||||||
| 213 | 1 | $h->{dbd_specific} = 0; | |||||||||||||||||||||||||||||||||||||||||
| 214 | 1 | return $dbh; | |||||||||||||||||||||||||||||||||||||||||
| 215 | } | ||||||||||||||||||||||||||||||||||||||||||
| 216 | |||||||||||||||||||||||||||||||||||||||||||
| 217 | sub dbix_la_logdie | ||||||||||||||||||||||||||||||||||||||||||
| 218 | { | ||||||||||||||||||||||||||||||||||||||||||
| 219 | 0 | ▶ | my ($drh, $msg) = @_; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
dbix_la_logdie: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 220 | 0 | _error_handler($msg, $drh); | |||||||||||||||||||||||||||||||||||||||||
| 221 | 0 | die "$msg"; | |||||||||||||||||||||||||||||||||||||||||
| 222 | } | ||||||||||||||||||||||||||||||||||||||||||
| 223 | |||||||||||||||||||||||||||||||||||||||||||
| 224 | 2 | 1; | |||||||||||||||||||||||||||||||||||||||||
| 225 | |||||||||||||||||||||||||||||||||||||||||||
| 226 | __END__ | ||||||||||||||||||||||||||||||||||||||||||