Branch Coverage

blib/lib/DBI/Shell.pm
Criterion Covered Total %
branch 124 388 31.9


line true false branch
46 5 0 @_ ? :
68 0 0 @_ ? :
77 0 0 if @{$sh->{'unhandled_options'};}
104 4 5 if exists $sh->{'myconfig'}{'plug-ins'}{'pre-connect'}
107 4 5 if exists $sh->{'myconfig'}{'plug-ins'}{'post-connect'}
155 168 0 $sh->{'batch'} ? :
167 0 0 if $die
177 20 202 if exists $sh->{$opt_name}
188 0 22 unless @ppi
190 10 12 unless $ppi[$n]
193 4 8 if (ref $pi eq 'HASH') { }
8 0 elsif (ref $pi eq 'ARRAY') { }
199 4 8 if ($opt =~ /^option/i) { }
4 4 elsif ($opt =~ /^database/i) { }
4 0 elsif ($opt =~ /^non-database/i) { }
205 0 4 unless $sh->{'dbh'}
209 0 4 if exists $pi->{$opt}{$db}
220 0 0 unless $pi
229 0 16 if ($@) { }
235 0 16 unless $sh->{'batch'}
413 7 0 if (not is_interactive()) { }
418 0 0 if ($sh->{'term'}->Features->{'readHistory'})
447 0 7 unless (&GetOptions($sh, 'help|h', @options))
451 0 7 if ($sh->{'help'})
459 0 7 if ($arg =~ /^-/) { }
473 0 7 defined $user ? :
475 0 7 defined $password ? :
490 0 7 if $sh->{'debug'}
501 0 52 if $sh->{'debug'}
503 52 0 if (ref $options eq 'ARRAY') { }
0 0 elsif (ref $options eq 'HASH') { }
0 0 elsif (ref $options eq 'SCALAR') { }
509 36 80 if (ref $opt_ref eq 'ARRAY') { }
522 0 0 unless $options
526 12 40 unless @po
530 20 20 if ($@ =~ /add_option/) { }
533 0 20 if $@
549 4 1 if ($sh->{'config_file'} and -f $sh->{'config_file'})
553 4 0 if (exists $config->{'options'})
570 0 0 unless defined $current_line
580 0 0 if ($eat_line > 0) { }
582 0 0 if length $current_line >= $eat_line
589 0 0 if ($current_line =~ / ^(.*?) (?<]*))? ((?:\||>>?|<
0 0 elsif ($current_line ne '') { }
603 0 0 if (length $stmt)
606 0 0 if ($sh->is_spooling)
609 0 0 if $cmd eq ''
613 0 0 if $sh->{'debug'}
616 0 0 if ($sh->{'abbrev'}) { }
620 0 0 $sh->{'command'}{$cmd} ? :
622 0 0 if ($command) { }
626 0 0 if ($sh->{'batch'})
635 0 0 if ($sh->is_spooling)
640 0 0 unless ($sh->{'user_level'})
656 0 0 if ($sh->{'term'}) { }
669 0 9 unless $command
672 9 0 if ($sh->can("$code")) { }
673 0 9 if $output
674 0 9 if $output
675 0 9 if ($output)
676 0 0 if (open OUTPUT, $output) { }
689 0 9 if $output
690 0 9 if $@
693 0 0 if ($command eq 'spool') { }
747 9 0 if ($dsn)
748 9 0 if ($dsn =~ /^dbi:.*:/i) { }
0 0 elsif ($dsn =~ /^dbi:([^:]*)/i) { }
759 0 0 if ($sh->{'batch'})
773 0 0 unless defined $driver
776 0 0 if $driver =~ /^dbi:.*:/i
778 0 0 if ($driver =~ /^\s*(\d+)/) { }
782 0 0 if $driver
792 0 0 if (@data_sources) { }
805 0 0 unless defined $source
806 0 0 if ($source =~ /^\s*(\d+)/) { }
0 0 elsif ($source =~ /^dbi:([^:]+)$/) { }
825 0 0 if $sh->{'batch'}
827 0 0 unless (defined $haveTermReadKey)
828 0 0 eval { do { require Term::ReadKey } } ? :
831 0 0 $haveTermReadKey ? :
834 0 0 if ($haveTermReadKey) { }
847 72 0 if $sh->{'batch'}
848 0 0 unless $sh->{'dbh'}
850 0 0 if (ref $sh->{'prompt'}) { }
852 0 0 if (ref $_ eq 'CODE') { }
868 52 0 unless defined $cmd
871 0 52 if @$chist >= $sh->{'chistory_size'}
884 1 0 if $sh->{'batch'}
893 0 0 if $sh->{'abbrev'}
902 0 22 unless ($class)
905 0 22 if $sh->{'debug'}
919 2 50 if ($sh->{'current_buffer'} eq '')
921 0 2 if $sh->{'current_buffer'} eq ''
931 0 52 unless $count % 2 == 0
937 1 51 if ($@)
940 1 0 if not $sh->{'debug'} and $err =~ /^DBD::\w+::\w+ \w+/
954 51 2 unless defined $rh
956 53 0 if ($execute or not $sth->{'Active'})
959 0 53 if $params
967 0 53 unless ($sth->{'NUM_OF_FIELDS'})
969 0 0 unless defined $rv
970 0 0 if $rv == -1
971 0 0 $rv == 1 ? :
981 51 2 if ($rh)
982 0 51 if @$rhist >= $sh->{'rhistory_size'}
1002 510 9 if ($rh)
1003 255 255 if ($i <= $sh->{'rhistory_head'}) { }
1007 0 255 if @rtail == $sh->{'rhistory_tail'}
1012 0 519 unless (defined $rslt)
1020 51 2 if ($rh)
1021 51 0 if (@rtail)
1025 0 51 if ($ommitted)
1058 0 0 $rv == 1 ? :
0 0 if defined $rv
1069 0 9 unless $sh->{'dbh'}
1072 6 3 if $sh->{'sth'}
1073 0 9 unless $sh->{'dbh'}{'AutoCommit'}
1076 0 9 if $@
1087 0 9 unless $dsn
1089 2 7 if $sh->{'dbh'}
1097 0 9 if (defined $user and length $user)
1103 0 9 if ($sh->{'user'} and not defined $sh->{'password'})
1113 0 9 if $sh->{'init_trace'}
1120 0 9 $msg ? :
1145 0 0 if $sh->{'dbh'}
1147 0 0 if ($sh->{'term'})
1148 0 0 if ($sh->{'term'}->Features->{'writeHistory'})
1169 0 0 if $sh->{'current_buffer'}
1184 0 0 defined $_ ? :
1195 0 0 defined $_ ? :
1205 23 3 unless ($num)
1211 2 24 if ($num and $num =~ /^\-\d+$/)
1217 0 26 unless ($num and $num =~ /^\d+$/ and defined $sh->{'chistory'}[$num - 1])
1230 0 0 if ($@)
1241 0 0 $sh->{'dbh'}->ping == '0' ? :
1248 0 0 if @args and $args[0] =~ /^\d+$/
1262 0 0 if $sh->{'debug'}
1265 0 0 unless open FH, ">$tmp_file"
1267 0 0 if defined $sh->{'current_buffer'}
1268 0 0 unless close FH
1274 0 0 unless open FH, "<$tmp_file"
1276 0 0 unless close FH
1291 0 8 unless ($ufile)
1299 0 8 unless ($file)
1304 0 8 unless (-f $file)
1305 0 0 unless $file
1310 0 8 if $sh->{'debug'}
1312 0 8 unless open FH, "$file"
1314 0 8 unless close FH
1322 0 1 unless ($file)
1327 0 1 if $sh->{'debug'}
1329 0 1 unless open FH, "> $file"
1331 0 1 unless close FH
1333 0 1 if $sh->{'debug'}
1342 0 0 if $sh->do_load($file)
1343 0 0 if $sh->{'debug'}
1344 0 0 if $sh->{'current_buffer'}
1365 0 0 if $sh->{'debug'}
1368 0 0 unless (ref $sth)
1392 0 0 unless defined $tab
1411 0 0 if ($tab =~ /^([^.]+)\.([^.]+)$/)
1418 0 0 if (exists $sh->{'desc_show_long'} and $sh->{'desc_show_long'} == 1) { }
1420 0 0 if (exists $sh->{'desc_show_columns'} and defined $sh->{'desc_show_columns'}) { }
1422 0 0 defined $_ ? :
1423 0 0 unless (@names)
1443 0 0 if exists $sh->{'desc_show_remarks'} and $sh->{'desc_show_remarks'} == 1 and not grep({/REMARK/i;} @names)
1447 0 0 if (ref $sth)
1472 0 0 if (defined $row->{'COLUMN_SIZE'})
1475 0 0 if exists $pk_cols{$col_name_lc}
1481 0 0 if ($dcol eq 'PK')
1482 0 0 defined $is_pk ? :
1485 0 0 if ($dcol eq 'TYPE_NAME' and (exists $sh->{'desc_show_long'} and $sh->{'desc_show_long'} == 0))
1488 0 0 if (defined $row->{'COLUMN_SIZE'})
1496 0 0 defined $row->{$dcol} ? :
1520 0 0 exists $sh->{'desc_format'} ? :
1522 0 0 unless ($class)
1544 0 0 if defined $schema
1557 0 0 if (ref $m eq 'HASH') { }
0 0 elsif (not defined $m) { }
1566 0 0 if (defined $sth->{'PRECISION'}[$c])
1570 0 0 if defined $sth->{'SCALE'}[$c] and $sth->{'SCALE'}[$c] ne 0
1574 0 0 $sth->{'NULLABLE'}[$c] ne 1 ? :
1597 1 47 unless (@args)
1599 25 1 defined $sh->{$opt} ? :
1611 47 0 if $opt_name
1612 0 47 unless ($opt_name and $sh->{'options'}{$opt_name})
1616 43 4 defined $sh->{$opt_name} ? :
1617 5 42 if (not defined $value) { }
1625 0 42 unless $sh->{'batch'}
1626 0 42 $value eq 'undef' ? :
1629 47 0 defined $value ? :
1638 0 0 unless @args
1647 0 1 unless (ref $sth)
1651 0 0 unless (@tables)