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 166 0 $sh->{'batch'} ? :
167 0 0 if $die
177 20 188 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'}
411 7 0 if (not is_interactive()) { }
416 0 0 if ($sh->{'term'}->Features->{'readHistory'})
445 0 7 unless (&GetOptions($sh, 'help|h', @options))
449 0 7 if ($sh->{'help'})
457 0 7 if ($arg =~ /^-/) { }
471 0 7 defined $user ? :
473 0 7 defined $password ? :
488 0 7 if $sh->{'debug'}
499 0 52 if $sh->{'debug'}
501 52 0 if (ref $options eq 'ARRAY') { }
0 0 elsif (ref $options eq 'HASH') { }
0 0 elsif (ref $options eq 'SCALAR') { }
507 36 80 if (ref $opt_ref eq 'ARRAY') { }
520 0 0 unless $options
524 12 40 unless @po
528 20 20 if ($@ =~ /add_option/) { }
531 0 20 if $@
547 4 1 if ($sh->{'config_file'} and -f $sh->{'config_file'})
551 4 0 if (exists $config->{'options'})
568 0 0 unless defined $current_line
578 0 0 if ($eat_line > 0) { }
580 0 0 if length $current_line >= $eat_line
587 0 0 if ($current_line =~ / ^(.*?) (?<]*))? ((?:\||>>?|<
0 0 elsif ($current_line ne '') { }
601 0 0 if (length $stmt)
604 0 0 if ($sh->is_spooling)
607 0 0 if $cmd eq ''
611 0 0 if $sh->{'debug'}
614 0 0 if ($sh->{'abbrev'}) { }
618 0 0 $sh->{'command'}{$cmd} ? :
620 0 0 if ($command) { }
624 0 0 if ($sh->{'batch'})
633 0 0 if ($sh->is_spooling)
638 0 0 unless ($sh->{'user_level'})
654 0 0 if ($sh->{'term'}) { }
667 0 9 unless $command
670 9 0 if ($sh->can("$code")) { }
671 0 9 if $output
672 0 9 if $output
673 0 9 if ($output)
674 0 0 if (open OUTPUT, $output) { }
687 0 9 if $output
688 0 9 if $@
691 0 0 if ($command eq 'spool') { }
745 9 0 if ($dsn)
746 9 0 if ($dsn =~ /^dbi:.*:/i) { }
0 0 elsif ($dsn =~ /^dbi:([^:]*)/i) { }
757 0 0 if ($sh->{'batch'})
771 0 0 unless defined $driver
774 0 0 if $driver =~ /^dbi:.*:/i
776 0 0 if ($driver =~ /^\s*(\d+)/) { }
780 0 0 if $driver
790 0 0 if (@data_sources) { }
803 0 0 unless defined $source
804 0 0 if ($source =~ /^\s*(\d+)/) { }
0 0 elsif ($source =~ /^dbi:([^:]+)$/) { }
823 0 0 if $sh->{'batch'}
825 0 0 unless (defined $haveTermReadKey)
826 0 0 eval { do { require Term::ReadKey } } ? :
829 0 0 $haveTermReadKey ? :
832 0 0 if ($haveTermReadKey) { }
845 72 0 if $sh->{'batch'}
846 0 0 unless $sh->{'dbh'}
848 0 0 if (ref $sh->{'prompt'}) { }
850 0 0 if (ref $_ eq 'CODE') { }
866 52 0 unless defined $cmd
869 0 52 if @$chist >= $sh->{'chistory_size'}
882 1 0 if $sh->{'batch'}
891 0 0 if $sh->{'abbrev'}
900 0 22 unless ($class)
903 0 22 if $sh->{'debug'}
917 2 50 if ($sh->{'current_buffer'} eq '')
919 0 2 if $sh->{'current_buffer'} eq ''
929 0 52 unless $count % 2 == 0
935 1 51 if ($@)
938 1 0 if not $sh->{'debug'} and $err =~ /^DBD::\w+::\w+ \w+/
952 51 2 unless defined $rh
954 53 0 if ($execute or not $sth->{'Active'})
957 0 53 if $params
965 0 53 unless ($sth->{'NUM_OF_FIELDS'})
967 0 0 unless defined $rv
968 0 0 if $rv == -1
969 0 0 $rv == 1 ? :
979 51 2 if ($rh)
980 0 51 if @$rhist >= $sh->{'rhistory_size'}
1000 510 9 if ($rh)
1001 255 255 if ($i <= $sh->{'rhistory_head'}) { }
1005 0 255 if @rtail == $sh->{'rhistory_tail'}
1010 0 519 unless (defined $rslt)
1018 51 2 if ($rh)
1019 51 0 if (@rtail)
1023 0 51 if ($ommitted)
1056 0 0 $rv == 1 ? :
0 0 if defined $rv
1067 0 9 unless $sh->{'dbh'}
1070 6 3 if $sh->{'sth'}
1071 0 9 unless $sh->{'dbh'}{'AutoCommit'}
1074 0 9 if $@
1085 0 9 unless $dsn
1087 2 7 if $sh->{'dbh'}
1095 0 9 if (defined $user and length $user)
1101 0 9 if ($sh->{'user'} and not defined $sh->{'password'})
1111 0 9 if $sh->{'init_trace'}
1118 0 9 $msg ? :
1143 0 0 if $sh->{'dbh'}
1145 0 0 if ($sh->{'term'})
1146 0 0 if ($sh->{'term'}->Features->{'writeHistory'})
1167 0 0 if $sh->{'current_buffer'}
1182 0 0 defined $_ ? :
1193 0 0 defined $_ ? :
1203 23 3 unless ($num)
1209 2 24 if ($num and $num =~ /^\-\d+$/)
1215 0 26 unless ($num and $num =~ /^\d+$/ and defined $sh->{'chistory'}[$num - 1])
1228 0 0 if ($@)
1239 0 0 $sh->{'dbh'}->ping == '0' ? :
1246 0 0 if @args and $args[0] =~ /^\d+$/
1260 0 0 if $sh->{'debug'}
1263 0 0 unless open FH, ">$tmp_file"
1265 0 0 if defined $sh->{'current_buffer'}
1266 0 0 unless close FH
1272 0 0 unless open FH, "<$tmp_file"
1274 0 0 unless close FH
1289 0 8 unless ($ufile)
1297 0 8 unless ($file)
1302 0 8 unless (-f $file)
1303 0 0 unless $file
1308 0 8 if $sh->{'debug'}
1310 0 8 unless open FH, "$file"
1312 0 8 unless close FH
1320 0 1 unless ($file)
1325 0 1 if $sh->{'debug'}
1327 0 1 unless open FH, "> $file"
1329 0 1 unless close FH
1331 0 1 if $sh->{'debug'}
1340 0 0 if $sh->do_load($file)
1341 0 0 if $sh->{'debug'}
1342 0 0 if $sh->{'current_buffer'}
1363 0 0 if $sh->{'debug'}
1366 0 0 unless (ref $sth)
1390 0 0 unless defined $tab
1409 0 0 if ($tab =~ /^([^.]+)\.([^.]+)$/)
1416 0 0 if (exists $sh->{'desc_show_long'} and $sh->{'desc_show_long'} == 1) { }
1418 0 0 if (exists $sh->{'desc_show_columns'} and defined $sh->{'desc_show_columns'}) { }
1420 0 0 defined $_ ? :
1421 0 0 unless (@names)
1441 0 0 if exists $sh->{'desc_show_remarks'} and $sh->{'desc_show_remarks'} == 1 and not grep({/REMARK/i;} @names)
1445 0 0 if (ref $sth)
1470 0 0 if (defined $row->{'COLUMN_SIZE'})
1473 0 0 if exists $pk_cols{$col_name_lc}
1479 0 0 if ($dcol eq 'PK')
1480 0 0 defined $is_pk ? :
1483 0 0 if ($dcol eq 'TYPE_NAME' and (exists $sh->{'desc_show_long'} and $sh->{'desc_show_long'} == 0))
1486 0 0 if (defined $row->{'COLUMN_SIZE'})
1494 0 0 defined $row->{$dcol} ? :
1518 0 0 exists $sh->{'desc_format'} ? :
1520 0 0 unless ($class)
1543 0 0 if defined $schema
1556 0 0 if (ref $m eq 'HASH') { }
0 0 elsif (not defined $m) { }
1565 0 0 if (defined $sth->{'PRECISION'}[$c])
1569 0 0 if defined $sth->{'SCALE'}[$c] and $sth->{'SCALE'}[$c] ne 0
1573 0 0 $sth->{'NULLABLE'}[$c] ne 1 ? :
1596 1 47 unless (@args)
1598 23 1 defined $sh->{$opt} ? :
1610 47 0 if $opt_name
1611 0 47 unless ($opt_name and $sh->{'options'}{$opt_name})
1615 43 4 defined $sh->{$opt_name} ? :
1616 5 42 if (not defined $value) { }
1624 0 42 unless $sh->{'batch'}
1625 0 42 $value eq 'undef' ? :
1628 47 0 defined $value ? :
1637 0 0 unless @args
1646 0 1 unless (ref $sth)
1650 0 0 unless (@tables)