Branch Coverage

blib/lib/DBI/Shell.pm
Criterion Covered Total %
branch 124 390 31.7


line true false branch
45 5 0 @_ ? :
67 0 0 @_ ? :
76 0 0 if @{$sh->{'unhandled_options'};}
103 4 5 if exists $sh->{'myconfig'}{'plug-ins'}{'pre-connect'}
106 4 5 if exists $sh->{'myconfig'}{'plug-ins'}{'post-connect'}
154 168 0 $sh->{'batch'} ? :
166 0 0 if $die
176 20 202 if exists $sh->{$opt_name}
187 0 22 unless @ppi
189 10 12 unless $ppi[$n]
192 4 8 if (ref $pi eq 'HASH') { }
8 0 elsif (ref $pi eq 'ARRAY') { }
198 4 8 if ($opt =~ /^option/i) { }
4 4 elsif ($opt =~ /^database/i) { }
4 0 elsif ($opt =~ /^non-database/i) { }
204 0 4 unless $sh->{'dbh'}
208 0 4 if exists $pi->{$opt}{$db}
219 0 0 unless $pi
228 0 16 if ($@) { }
234 0 16 unless $sh->{'batch'}
412 7 0 if (not is_interactive()) { }
417 0 0 if ($sh->{'term'}->Features->{'readHistory'})
446 0 7 unless (&GetOptions($sh, 'help|h', @options))
450 0 7 if ($sh->{'help'})
458 0 7 if ($arg =~ /^-/) { }
472 0 7 defined $user ? :
474 0 7 defined $password ? :
489 0 7 if $sh->{'debug'}
500 0 52 if $sh->{'debug'}
502 52 0 if (ref $options eq 'ARRAY') { }
0 0 elsif (ref $options eq 'HASH') { }
0 0 elsif (ref $options eq 'SCALAR') { }
508 36 80 if (ref $opt_ref eq 'ARRAY') { }
521 0 0 unless $options
525 12 40 unless @po
529 20 20 if ($@ =~ /add_option/) { }
532 0 20 if $@
548 4 1 if ($sh->{'config_file'} and -f $sh->{'config_file'})
552 4 0 if (exists $config->{'options'})
569 0 0 unless defined $current_line
579 0 0 if ($eat_line > 0) { }
581 0 0 if length $current_line >= $eat_line
588 0 0 if ($current_line =~ / ^(.*?) (?<]*))? ((?:\||>>?|<
0 0 elsif ($current_line ne '') { }
602 0 0 if (length $stmt)
605 0 0 if ($sh->is_spooling)
608 0 0 if $cmd eq ''
612 0 0 if $sh->{'debug'}
615 0 0 if ($sh->{'abbrev'}) { }
619 0 0 $sh->{'command'}{$cmd} ? :
621 0 0 if ($command) { }
625 0 0 if ($sh->{'batch'})
630 0 0 if ($current_line =~ /$prefix(.+)/)
640 0 0 if ($sh->is_spooling)
645 0 0 unless ($sh->{'user_level'})
661 0 0 if ($sh->{'term'}) { }
674 0 9 unless $command
677 9 0 if ($sh->can("$code")) { }
678 0 9 if $output
679 0 9 if $output
680 0 9 if ($output)
681 0 0 if (open OUTPUT, $output) { }
694 0 9 if $output
695 0 9 if $@
698 0 0 if ($command eq 'spool') { }
752 9 0 if ($dsn)
753 9 0 if ($dsn =~ /^dbi:.*:/i) { }
0 0 elsif ($dsn =~ /^dbi:([^:]*)/i) { }
764 0 0 if ($sh->{'batch'})
778 0 0 unless defined $driver
781 0 0 if $driver =~ /^dbi:.*:/i
783 0 0 if ($driver =~ /^\s*(\d+)/) { }
787 0 0 if $driver
797 0 0 if (@data_sources) { }
810 0 0 unless defined $source
811 0 0 if ($source =~ /^\s*(\d+)/) { }
0 0 elsif ($source =~ /^dbi:([^:]+)$/) { }
830 0 0 if $sh->{'batch'}
832 0 0 unless (defined $haveTermReadKey)
833 0 0 eval { do { require Term::ReadKey } } ? :
836 0 0 $haveTermReadKey ? :
839 0 0 if ($haveTermReadKey) { }
852 72 0 if $sh->{'batch'}
853 0 0 unless $sh->{'dbh'}
855 0 0 if (ref $sh->{'prompt'}) { }
857 0 0 if (ref $_ eq 'CODE') { }
873 52 0 unless defined $cmd
876 0 52 if @$chist >= $sh->{'chistory_size'}
889 1 0 if $sh->{'batch'}
898 0 0 if $sh->{'abbrev'}
907 0 22 unless ($class)
910 0 22 if $sh->{'debug'}
924 2 50 if ($sh->{'current_buffer'} eq '')
926 0 2 if $sh->{'current_buffer'} eq ''
936 0 52 unless $count % 2 == 0
942 1 51 if ($@)
945 1 0 if not $sh->{'debug'} and $err =~ /^DBD::\w+::\w+ \w+/
959 51 2 unless defined $rh
961 53 0 if ($execute or not $sth->{'Active'})
964 0 53 if $params
972 0 53 unless ($sth->{'NUM_OF_FIELDS'})
974 0 0 unless defined $rv
975 0 0 if $rv == -1
976 0 0 $rv == 1 ? :
986 51 2 if ($rh)
987 0 51 if @$rhist >= $sh->{'rhistory_size'}
1007 510 9 if ($rh)
1008 255 255 if ($i <= $sh->{'rhistory_head'}) { }
1012 0 255 if @rtail == $sh->{'rhistory_tail'}
1017 0 519 unless (defined $rslt)
1025 51 2 if ($rh)
1026 51 0 if (@rtail)
1030 0 51 if ($ommitted)
1063 0 0 $rv == 1 ? :
0 0 if defined $rv
1074 0 9 unless $sh->{'dbh'}
1077 6 3 if $sh->{'sth'}
1078 0 9 unless $sh->{'dbh'}{'AutoCommit'}
1081 0 9 if $@
1092 0 9 unless $dsn
1094 2 7 if $sh->{'dbh'}
1102 0 9 if (defined $user and length $user)
1108 0 9 if ($sh->{'user'} and not defined $sh->{'password'})
1118 0 9 if $sh->{'init_trace'}
1125 0 9 $msg ? :
1150 0 0 if $sh->{'dbh'}
1152 0 0 if ($sh->{'term'})
1153 0 0 if ($sh->{'term'}->Features->{'writeHistory'})
1174 0 0 if $sh->{'current_buffer'}
1189 0 0 defined $_ ? :
1200 0 0 defined $_ ? :
1210 23 3 unless ($num)
1216 2 24 if ($num and $num =~ /^\-\d+$/)
1222 0 26 unless ($num and $num =~ /^\d+$/ and defined $sh->{'chistory'}[$num - 1])
1235 0 0 if ($@)
1246 0 0 $sh->{'dbh'}->ping == '0' ? :
1253 0 0 if @args and $args[0] =~ /^\d+$/
1267 0 0 if $sh->{'debug'}
1270 0 0 unless open FH, ">$tmp_file"
1272 0 0 if defined $sh->{'current_buffer'}
1273 0 0 unless close FH
1279 0 0 unless open FH, "<$tmp_file"
1281 0 0 unless close FH
1296 0 8 unless ($ufile)
1304 0 8 unless ($file)
1309 0 8 unless (-f $file)
1310 0 0 unless $file
1315 0 8 if $sh->{'debug'}
1317 0 8 unless open FH, "$file"
1319 0 8 unless close FH
1327 0 1 unless ($file)
1332 0 1 if $sh->{'debug'}
1334 0 1 unless open FH, "> $file"
1336 0 1 unless close FH
1338 0 1 if $sh->{'debug'}
1347 0 0 if $sh->do_load($file)
1348 0 0 if $sh->{'debug'}
1349 0 0 if $sh->{'current_buffer'}
1370 0 0 if $sh->{'debug'}
1373 0 0 unless (ref $sth)
1397 0 0 unless defined $tab
1416 0 0 if ($tab =~ /^([^.]+)\.([^.]+)$/)
1423 0 0 if (exists $sh->{'desc_show_long'} and $sh->{'desc_show_long'} == 1) { }
1425 0 0 if (exists $sh->{'desc_show_columns'} and defined $sh->{'desc_show_columns'}) { }
1427 0 0 defined $_ ? :
1428 0 0 unless (@names)
1448 0 0 if exists $sh->{'desc_show_remarks'} and $sh->{'desc_show_remarks'} == 1 and not grep({/REMARK/i;} @names)
1452 0 0 if (ref $sth)
1477 0 0 if (defined $row->{'COLUMN_SIZE'})
1480 0 0 if exists $pk_cols{$col_name_lc}
1486 0 0 if ($dcol eq 'PK')
1487 0 0 defined $is_pk ? :
1490 0 0 if ($dcol eq 'TYPE_NAME' and (exists $sh->{'desc_show_long'} and $sh->{'desc_show_long'} == 0))
1493 0 0 if (defined $row->{'COLUMN_SIZE'})
1501 0 0 defined $row->{$dcol} ? :
1525 0 0 exists $sh->{'desc_format'} ? :
1527 0 0 unless ($class)
1549 0 0 if defined $schema
1562 0 0 if (ref $m eq 'HASH') { }
0 0 elsif (not defined $m) { }
1571 0 0 if (defined $sth->{'PRECISION'}[$c])
1575 0 0 if defined $sth->{'SCALE'}[$c] and $sth->{'SCALE'}[$c] ne 0
1579 0 0 $sth->{'NULLABLE'}[$c] ne 1 ? :
1602 1 47 unless (@args)
1604 25 1 defined $sh->{$opt} ? :
1616 47 0 if $opt_name
1617 0 47 unless ($opt_name and $sh->{'options'}{$opt_name})
1621 43 4 defined $sh->{$opt_name} ? :
1622 5 42 if (not defined $value) { }
1630 0 42 unless $sh->{'batch'}
1631 0 42 $value eq 'undef' ? :
1634 47 0 defined $value ? :
1643 0 0 unless @args
1652 0 1 unless (ref $sth)
1656 0 0 unless (@tables)