Branch Coverage

blib/lib/DBD/SQLite.pm
Criterion Covered Total %
branch 164 228 71.9


line true false branch
31 0 110 if $drh
33 110 0 if (not $methods_are_installed and 1)
100 296 17 if ($dbname =~ /=/)
103 285 13 if ($key =~ /^(?:db(?:name)?|database)$/) { }
6 7 elsif ($key eq 'uri') { }
114 19 294 if (my $flags = $attr->{'sqlite_open_flags'})
115 13 6 unless ($flags & (&DBD::SQLite::OPEN_READONLY() | &DBD::SQLite::OPEN_READWRITE()))
122 0 0 if ($^O =~ /MSWin32/ and $real ne ":memory:" and $real ne "" and not $real =~ /^file:/ and not -f $real)
127 0 0 if (-d $dir) { }
137 6 307 unless DBD::SQLite::db::_login($dbh, $real, $user, $auth, $attr)
176 0 12 unless ($collation)
177 0 0 if $dbh->{'PrintWarn'}
192 128 264 unless defined $_[0] and defined $_[1]
204 0 1380 unless defined $sql
210 21 1359 unless DBD::SQLite::st::_prepare($sth, $sql, @_)
220 2870 107 if (defined $statement and not defined $attr and not @bind_values)
224 2847 23 if (index($statement, ";") == -1 or $allow_multiple_statements)
233 13 123 unless my $sth = $dbh->prepare($statement, $attr)
234 4 119 unless $sth->execute(splice(@copy, 0, $sth->{'NUM_OF_PARAMS'}))
237 111 8 unless $allow_multiple_statements
242 16 98 $rows == 0 ? :
252 0 1 if $file and not -f $file
253 1 0 $dbh->FETCH('Active') ? :
258 1 7 unless defined $value
259 2 0 if (defined $data_type and $data_type == &DBI::SQL_BIT() || $data_type == &DBI::SQL_BLOB() || $data_type == &DBI::SQL_BINARY() || $data_type == &DBI::SQL_VARBINARY() || $data_type == &DBI::SQL_LONGVARBINARY())
276 6 73 if ref $v eq "CODE"
284 0 21 unless my $sth_databases = $dbh->prepare("PRAGMA database_list")
285 0 21 unless $sth_databases->execute
287 11 36 if $db_info->{'seq'} >= 2
300 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 '%') { }
383 13 0 unless ref $attr eq "HASH"
384 0 13 defined $attr->{'Escape'} ? :
385 3 10 if (defined $sch_val)
388 11 2 if (defined $tbl_val)
391 1 12 if (defined $typ_val)
397 1 0 unless ($table_type =~ /^'.*'$/)
402 1 0 if $table_type_list
404 12 1 if @where
407 0 16 unless my $sth = $dbh->prepare($sql)
408 0 16 unless $sth->execute
420 6 3 if defined $schema and $schema ne "%" and $schema ne $dbname
424 8 4 $dbname eq 'temp' ? :
31 12 $dbname eq 'main' ? :
429 0 43 unless my $sth = $dbh->prepare("SELECT name, sql FROM $master_table WHERE type = ?")
430 0 43 unless $sth->execute("table")
433 22 30 if defined $table and $table ne "%" and $table ne $tbname
436 0 33 unless my $t_sth = $dbh->prepare("PRAGMA $quoted_dbname.table_info($quoted_tbname)")
437 0 33 unless $t_sth->execute
440 38 14 if $col->{'pk'}
447 4 29 if (@pk > 1 and $row->{'sql'} =~ /\bPRIMARY\s+KEY\s*\(\s*
475 2 7 if (defined $quote) { }
1 6 elsif (defined $brack) { }
487 1 32 $row->{'sql'} =~ /\bCONSTRAINT\s+(\S+|"[^"]+")\s+PRIMARY\s+KEY\s*\(/i ? :
501 0 33 unless my $sponge = "DBI"->connect("DBI:Sponge:", "", "")
505 0 33 unless my $sth = $sponge->prepare("primary_key_info", {"rows", [map({[@{$_;}{@names}];} @pk_info)], "NUM_OF_FIELDS", scalar @names, "NAME", \@names})
583 0 10 unless my $databases = $dbh->selectall_arrayref("PRAGMA database_list", {"Slice", {}})
589 1 1 if defined $fk_schema and $fk_schema ne "%" and $fk_schema ne $dbname
592 4 6 $dbname eq 'temp' ? :
9 10 $dbname eq 'main' ? :
597 0 19 unless my $tables = $dbh->selectall_arrayref("SELECT name, sql FROM $master_table WHERE type = ?", undef, "table")
602 20 8 if defined $fk_table and $fk_table ne "%" and $fk_table ne $tbname
605 0 14 unless my $sth = $dbh->prepare("PRAGMA $quoted_dbname.foreign_key_list($quoted_tbname)")
606 0 14 unless $sth->execute
608 3 5 if defined $pk_table and $pk_table ne "%" and $pk_table ne $row->{'table'}
610 13 2 unless ($table_info{$row->{'table'}})
614 0 15 unless my $t_sth = $dbh->prepare("PRAGMA $quoted_db.table_info($quoted_tb)")
615 0 15 unless $t_sth->execute
620 13 2 if (keys %$cols)
630 2 2 if defined $pk_schema and $pk_schema ne "%" and $pk_schema ne $table_info{$row->{'table'}}{'schema'}
640 13 0 if defined $row->{'to'}
657 10 3 $table_info{$row->{'table'}}{'columns'}{$row->{'to'}} ? :
669 0 11 unless $rel->{'remote_columns'}
675 11 0 unless ($deferrable_clause)
677 9 2 if (@{$rel->{'local_columns'};} == 1)
679 0 9 unless $rel->{'remote_columns'}
688 3 8 if ($deferrable_clause)
690 3 0 unless ($deferrable_clause =~ /not/i)
693 0 3 $deferrable_clause =~ /deferred/i ? :
701 0 10 unless my $sponge_dbh = "DBI"->connect("DBI:Sponge:", "", "")
705 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})
733 0 4 unless my $databases = $dbh->selectall_arrayref("PRAGMA database_list", {"Slice", {}})
738 0 0 if defined $schema and $schema ne "%" and $schema ne $dbname
741 0 4 $dbname eq 'temp' ? :
4 4 $dbname eq 'main' ? :
746 0 8 unless my $tables = $dbh->selectall_arrayref("SELECT name FROM $master_table WHERE type = ?", undef, "table")
749 4 4 if defined $table and $table ne "%" and uc $table ne uc $tbname
752 0 4 unless my $sth = $dbh->prepare("PRAGMA $quoted_dbname.index_list($quoted_tbname)")
753 0 4 unless $sth->execute
756 4 12 if $unique_only and not $row->{'unique'}
760 0 24 unless my $i_sth = $dbh->prepare("PRAGMA $quoted_db.index_info($quoted_idx)")
761 0 24 unless $i_sth->execute
774 12 4 $row->{'unique'} ? :
785 0 4 unless my $sponge_dbh = "DBI"->connect("DBI:Sponge:", "", "")
789 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})
886 1 6 if (defined $col_val and $col_val eq "%")
921 0 7 if (defined $sch_val)
924 7 0 if (defined $tbl_val)
927 7 0 if @where
929 0 7 unless my $sth_tables = $dbh->prepare($sql)
930 0 7 unless $sth_tables->execute
935 0 9 unless my $sth_columns = $dbh->prepare(qq[PRAGMA "$schema".table_info("$table")])
936 0 9 unless $sth_columns->execute
939 14 6 if (defined $col_val)
941 0 14 unless my $sth = $dbh->prepare("SELECT '$col_info->{'name'}' LIKE '${col_val}'")
942 0 14 unless $sth->execute
944 7 7 unless ($sth->fetchrow_array)[0]
955 7 6 if ($type =~ s/(\w+)\s*\(\s*(\d+)(?:\s*,\s*(\d+))?\s*\)/$1/)
962 0 13 if (defined $col_info->{'dflt_value'})
966 2 11 if ($col_info->{'notnull'}) { }
980 0 7 unless my $sponge = "DBI"->connect("DBI:Sponge:", "", "")
983 0 7 unless $sponge->prepare("column_info", {"rows", [map({[@{$_;}{@COLUMN_INFO}];} @cols)], "NUM_OF_FIELDS", scalar @COLUMN_INFO, "NAME", [@COLUMN_INFO]})
1008 2 235 if exists $_[0]{$_[1]}