Branch Coverage

blib/lib/DBD/SQLeet.pm
Criterion Covered Total %
branch 149 208 71.6


line true false branch
34 0 95 if $drh
36 95 0 if (not $methods_are_installed and 1)
96 238 15 if ($dbname =~ /=/)
99 227 13 if ($key =~ /^(?:db(?:name)?|database)$/) { }
6 7 elsif ($key eq 'uri') { }
110 18 235 if (my $flags = $attr->{'sqlite_open_flags'})
111 12 6 unless ($flags & (&DBD::SQLeet::OPEN_READONLY() | &DBD::SQLeet::OPEN_READWRITE()))
118 0 0 if ($^O =~ /MSWin32/ and $real ne ':memory:' and $real ne '' and not $real =~ /^file:/ and not -f $real)
123 0 0 if (-d $dir) { }
133 6 247 unless DBD::SQLeet::db::_login($dbh, $real, $user, $auth, $attr)
172 0 12 unless ($collation)
173 0 0 if $dbh->{'PrintWarn'}
188 128 264 unless defined $_[0] and defined $_[1]
198 0 1117 unless defined $sql
204 10 1107 unless DBD::SQLeet::st::_prepare($sth, $sql, @_)
214 2778 98 if (defined $statement and not defined $attr and not @bind_values)
218 2755 23 if (index($statement, ';') == -1 or $allow_multiple_statements)
227 8 119 unless my $sth = $dbh->prepare($statement, $attr)
228 4 115 unless $sth->execute(splice(@copy, 0, $sth->{'NUM_OF_PARAMS'}))
231 107 8 unless $allow_multiple_statements
236 16 94 $rows == 0 ? :
246 0 1 if $file and not -f $file
247 1 0 $dbh->FETCH('Active') ? :
263 0 63 if ref $v eq 'CODE'
271 0 21 unless my $sth_databases = $dbh->prepare('PRAGMA database_list')
272 0 21 unless $sth_databases->execute
274 11 36 if $db_info->{'seq'} >= 2
287 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 '%') { }
367 13 0 unless ref $attr eq 'HASH'
368 0 13 defined $attr->{'Escape'} ? :
369 3 10 if (defined $sch_val)
373 11 2 if (defined $tbl_val)
377 1 12 if (defined $typ_val)
383 1 0 unless ($table_type =~ /^'.*'$/)
388 1 0 if $table_type_list
390 12 1 if @where
393 0 16 unless my $sth = $dbh->prepare($sql)
394 0 16 unless $sth->execute
406 6 3 if defined $schema and $schema ne '%' and $schema ne $dbname
410 8 4 $dbname eq 'temp' ? :
31 12 $dbname eq 'main' ? :
415 0 43 unless my $sth = $dbh->prepare("SELECT name, sql FROM $master_table WHERE type = ?")
416 0 43 unless $sth->execute('table')
419 22 30 if defined $table and $table ne '%' and $table ne $tbname
422 0 33 unless my $t_sth = $dbh->prepare("PRAGMA $quoted_dbname.table_info($quoted_tbname)")
423 0 33 unless $t_sth->execute
426 38 14 if $col->{'pk'}
433 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)
461 2 7 if (defined $quote) { }
1 6 elsif (defined $brack) { }
473 1 32 $row->{'sql'} =~ /\bCONSTRAINT\s+(\S+|"[^"]+")\s+PRIMARY\s+KEY\s*\(/i ? :
487 0 33 unless my $sponge = 'DBI'->connect('DBI:Sponge:', '', '')
491 0 33 unless my $sth = $sponge->prepare('primary_key_info', {'rows', [map({[@{$_;}{@names}];} @pk_info)], 'NUM_OF_FIELDS', scalar @names, 'NAME', \@names})
559 0 6 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 0 6 $dbname eq 'temp' ? :
5 6 $dbname eq 'main' ? :
573 0 11 unless my $tables = $dbh->selectall_arrayref("SELECT name FROM $master_table WHERE type = ?", undef, 'table')
576 16 4 if defined $fk_table and $fk_table ne '%' and $fk_table ne $tbname
579 0 10 unless my $sth = $dbh->prepare("PRAGMA $quoted_dbname.foreign_key_list($quoted_tbname)")
580 0 10 unless $sth->execute
582 3 1 if defined $pk_table and $pk_table ne '%' and $pk_table ne $row->{'table'}
584 9 2 unless ($table_info{$row->{'table'}})
588 0 11 unless my $t_sth = $dbh->prepare("PRAGMA $quoted_db.table_info($quoted_tb)")
589 0 11 unless $t_sth->execute
594 9 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 6 3 $table_info{$row->{'table'}}{'columns'}{$row->{'to'}} ? :
627 0 6 unless my $sponge_dbh = 'DBI'->connect('DBI:Sponge:', '', '')
631 0 6 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})
752 1 6 if (defined $col_val and $col_val eq '%')
787 0 7 if (defined $sch_val)
790 7 0 if (defined $tbl_val)
793 7 0 if @where
795 0 7 unless my $sth_tables = $dbh->prepare($sql)
796 0 7 unless $sth_tables->execute
801 0 9 unless my $sth_columns = $dbh->prepare(qq[PRAGMA "$schema".table_info("$table")])
802 0 9 unless $sth_columns->execute
805 14 6 if (defined $col_val)
807 0 14 unless my $sth = $dbh->prepare("SELECT '$col_info->{'name'}' LIKE '${col_val}'")
808 0 14 unless $sth->execute
810 7 7 unless ($sth->fetchrow_array)[0]
821 7 6 if ($type =~ s/(\w+)\s*\(\s*(\d+)(?:\s*,\s*(\d+))?\s*\)/$1/)
828 0 13 if (defined $col_info->{'dflt_value'})
832 2 11 if ($col_info->{'notnull'}) { }
846 0 7 unless my $sponge = 'DBI'->connect('DBI:Sponge:', '', '')
849 0 7 unless $sponge->prepare('column_info', {'rows', [map({[@{$_;}{@COLUMN_INFO}];} @cols)], 'NUM_OF_FIELDS', scalar @COLUMN_INFO, 'NAME', [@COLUMN_INFO]})
874 2 205 if exists $_[0]{$_[1]}