Branch Coverage

blib/lib/DeltaX/Database.pm
Criterion Covered Total %
branch 0 712 0.0


line true false branch
69 0 0 if @_ % 2
75 0 0 unless exists $$self{lc $_[$x]}
84 0 0 unless ($self->{'driver'})
91 0 0 unless ($self->{'driver'})
98 0 0 if (/Pg/)
99 0 0 if $self->{'datestyle'}
103 0 0 if (/Oracle/)
104 0 0 if $self->{'datestyle'}
107 0 0 $self->{'auth'} ? :
109 0 0 if (/Informix/)
110 0 0 if $self->{'datestyle'}
114 0 0 if (/DB2/)
115 0 0 if $self->{'codepage'}
119 0 0 if (/mysql/)
123 0 0 if (/Sybase/)
127 0 0 if (/mssql/)
131 0 0 if (/Solid/)
144 0 0 if not $self->{'conn'} and $self->{'trace'}
145 0 0 unless $self->{'conn'}
155 0 0 if $self->{'transaction'}
156 0 0 if $self->{'conn'}
165 0 0 unless $self->{'conn'}
166 0 0 if $self->{'conn'}->ping
177 0 0 unless (defined $type_f)
182 0 0 if ($self->{'autocommit'}) { }
183 0 0 if ($self->{'driver'} eq 'Pg')
189 0 0 if $result > 0
200 0 0 unless (defined $type_f)
205 0 0 unless ($self->{'conn'})
209 0 0 if ($self->{'autocommit'})
210 0 0 if ($self->{'driver'} ne 'Pg')
215 0 0 if (not $self->{'autocommit'} or $self->{'transaction'})
216 0 0 if ($type_f or not $self->{'transaction'}) { }
217 0 0 if ($self->{'driver'} ne 'Oracle') { }
225 0 0 if ($self->{'driver'} ne 'Oracle') { }
226 0 0 unless $type_f
233 0 0 if $self->{'close_curs'}
236 0 0 if $result
248 0 0 unless (defined $sql_command)
252 0 0 unless ($self->{'conn'})
261 0 0 unless ($statement)
265 0 0 if $self->{'trace'}
273 0 0 if ($self->{'driver'} eq 'mssql')
276 0 0 unless ($result)
278 0 0 if $self->{'trace'}
279 0 0 unless $self->{'transaction'}
287 0 0 if scalar @ret_array and grep {$self->{'driver'} eq $_;} 'Oracle', 'Informix', 'mssql', 'DB2', 'Solid'
288 0 0 if $#ret_array < 0 and grep {$self->{'driver'} eq $_;} 'mssql', 'DB2', 'Solid' and not $statement->err
290 0 0 if ($#ret_array < 0 and $statement->err || $ret_rows)
294 0 0 if $self->{'trace'}
295 0 0 unless $self->{'transaction'}
301 0 0 if ($self->{'driver'} eq 'mssql')
305 0 0 if ($self->{'driver'} eq 'Informix' and $self->{'imix_number_correct'})
308 0 0 if $types[$i] != &DBI::SQL_DECIMAL()
309 0 0 unless defined $ret_array[$i]
325 0 0 unless ($self->{'conn'})
331 0 0 unless (defined $sql_command)
342 0 0 if (exists $self->{'statements'}{$self->{'app'} . $sql_command}) { }
348 0 0 unless $self->{'statements'}{$statement_name}[3]
351 0 0 if ($#_ < 0) { }
353 0 0 if not $self->{'statements'}{$statement_name}[2] and $self->{'statements'}{$statement_name}[1]
361 0 0 if $self->{'statements'}{$statement_name}[1] != scalar @bind_values
368 0 0 if ($self->{'driver'} eq 'mssql') { }
372 0 0 unless ($statement)
376 0 0 if $self->{'trace'}
387 0 0 if ($#_ >= 0)
390 0 0 unless $cursortype =~ /^INTERNAL|^EXTERNAL/
391 0 0 if $self->{'driver'} eq 'mssql'
396 0 0 if (exists $self->{'cursors'}{$cursor_name})
401 0 0 unless ($statement)
405 0 0 if $self->{'trace'}
411 0 0 $statement ? :
412 0 0 $statement ? :
413 0 0 $statement ? :
416 0 0 if (grep {$self->{'driver'} eq $_;} 'mssql', 'DB2', 'Solid' and not $DeltaX::Database::Derror_message and $result eq '-1')
421 0 0 unless ($result)
423 0 0 if $self->{'trace'}
424 0 0 unless $self->{'transaction'}
428 0 0 if (defined $statement_name)
432 0 0 if ($self->{'driver'} eq 'Oracle' and not $ret_rows)
435 0 0 if (grep {$self->{'driver'} eq $_;} 'mssql', 'DB2', 'Solid' and $ret_rows < 0)
440 0 0 if ($ret_rows >= 0)
441 0 0 if ($cursortype eq 'INTERNAL') { }
444 0 0 if (not $cur_ref and $statement->err || $ret_rows) { }
448 0 0 if $self->{'trace'}
449 0 0 unless $self->{'transaction'}
459 0 0 if ($self->{'driver'} eq 'Informix' and not $ret_rows)
481 0 0 unless (defined $cursor_name)
485 0 0 unless ($self->{'conn'})
490 0 0 unless (exists $self->{'cursors'}{$cursor_name} and defined $self->{'cursors'}{$cursor_name})
497 0 0 if ($self->{'cursors'}{$cursor_name}[3] eq 'INTERNAL') { }
499 0 0 if ($#_ >= 0)
502 0 0 if $num_row =~ /^LAST/
504 0 0 if $num_row =~ /^FIRST/
505 0 0 if ($num_row > $self->{'cursors'}{$cursor_name}[1] - 1)
509 0 0 if $ret_array[0]
515 0 0 unless (@tmp_array)
520 0 0 if ($num_row >= $self->{'cursors'}{$cursor_name}[1]) { }
527 0 0 if ($self->{'driver'} eq 'Informix')
534 0 0 if ($self->{'driver'} eq 'mssql')
538 0 0 if ($self->{'driver'} eq 'Informix' and $self->{'imix_number_correct'})
541 0 0 if $types[$i - 1] != &DBI::SQL_DECIMAL()
542 0 0 unless defined $ret_array[$i]
557 0 0 unless (defined $cursor_name)
561 0 0 unless ($self->{'conn'})
566 0 0 unless (exists $self->{'cursors'}{$cursor_name})
583 0 0 unless $cursor_name
584 0 0 unless (exists $self->{'cursors'}{$cursor_name} and defined $self->{'cursors'}{$cursor_name})
601 0 0 unless (defined $statement_name)
608 0 0 unless ($self->{'conn'})
613 0 0 unless (defined $sql_command)
618 0 0 if uc($sql_command) =~ /^[ \n]*SELECT[ \n]/
624 0 0 if ($#_ >= 0)
625 0 0 if ($number_bval != shift())
631 0 0 if (exists $self->{'statements'}{$statement_name})
636 0 0 if ($self->{'driver'} eq 'mssql')
644 0 0 unless ($statement)
648 0 0 if $self->{'trace'}
652 0 0 if ($self->{'driver'} eq 'Oracle')
655 0 0 if ($sqlc_tmp[$i] eq '!' or uc $sqlc_tmp[$i] eq '?B')
656 0 0 unless $statement->bind_param($i + 1, undef, {'ora_type', 113})
660 0 0 if (uc $sqlc_tmp[$i] eq '?C')
661 0 0 unless $statement->bind_param($i + 1, undef, {'ora_type', 112})
686 0 0 unless (defined $statement_name)
691 0 0 unless ($self->{'conn'})
696 0 0 unless (exists $self->{'statements'}{$statement_name} and defined $self->{'statements'}{$statement_name})
699 0 0 if $self->{'trace'}
705 0 0 if ($#_ < 0) { }
706 0 0 if (not $self->{'statements'}{$statement_name}[2] and $self->{'statements'}{$statement_name}[1])
719 0 0 if ($self->{'statements'}{$statement_name}[1] != scalar @bind_values)
728 0 0 if ($self->{'driver'} eq 'mssql')
732 0 0 if ($self->{'statements'}{$statement_name}[3]) { }
744 0 0 unless ($result)
746 0 0 if $self->{'trace'}
747 0 0 unless $self->{'transaction'}
753 0 0 if ($self->{'statements'}{$statement_name}[3])
755 0 0 if (grep {$self->{'driver'} eq $_;} 'DB2', 'Solid', 'Oracle', 'Informix') { }
0 0 elsif ($#ret_array < 0 and $statement->err || $num_rows) { }
756 0 0 if (scalar @ret_array) { }
0 0 elsif ($statement->err) { }
763 0 0 if $self->{'trace'}
764 0 0 unless $self->{'transaction'}
777 0 0 if $self->{'trace'}
778 0 0 unless $self->{'transaction'}
785 0 0 if ($self->{'driver'} eq 'Informix')
795 0 0 if ($self->{'statements'}{$statement_name}[3]) { }
796 0 0 if ($self->{'driver'} eq 'Informix' and $self->{'imix_number_correct'})
799 0 0 if $types[$i] != &DBI::SQL_DECIMAL()
800 0 0 unless defined $ret_array[$i]
807 0 0 unless $self->{'transaction'}
821 0 0 unless (defined $statement_name)
826 0 0 unless ($self->{'conn'})
831 0 0 unless (exists $self->{'statements'}{$statement_name})
850 0 0 unless defined $statement_name
851 0 0 unless (exists $self->{'statements'}{$statement_name})
864 0 0 unless (defined $insert_command)
869 0 0 unless ($self->{'conn'})
879 0 0 if ($self->{'driver'} eq 'mssql')
886 0 0 unless ($result)
887 0 0 if $self->{'trace'}
888 0 0 unless $self->{'transaction'}
892 0 0 unless $self->{'transaction'}
904 0 0 unless (defined $delete_command)
909 0 0 unless ($self->{'conn'})
918 0 0 if ($self->{'driver'} eq 'mssql')
921 0 0 if $self->{'driver'} eq 'mysql' and $result eq '0E0'
926 0 0 unless ($result)
927 0 0 if $self->{'trace'}
928 0 0 unless $self->{'transaction'}
932 0 0 unless $self->{'transaction'}
944 0 0 unless (defined $update_command)
949 0 0 unless ($self->{'conn'})
958 0 0 if ($self->{'driver'} eq 'mssql')
962 0 0 if $self->{'driver'} eq 'mysql' and $result eq '0E0'
967 0 0 unless ($result)
968 0 0 if $self->{'trace'}
969 0 0 unless $self->{'transaction'}
973 0 0 unless $self->{'transaction'}
985 0 0 unless (defined $sql_command)
990 0 0 unless ($self->{'conn'})
999 0 0 if ($self->{'driver'} eq 'mssql')
1006 0 0 unless ($result)
1007 0 0 if $self->{'trace'}
1008 0 0 unless $self->{'transaction'}
1012 0 0 unless $self->{'transaction'}
1027 0 0 if $self->{'trace'} and not $result
1040 0 0 if (defined $value)
1055 0 0 unless (defined $seq_name)
1060 0 0 unless ($self->{'conn'})
1065 0 0 if ($self->{'driver'} eq 'Pg') { }
0 0 elsif ($self->{'use_sequences'} and $self->{'driver'} eq 'Informix') { }
0 0 elsif ($self->{'driver'} eq 'Oracle') { }
0 0 elsif ($self->{'driver'} eq 'Solid') { }
0 0 elsif (grep {$self->{'driver'} eq $_;} 'Informix', 'mssql', 'DB2', 'mysql') { }
1067 0 0 if $sqlresult[0] < 1
1073 0 0 if $sqlresult[0] < 1
1078 0 0 if $sqlresult[0] < 1
1083 0 0 if $sqlresult[0] < 1
1090 0 0 if $self->{'autocommit'}
1091 0 0 unless $trans
1092 0 0 if $sqlresult < 0
1097 0 0 if ($sqlresult < 0)
1098 0 0 unless $trans
1102 0 0 if ($sqlresult[0] < 1)
1103 0 0 unless $trans
1107 0 0 if ($sqlresult[4] == 0) { }
0 0 elsif ($sqlresult[4] + $sqlresult[2] <= $sqlresult[3]) { }
1116 0 0 if ($ret_val)
1120 0 0 if ($sqlresult < 0)
1121 0 0 unless $trans
1125 0 0 unless $trans
1158 0 0 if (uc $type eq 'PREPARED') { }
0 0 elsif (uc $type eq 'COMMON') { }
1161 0 0 if (defined $idatetime and $idatetime eq '?' || $idatetime eq '??')
1163 0 0 if ($self->{'driver'} eq 'Oracle') { }
0 0 elsif ($self->{'driver'} eq 'mssql') { }
0 0 elsif (grep {$self->{'driver'} eq $_;} 'Pg', 'Informix', 'Sybase', 'DB2', 'mysql', 'Solid') { }
1164 0 0 if ($idatetime eq '?') { }
1190 0 0 if ($#_ < 0) { }
0 0 elsif ($#_ < 1) { }
0 0 elsif ($#_ < 2) { }
0 0 elsif ($#_ < 3) { }
0 0 elsif ($#_ < 4) { }
1191 0 0 if (defined $idatetime and not $idatetime =~ /!/) { }
1194 0 0 if (defined $t) { }
1204 0 0 if (not defined $idatetime or $idatetime ne '!') { }
1251 0 0 if ($mon == 0 or $year < 1000)
1255 0 0 if ($mon == 1 or $mon == 3 or $mon == 5 or $mon == 7 or $mon == 8 or $mon == 10 or $mon == 12) { }
0 0 elsif ($mon == 4 or $mon == 6 or $mon == 9 or $mon == 11) { }
0 0 elsif ($year % 4 or not $year % 100 and $year % 1000) { }
1257 0 0 if (not defined $day) { }
0 0 elsif ($day > 31) { }
1265 0 0 if (not defined $day) { }
0 0 elsif ($day > 30) { }
1273 0 0 if (not defined $day) { }
0 0 elsif ($day > 28) { }
1281 0 0 if (not defined $day) { }
0 0 elsif ($day > 29) { }
1289 0 0 if $mon < 1 or $mon > 12 or $day < 1
1290 0 0 if $t and $hour < 0 || $hour > 23 || $min < 0 || $min > 59 || $sec < 0 || $sec > 59
1293 0 0 if ($self->{'driver'} eq 'Oracle') { }
0 0 elsif (grep {$self->{'driver'} eq $_;} 'Pg', 'DB2', 'Solid', 'mysql') { }
0 0 elsif ($self->{'driver'} eq 'Informix') { }
0 0 elsif ($self->{'driver'} eq 'mssql') { }
1294 0 0 if ($type) { }
1295 0 0 if ($t) { }
1308 0 0 if ($t) { }
1318 0 0 if ($type) { }
1319 0 0 if ($t) { }
1327 0 0 if ($t) { }
1337 0 0 if ($type) { }
1338 0 0 if ($t) { }
1346 0 0 if ($t) { }
1356 0 0 if ($type) { }
1357 0 0 if ($t) { }
1366 0 0 if ($t) { }
1393 0 0 if ($self->{'driver'} eq 'Oracle') { }
0 0 elsif (grep {$self->{'driver'} eq $_;} 'Pg', 'DB2', 'Solid', 'mysql') { }
0 0 elsif ($self->{'driver'} eq 'Informix') { }
0 0 elsif ($self->{'driver'} eq 'mssql') { }
1396 0 0 if $t
1401 0 0 if ($t)
1409 0 0 if ($t) { }
1420 0 0 if ($t)
1429 0 0 wantarray ? :
1432 0 0 if ($t)
1433 0 0 wantarray ? :
1437 0 0 wantarray ? :
1447 0 0 if $result eq '0 but true'
1457 0 0 unless ($driver)
1460 0 0 if grep(('Sybase' eq $_), @drv_arr) and $driver eq 'mssql'
1461 0 0 if grep(($driver eq $_), @drv_arr)
1472 0 0 unless $driver and get_driver($driver)
1475 0 0 if ($driver ne 'Oracle' and $driver ne 'mssql' and $driver ne 'Solid') { }
0 0 elsif ($driver eq 'Oracle') { }
0 0 elsif ($driver eq 'mssql') { }
0 0 elsif ($driver eq 'Solid') { }
1477 0 0 if ($driver eq 'Informix' and not $source =~ /@/)
1492 0 0 unless defined $source
1494 0 0 if (/Pg/)
1495 0 0 unless $source =~ /dbi:Pg:dbname=/
1496 0 0 if $self->{'host'}
1497 0 0 if $self->{'port'}
1499 0 0 if (/Oracle/)
1500 0 0 unless $source =~ /dbi:Oracle:/
1502 0 0 if (/Informix/)
1503 0 0 unless $source =~ /dbi:Informix:/
1505 0 0 if (/DB2/)
1506 0 0 unless $source =~ /dbi:DB2:/
1508 0 0 if (/mysql/)
1510 0 0 if $self->{'host'}
1512 0 0 if (/mssql/)
1514 0 0 if $self->{'host'}
1517 0 0 if (/Solid/)
1518 0 0 unless $source =~ /dbi:Solid:/
1573 0 0 if $DeltaX::Database::Dcmdstatus
1574 0 0 if $DeltaX::Database::Dsqlstatus
1575 0 0 if $errnum
1577 0 0 if ($self->{'trace'} > 1)
1578 0 0 if defined $DeltaX::Database::Dstr_command
1579 0 0 if ($#_ >= 0)
1580 0 0 defined $_ ? :
1613 0 0 unless defined $_
1614 0 0 unless /^[0-9.]+$/
1635 0 0 if ($self->{'stat_type'} eq 'none')
1650 0 0 if ($self->{'stat_type'} eq 'none')
1658 0 0 if $status eq 'ERROR'
1660 0 0 if ($self->{'stat_type'} eq 'sums')
1666 0 0 if ($status eq 'ERROR')
1676 0 0 if (scalar @{$self->{'stat_all'}{'high'};} > $self->{'stat_max_high'})
1681 0 0 if ($self->{'stat_type'} eq 'high')
1685 0 0 if not $self->{'stat_all'}{'all'} or scalar @{$self->{'stat_all'}{'all'};} < $self->{'stat_max_all'}
1695 0 0 if $max_high
1696 0 0 if $max_all
1737 0 0 if ($teste eq 'TABLE_NOTEXIST' or $teste eq '1') { }
0 0 elsif ($teste eq 'TABLE_EXIST' or $teste eq '2') { }
0 0 elsif ($teste eq 'REC_EXIST' or $teste eq '3') { }
0 0 elsif ($teste eq 'SCHEMA_NOTEXIST' or $teste eq '4') { }
0 0 elsif ($teste eq 'SCHEMA_EXIST' or $teste eq '5') { }
1746 0 0 if ($self->{'driver'} eq 'Pg') { }
0 0 elsif ($self->{'driver'} eq 'Oracle') { }
0 0 elsif ($self->{'driver'} eq 'Informix') { }
0 0 elsif ($self->{'driver'} eq 'DB2') { }
0 0 elsif ($self->{'driver'} eq 'mysql') { }
0 0 elsif ($self->{'driver'} eq 'mssql') { }
0 0 elsif ($self->{'driver'} eq 'Solid') { }
1747 0 0 if ($DeltaX::Database::Dsqlstatus eq '7' and $DeltaX::Database::Derror_message =~ /(Relation|relation|table) .* does not exist/) { }
0 0 elsif ($DeltaX::Database::Dsqlstatus eq '7' and $DeltaX::Database::Derror_message =~ /(R|r)elation .* already exists/) { }
0 0 elsif ($DeltaX::Database::Dsqlstatus eq '7' and $DeltaX::Database::Derror_message =~ /duplicate key/) { }
0 0 elsif ($DeltaX::Database::Dsqlstatus eq '7' and $DeltaX::Database::Derror_message =~ /(Namespace|Schema|schema) .* does not exist/) { }
0 0 elsif ($DeltaX::Database::Dsqlstatus eq '7' and $DeltaX::Database::Derror_message =~ /(namespace|schema) .* already exists/) { }
1754 0 0 if ($DeltaX::Database::Dsqlstatus eq '942' or $DeltaX::Database::Dsqlstatus eq '4043') { }
0 0 elsif ($DeltaX::Database::Dsqlstatus eq '955') { }
0 0 elsif ($DeltaX::Database::Dsqlstatus eq '1') { }
1759 0 0 if ($DeltaX::Database::Dsqlstatus eq '-206') { }
0 0 elsif ($DeltaX::Database::Dsqlstatus eq '-310') { }
0 0 elsif ($DeltaX::Database::Dsqlstatus eq '-239') { }
1764 0 0 if ($DeltaX::Database::Dsqlstatus eq '-204' and $DeltaX::Database::Derror_message =~ /"[^\.]+\.[^\.]+"/ or $DeltaX::Database::Dsqlstatus eq '-99999' and $DeltaX::Database::Derror_message =~ /CLI0125E/) { }
0 0 elsif ($DeltaX::Database::Dsqlstatus eq '-601' and $DeltaX::Database::Derror_message =~ /type "TABLE"/) { }
0 0 elsif ($DeltaX::Database::Dsqlstatus eq '-803') { }
0 0 elsif ($DeltaX::Database::Dsqlstatus eq '-204' and $DeltaX::Database::Derror_message =~ /"[^\.]+"/) { }
0 0 elsif ($DeltaX::Database::Dsqlstatus eq '-601' and $DeltaX::Database::Derror_message =~ /type "SCHEMA"/) { }
1772 0 0 if ($DeltaX::Database::Dsqlstatus eq '1051' or $DeltaX::Database::Dsqlstatus eq '1146') { }
0 0 elsif ($DeltaX::Database::Dsqlstatus eq '1050') { }
0 0 elsif ($DeltaX::Database::Dsqlstatus eq '1062') { }
1777 0 0 if ($DeltaX::Database::Dsqlstatus eq '3701' or $DeltaX::Database::Dsqlstatus eq '208') { }
0 0 elsif ($DeltaX::Database::Dsqlstatus eq '2714') { }
0 0 elsif ($DeltaX::Database::Dsqlstatus eq '2601') { }
1782 0 0 if ($DeltaX::Database::Dsqlstatus eq '13011') { }
0 0 elsif ($DeltaX::Database::Dsqlstatus eq '13013') { }
0 0 elsif ($DeltaX::Database::Dsqlstatus eq '10005' or $DeltaX::Database::Dsqlstatus eq '10033') { }
0 0 elsif ($DeltaX::Database::Dsqlstatus eq '13141' or $DeltaX::Database::Dsqlstatus eq '13046') { }
0 0 elsif ($DeltaX::Database::Dsqlstatus eq '13142') { }
1789 0 0 unless scalar @teste
1793 0 0 unless scalar @teste
1794 0 0 grep({$rete == $_;} @teste) ? :