Branch Coverage

blib/lib/DBD/SQLeet.pm
Criterion Covered Total %
branch 150 208 72.1


line true false branch
32 0 103 if $drh
34 103 0 if (not $methods_are_installed and 1)
94 248 16 if ($dbname =~ /=/)
97 237 13 if ($key =~ /^(?:db(?:name)?|database)$/) { }
6 7 elsif ($key eq 'uri') { }
108 19 245 if (my $flags = $attr->{'sqlite_open_flags'})
109 13 6 unless ($flags & (&DBD::SQLeet::OPEN_READONLY() | &DBD::SQLeet::OPEN_READWRITE()))
116 0 0 if ($^O =~ /MSWin32/ and $real ne ':memory:' and $real ne '' and not $real =~ /^file:/ and not -f $real)
121 0 0 if (-d $dir) { }
131 6 258 unless DBD::SQLeet::db::_login($dbh, $real, $user, $auth, $attr)
170 0 12 unless ($collation)
171 0 0 if $dbh->{'PrintWarn'}
186 128 264 unless defined $_[0] and defined $_[1]
196 0 1285 unless defined $sql
202 10 1275 unless DBD::SQLeet::st::_prepare($sth, $sql, @_)
212 2805 98 if (defined $statement and not defined $attr and not @bind_values)
216 2782 23 if (index($statement, ';') == -1 or $allow_multiple_statements)
225 8 119 unless my $sth = $dbh->prepare($statement, $attr)
226 4 115 unless $sth->execute(splice(@copy, 0, $sth->{'NUM_OF_PARAMS'}))
229 107 8 unless $allow_multiple_statements
234 16 94 $rows == 0 ? :
244 0 1 if $file and not -f $file
245 1 0 $dbh->FETCH('Active') ? :
261 0 63 if ref $v eq 'CODE'
269 0 21 unless my $sth_databases = $dbh->prepare('PRAGMA database_list')
270 0 21 unless $sth_databases->execute
272 11 36 if $db_info->{'seq'} >= 2
285 1 15 if (defined $cat_val and $cat_val eq '%' and defined $sch_val and $sch_val eq '' and defined $tbl_val and $tbl_val eq '') { }
1 14 elsif (defined $cat_val and $cat_val eq '' and defined $sch_val and $sch_val eq '%' and defined $tbl_val and $tbl_val eq '') { }
1 13 elsif (defined $cat_val and $cat_val eq '' and defined $sch_val and $sch_val eq '' and defined $tbl_val and $tbl_val eq '' and defined $typ_val and $typ_val eq '%') { }
368 13 0 unless ref $attr eq 'HASH'
369 0 13 defined $attr->{'Escape'} ? :
370 3 10 if (defined $sch_val)
373 11 2 if (defined $tbl_val)
376 1 12 if (defined $typ_val)
382 1 0 unless ($table_type =~ /^'.*'$/)
387 1 0 if $table_type_list
389 12 1 if @where
392 0 16 unless my $sth = $dbh->prepare($sql)
393 0 16 unless $sth->execute
405 6 3 if defined $schema and $schema ne '%' and $schema ne $dbname
409 8 4 $dbname eq 'temp' ? :
31 12 $dbname eq 'main' ? :
414 0 43 unless my $sth = $dbh->prepare("SELECT name, sql FROM $master_table WHERE type = ?")
415 0 43 unless $sth->execute('table')
418 22 30 if defined $table and $table ne '%' and $table ne $tbname
421 0 33 unless my $t_sth = $dbh->prepare("PRAGMA $quoted_dbname.table_info($quoted_tbname)")
422 0 33 unless $t_sth->execute
425 38 14 if $col->{'pk'}
432 4 29 if (@pk > 1 and $row->{'sql'} =~ /\bPRIMARY\s+KEY\s*\(\s* ( (?: ( [a-z_][a-z0-9_]* | (["'`])(?:\3\3|(?!\3).)+?\3(?!\3) | \[[^\]]+\] ) \s*,\s* )+ ( [a-z_][a-z0-9_]* | (["'`])(?:\5\5|(?!\5).)+?\5(?!\5) | \[[^\]]+\] ) ) \s*\)/six)
460 2 7 if (defined $quote) { }
1 6 elsif (defined $brack) { }
472 1 32 $row->{'sql'} =~ /\bCONSTRAINT\s+(\S+|"[^"]+")\s+PRIMARY\s+KEY\s*\(/i ? :
486 0 33 unless my $sponge = 'DBI'->connect('DBI:Sponge:', '', '')
490 0 33 unless my $sth = $sponge->prepare('primary_key_info', {'rows', [map({[@{$_;}{@names}];} @pk_info)], 'NUM_OF_FIELDS', scalar @names, 'NAME', \@names})
559 0 10 unless my $databases = $dbh->selectall_arrayref('PRAGMA database_list', {'Slice', {}})
565 1 1 if defined $fk_schema and $fk_schema ne '%' and $fk_schema ne $dbname
568 4 6 $dbname eq 'temp' ? :
9 10 $dbname eq 'main' ? :
573 0 19 unless my $tables = $dbh->selectall_arrayref("SELECT name FROM $master_table WHERE type = ?", undef, 'table')
576 20 8 if defined $fk_table and $fk_table ne '%' and $fk_table ne $tbname
579 0 14 unless my $sth = $dbh->prepare("PRAGMA $quoted_dbname.foreign_key_list($quoted_tbname)")
580 0 14 unless $sth->execute
582 3 5 if defined $pk_table and $pk_table ne '%' and $pk_table ne $row->{'table'}
584 13 2 unless ($table_info{$row->{'table'}})
588 0 15 unless my $t_sth = $dbh->prepare("PRAGMA $quoted_db.table_info($quoted_tb)")
589 0 15 unless $t_sth->execute
594 13 2 if (keys %$cols)
604 2 2 if defined $pk_schema and $pk_schema ne '%' and $pk_schema ne $table_info{$row->{'table'}}{'schema'}
621 10 3 $table_info{$row->{'table'}}{'columns'}{$row->{'to'}} ? :
627 0 10 unless my $sponge_dbh = 'DBI'->connect('DBI:Sponge:', '', '')
631 0 10 unless my $sponge_sth = $sponge_dbh->prepare('foreign_key_info', {'NAME', \@FOREIGN_KEY_INFO_ODBC, 'rows', [map({[@{$_;}{@FOREIGN_KEY_INFO_ODBC}];} @fk_info)], 'NUM_OF_FIELDS', scalar @FOREIGN_KEY_INFO_ODBC})
659 0 4 unless my $databases = $dbh->selectall_arrayref('PRAGMA database_list', {'Slice', {}})
664 0 0 if defined $schema and $schema ne '%' and $schema ne $dbname
667 0 4 $dbname eq 'temp' ? :
4 4 $dbname eq 'main' ? :
672 0 8 unless my $tables = $dbh->selectall_arrayref("SELECT name FROM $master_table WHERE type = ?", undef, 'table')
675 4 4 if defined $table and $table ne '%' and uc $table ne uc $tbname
678 0 4 unless my $sth = $dbh->prepare("PRAGMA $quoted_dbname.index_list($quoted_tbname)")
679 0 4 unless $sth->execute
682 4 12 if $unique_only and not $row->{'unique'}
686 0 24 unless my $i_sth = $dbh->prepare("PRAGMA $quoted_db.index_info($quoted_idx)")
687 0 24 unless $i_sth->execute
700 12 4 $row->{'unique'} ? :
711 0 4 unless my $sponge_dbh = 'DBI'->connect('DBI:Sponge:', '', '')
715 0 4 unless my $sponge_sth = $sponge_dbh->prepare('statistics_info', {'NAME', \@STATISTICS_INFO_ODBC, 'rows', [map({[@{$_;}{@STATISTICS_INFO_ODBC}];} @statistics_info)], 'NUM_OF_FIELDS', scalar @STATISTICS_INFO_ODBC})
789 1 6 if (defined $col_val and $col_val eq '%')
824 0 7 if (defined $sch_val)
827 7 0 if (defined $tbl_val)
830 7 0 if @where
832 0 7 unless my $sth_tables = $dbh->prepare($sql)
833 0 7 unless $sth_tables->execute
838 0 9 unless my $sth_columns = $dbh->prepare(qq[PRAGMA "$schema".table_info("$table")])
839 0 9 unless $sth_columns->execute
842 14 6 if (defined $col_val)
844 0 14 unless my $sth = $dbh->prepare("SELECT '$col_info->{'name'}' LIKE '${col_val}'")
845 0 14 unless $sth->execute
847 7 7 unless ($sth->fetchrow_array)[0]
858 7 6 if ($type =~ s/(\w+)\s*\(\s*(\d+)(?:\s*,\s*(\d+))?\s*\)/$1/)
865 0 13 if (defined $col_info->{'dflt_value'})
869 2 11 if ($col_info->{'notnull'}) { }
883 0 7 unless my $sponge = 'DBI'->connect('DBI:Sponge:', '', '')
886 0 7 unless $sponge->prepare('column_info', {'rows', [map({[@{$_;}{@COLUMN_INFO}];} @cols)], 'NUM_OF_FIELDS', scalar @COLUMN_INFO, 'NAME', [@COLUMN_INFO]})
911 2 221 if exists $_[0]{$_[1]}