Branch Coverage

blib/lib/Rose/DB.pm
Criterion Covered Total %
branch 188 584 32.1


line true false branch
163 224 0 if ($entry)
167 0 224 unless defined $driver
186 184 122 unless ($Rebless{join $;, $class, $driver_class})
189 82 102 unless ($Class_Loaded{$driver_class} or @{"${driver_class}::ISA";})
200 0 82 if $error
239 0 4 unless my $entry = $class->registry->entry("domain", $domain, "type", $type)
254 4 10 @_ == 1 ? :
269 0 2 unless my $source = $args{'source'}
271 0 2 unless my $src_domain = $source->{'domain'}
272 0 2 unless my $src_type = $source->{'type'}
274 0 2 unless my $alias = $args{'alias'}
276 0 2 unless my $alias_domain = $alias->{'domain'}
277 0 2 unless my $alias_type = $alias->{'type'}
281 0 2 unless my $entry = $registry->entry("domain", $src_domain, "type", $src_type)
295 82 464 if (@_)
308 0 0 if (@_)
313 0 0 if (my $cache = $class->_db_cache)
329 0 0 if $error
348 0 0 if @_ == 1
352 0 0 unless exists $args{'domain'}
353 0 0 unless exists $args{'type'}
359 0 0 if (my $db = $cache->get_db(%args))
361 0 0 if $Debug
366 0 0 if ($Debug) { }
370 0 0 if $Debug
399 58 28 if @_ == 1
406 10 76 exists $args{'domain'} ? :
409 72 14 exists $args{'type'} ? :
419 68 18 if (exists $registry->{$domain} and exists $registry->{$domain}{$type}) { }
18 0 elsif (not $allow_empty) { }
432 0 68 unless defined $driver
439 0 68 unless ($Class_Loaded{$driver_class})
449 68 0 if (my $new_class = $Rebless{join $;, $class, $driver_class}) { }
486 68 72 if @_
506 16 64 unless (defined ${"${driver_class}::VERSION";})
517 0 16 if $error
531 16 0 @_ ? :
543 74 2 if (@_)
545 2 72 if $self->{'dsn'}
556 0 0 if (@_)
558 0 0 if $self->{'dsn'}
569 0 0 if (@_)
571 0 0 if $self->{'dsn'}
582 0 0 if (@_)
584 0 0 if $self->{'dsn'}
595 61 0 if (@_)
597 0 61 if $self->{'dsn'}
608 9 0 if (@_)
610 0 9 if $self->{'dsn'}
620 0 0 if defined $self->{'database_version'}
630 54 41 if (@_)
637 31 10 $self->{'password_closure'} ? :
653 2 70 if $self->{'dsn'}
668 70 0 if (exists $registry->{$domain} and exists $registry->{$domain}{$type}) { }
674 0 0 if $self->{'driver'}
678 66 0 unless ($args{'refresh'} or $self->{'connect_options_for'}{$domain} and $self->{'connect_options_for'}{$domain}{$type})
681 28 38 if (my $custom_options = $db_info->{'connect_options'})
694 317 224 if ($field ne "connect_options" and defined $value and not defined $self->{$field})
715 25 25 if @_
723 45 6 unless (@_)
728 6 0 if (my $dsn = shift()) { }
771 6 0 if ('DBI'->can('parse_dsn')) { }
792 4 12 if (my $method = $self->dsn_attribute_to_db_method($name)) { }
12 0 elsif ($self->can($name)) { }
802 0 6 unless ($init{'database'})
821 41 0 unless (@_)
823 0 41 if (my $dbh = $self->{'dbh'})
826 0 0 if (!$INC{'threads.pm'} || $dbh->{'private_tid'} == 'threads'->tid and $dbh->{'private_pid'} == $$)
842 0 0 unless (defined $_[0])
855 76 0 if (@_ > 1)
859 2 74 if (defined $driver and defined $_[0]{'driver'} and $_[0]{'driver'} ne $driver)
875 0 0 unless my $dbh = $self->dbh
885 68 0 unless my $dbh = $self->{'dbh'}
887 0 0 if ($args{'force'})
892 0 0 if (UNIVERSAL::isa($dbh, 'Apache::DBI::db')) { }
905 0 0 unless ($self->{'_dbh_refcount'} or $self->{'_dbh_has_foreign_owner'})
907 0 0 if (my $sqls = $self->pre_disconnect_sql)
919 0 0 unless $dbh->do($sql)
927 0 0 if ($error)
946 0 0 if (@_)
948 0 0 if (my $dbh = $self->{'dbh'}) { }
958 0 0 if (my $dbh = $self->{'dbh'}) { }
971 0 0 $_[0] ? :
0 0 @_ ? :
979 0 41 if $Debug
992 0 41 if $INC{'threads.pm'}
1003 0 0 unless ($dbh)
1009 0 0 if ($dbh->{'private_rose_db_inited'}) { }
1018 0 0 if ($self->{'__dbh_attributes'})
1023 0 0 unless defined $val
1028 0 0 if (my $sqls = $self->post_connect_sql and not $dbh->{'private_rose_db_did_post_connect_sql'})
1041 0 0 unless $dbh->do($sql)
1048 0 0 if ($error)
1073 25 0 if (@_)
1075 0 25 $_[0] ? :
1078 0 25 if $self->{'dbh'}
1081 0 25 $self->{'dbh'} ? :
1089 0 0 unless $self->dbh
1097 68 0 unless $self->release_dbh(@_)
1106 0 0 unless my $dbh = $self->dbh
1108 0 0 if ($dbh->{'AutoCommit'})
1127 0 0 unless ($dbh->{'Active'})
1129 0 0 if ($dbh->{'Driver'}{'Name'} eq 'mysql' and $dbh->{'Driver'}{'Version'} < 4.012) { }
1147 0 0 if ($error)
1154 0 0 unless ($ret)
1168 0 0 unless my $dbh = +(shift())->{'dbh'}
1169 0 0 $dbh->{'AutoCommit'} ? :
1176 0 0 defined $self->{'dbh'} && $self->{'dbh'}{'Active'} ? :
1178 0 0 unless (defined $self->{'dbh'})
1184 0 0 unless my $dbh = $self->dbh
1186 0 0 unless ($dbh->{'AutoCommit'})
1207 0 0 if ($error)
1212 0 0 unless ($is_active)
1214 0 0 if ($dbh->{'Driver'}{'Name'} eq "mysql" and $dbh->{'Driver'}{'Version'} < "4.012")
1228 0 0 unless ($ret)
1247 0 0 defined $self->{'dbh'} && $self->{'dbh'}{'Active'} ? :
1249 0 0 unless (defined $self->{'dbh'})
1255 0 0 unless my $dbh = $self->dbh
1259 0 0 if $ac
1280 0 0 if ($error)
1285 0 0 unless ($is_active)
1287 0 0 if ($dbh->{'Driver'}{'Name'} eq "mysql" and $dbh->{'Driver'}{'Version'} < "4.012")
1301 0 0 unless ($ret or $ac)
1317 0 0 unless my $dbh = $self->dbh
1327 0 0 unless $self->begin_work
1329 0 0 unless $self->commit
1335 0 0 if ($error)
1337 0 0 ref $error ? :
1339 0 0 if ($self->rollback) { }
1358 0 0 if ($name =~ /\W/ or $self->is_reserved_word($name))
1370 0 0 if ($name =~ /\W/ or $self->is_reserved_word($name))
1399 0 0 if ($name =~ /^(['"`])(.+)\1$/)
1420 0 0 unless my $dbh = $self->dbh
1430 16 0 if ($DBI::VERSION >= 1.21) { }
1446 0 0 $table ? :
1456 0 0 $table ? :
1466 0 0 ref $columns && @$columns ? :
1473 0 0 @_ == 1 ? :
1475 0 0 unless my $table = $args{'table'}
1479 0 0 unless defined $schema
1481 0 0 if $self->likes_lowercase_table_names
1483 0 0 if defined $schema and $self->likes_lowercase_schema_names
1486 0 0 if defined $catalog and $self->likes_lowercase_catalog_names
1508 0 0 if ($error or not $columns)
1511 0 0 unless defined $error
1517 0 0 wantarray ? :
1524 0 0 unless my $dbh = $self->dbh
1530 0 0 unless (defined $sth)
1553 0 0 unless !$supports_catalog || $pk_info->{'TABLE_CAT'} eq $catalog and $pk_info->{'TABLE_SCHEM'} eq $schema and $pk_info->{'TABLE_NAME'} eq $table
1556 0 0 unless (defined $pk_info->{'COLUMN_NAME'})
1587 0 0 $_[1] ? :
1593 0 0 if $self->validate_boolean_keyword($_[1]) or $self->keyword_function_calls and $_[1] =~ /^\w+\(.*\)$/
1595 0 0 if $value =~ /^(?:t(?:rue)?|y(?:es)?|1)$/i
1596 0 0 if $value =~ /^(?:f(?:alse)?|no?|0)$/i
1607 0 0 if $self->validate_date_keyword($date) or $self->keyword_function_calls and $date =~ /^\w+\(.*\)$/
1616 0 0 if $self->validate_datetime_keyword($date) or $self->keyword_function_calls and $date =~ /^\w+\(.*\)$/
1627 0 24 if $self->validate_time_keyword($time) or $self->keyword_function_calls and $time =~ /^\w+\(.*\)$/
1630 0 24 if (defined $precision)
1632 0 0 if ($precision > 6) { }
0 0 elsif ($precision == 6) { }
0 0 elsif ($precision == 4) { }
1654 0 0 if $self->validate_timestamp_keyword($date) or $self->keyword_function_calls and $date =~ /^\w+\(.*\)$/
1662 0 0 if $self->validate_timestamp_keyword($date) or $self->keyword_function_calls and $date =~ /^\w+\(.*\)$/
1673 0 0 if (UNIVERSAL::isa($value, "DateTime") or $self->validate_date_keyword($value))
1687 0 0 if ($error)
1700 0 0 if (UNIVERSAL::isa($value, "DateTime") or $self->validate_datetime_keyword($value))
1715 0 0 if ($error)
1728 0 0 if (UNIVERSAL::isa($value, "DateTime") or $self->validate_timestamp_keyword($value))
1743 0 0 if ($error)
1756 0 0 if (UNIVERSAL::isa($value, "DateTime") or $self->validate_timestamp_keyword($value))
1771 0 0 if ($error)
1784 0 30 if (not defined $value or UNIVERSAL::isa($value, "Time::Clock") or $self->validate_time_keyword($value) or $self->keyword_function_calls and $value =~ /^\w+\(.*\)$/)
1800 6 24 if ($error)
1819 6 0 if ($second_error)
1834 0 0 unless defined $val
1836 0 0 if (ref $val)
1838 0 0 if ($size and $val->Size != $size)
1846 0 0 if ($val =~ /^[10]+$/) { }
0 0 elsif ($val =~ /^\d*[2-9]\d*$/) { }
0 0 elsif ($val =~ s/^0x// or $val =~ s/^X'(.*)'$/$1/ or $val =~ /^[0-9a-f]+$/i) { }
0 0 elsif ($val =~ s/^B'([10]+)'$/$1/i) { }
1874 0 0 if ($size)
1889 0 0 if ref $_[0]
1890 0 0 if @_ > 1
1894 0 0 unless defined $val
1902 0 0 $_ eq 'NULL' ? :
0 0 defined $1 ? :
1903 0 0 if defined $item
1914 0 0 unless ref $_[0] or defined $_[0]
1916 0 0 ref $_[0] ? :
1920 0 0 if (not defined $_) { }
0 0 elsif (/^[-+]?\d+(?:\.\d*)?$/) { }
1936 0 0 if (length $str > $self->max_array_characters)
1974 2 74 if (not defined $value or UNIVERSAL::isa($value, "DateTime::Duration") or $self->validate_interval_keyword($value) or $self->keyword_function_calls and $value =~ /^\w+\(.*\)$/)
1996 12 206 if $16
1998 22 196 if ($2 or $3 or $4) { }
10 186 elsif ($6) { }
28 158 elsif (defined $7) { }
20 138 elsif (defined $8) { }
18 120 elsif (defined $9) { }
14 106 elsif (defined $10) { }
14 92 elsif (defined $11) { }
22 70 elsif (defined $12) { }
26 44 elsif (defined $13) { }
10 34 elsif (defined $14) { }
10 24 elsif (defined $15) { }
22 2 elsif (defined $17) { }
2000 2 12 if ($sign or defined $units{'hours'} or defined $units{'minutes'} or defined $units{'seconds'})
2007 2 10 $1 && $1 eq '-' ? :
2011 0 12 if (defined $secs and $secs != int $secs)
2018 0 0 if ($len < 9) { }
0 0 elsif ($len > 9) { }
2036 0 10 if ($units{'decades'})
2041 2 26 if ($units{'days'})
2046 0 20 if ($units{'years'})
2051 0 18 if ($units{'hours'})
2056 0 14 if ($units{'months'})
2061 0 14 if ($units{'millenniums'})
2066 0 22 if ($units{'minutes'})
2071 0 26 if ($units{'seconds'})
2077 2 24 if ($units{'seconds'} != $secs)
2083 2 0 if ($len < 9) { }
0 0 elsif ($len > 9) { }
2097 0 10 if ($units{'weeks'})
2102 0 10 if ($units{'centuries'})
2112 34 40 if ($error)
2118 0 40 if ($value_pos != length $value)
2124 14 26 if (defined $units{'millenniums'})
2130 10 30 if (defined $units{'centuries'})
2136 10 30 if (defined $units{'decades'})
2142 6 16 if ($units{'hours'} or $units{'minutes'} or $units{'seconds'})
2153 0 40 if defined $end_of_month_mode
2155 8 32 $is_ago ? :
2160 0 8 if ($is_ago and defined $end_of_month_mode and $dt_duration->end_of_month_mode ne $end_of_month_mode)
2173 0 40 if (not defined $dur or $self->validate_interval_keyword($dur) or $self->keyword_function_calls and $dur =~ /^\w+\(.*\)$/)
2189 8 112 if $deltas{$_} == 1
2192 18 22 if $deltas{'years'}
2193 8 32 if $deltas{'years'} < 0
2195 0 40 if $neg and $deltas{'mons'} > 0
2196 14 26 if $deltas{'mons'}
2198 8 26 $deltas{'mons'} ? :
6 34 $deltas{'mons'} < 0 ? :
2201 6 34 if $neg and $deltas{'days'} > 0
2202 24 16 if $deltas{'days'}
2204 4 14 if ($deltas{'h'} or $deltas{'m'} or $deltas{'s'} or $dur->nanoseconds)
2207 8 14 $deltas{'days'} ? :
4 22 $deltas{'days'} < 0 ? :
2210 2 2 if ($neg and $deltas{'h'} > 0 || !$deltas{'h'} && $deltas{'m'} > 0 || !($deltas{'h'} || $deltas{'m'}) && $deltas{'s'} > 0)
2218 2 4 if not $deltas{'h'} and $deltas{'m'} < 0 || $deltas{'s'} < 0
2222 2 24 $nsec ? :
2224 26 0 if $deltas{'hms'}
2229 2 38 if (length $output > $self->max_interval_characters)
2265 0 0 $_[1] =~ /^\w+\(.*\)$/ ? :
2343 0 0 if (defined $offset) { }
2362 0 0 unless $hints
2363 0 0 $hints->{'comment'} ? :
2374 0 0 if ($tables)
2396 0 0 if ($key) { }
2398 0 0 $key->can('foreign_class') ? :
2405 0 0 if ($more) { }
2415 0 0 if ($table) { }
2417 0 0 if defined $map{$table}
2437 0 0 if ($tables)
2459 0 0 if ($key or not $more) { }
2461 0 0 if ($key) { }
2463 0 0 $key->can('foreign_class') ? :
2473 0 0 if $more
2475 0 0 if defined $map{$table}
2523 0 0 if exists $fk_info->{$param}
2536 0 0 $args{'include_views'} ? :
2546 0 0 unless my $dbh = $self->dbh
2564 0 0 if ($error)
2569 0 0 wantarray ? :
2586 0 0 unless defined $fixup_file and -e $fixup_file
2588 0 0 if (-e $fixup_file)
2590 0 0 if (-r $fixup_file) { }
2606 0 0 if (defined $rosedb_devinit)
2608 0 0 if (-e $rosedb_devinit) { }
2626 0 0 if ($rosedb_devinit->can("fixup"))
2633 0 0 if ($error or not defined $rosedb_devinit)
2645 0 0 unless ($error)
2656 0 0 if ($error) { }
2667 0 0 if ($rosedb_devinit->can("fixup"))
2695 0 0 unless ($YAML_Class)
2706 0 0 if ($error) { }
2719 0 0 if $Debug
2731 0 0 unless ($entry)
2756 0 0 if $cloning
2776 0 0 if defined $password
2787 48 6 if (ref $self_or_class)
2789 44 4 if (@_)
2797 2 4 if @_