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 73 2 if (@_)
545 2 71 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 62 0 if (@_)
597 0 62 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 @_ ? :
980 0 41 if ($Debug)
1005 0 41 if $INC{'threads.pm'}
1016 0 0 unless ($dbh)
1022 0 0 if ($dbh->{'private_rose_db_inited'}) { }
1031 0 0 if ($self->{'__dbh_attributes'})
1036 0 0 unless defined $val
1041 0 0 if (my $sqls = $self->post_connect_sql and not $dbh->{'private_rose_db_did_post_connect_sql'})
1054 0 0 unless $dbh->do($sql)
1061 0 0 if ($error)
1086 25 0 if (@_)
1088 0 25 $_[0] ? :
1091 0 25 if $self->{'dbh'}
1094 0 25 $self->{'dbh'} ? :
1102 0 0 unless $self->dbh
1110 68 0 unless $self->release_dbh(@_)
1119 0 0 unless my $dbh = $self->dbh
1121 0 0 if ($dbh->{'AutoCommit'})
1140 0 0 unless ($dbh->{'Active'})
1142 0 0 if ($dbh->{'Driver'}{'Name'} eq 'mysql' and $dbh->{'Driver'}{'Version'} < 4.012) { }
1160 0 0 if ($error)
1167 0 0 unless ($ret)
1181 0 0 unless my $dbh = +(shift())->{'dbh'}
1182 0 0 $dbh->{'AutoCommit'} ? :
1189 0 0 defined $self->{'dbh'} && $self->{'dbh'}{'Active'} ? :
1191 0 0 unless (defined $self->{'dbh'})
1197 0 0 unless my $dbh = $self->dbh
1199 0 0 unless ($dbh->{'AutoCommit'})
1220 0 0 if ($error)
1225 0 0 unless ($is_active)
1227 0 0 if ($dbh->{'Driver'}{'Name'} eq "mysql" and $dbh->{'Driver'}{'Version'} < "4.012")
1241 0 0 unless ($ret)
1260 0 0 defined $self->{'dbh'} && $self->{'dbh'}{'Active'} ? :
1262 0 0 unless (defined $self->{'dbh'})
1268 0 0 unless my $dbh = $self->dbh
1272 0 0 if $ac
1293 0 0 if ($error)
1298 0 0 unless ($is_active)
1300 0 0 if ($dbh->{'Driver'}{'Name'} eq "mysql" and $dbh->{'Driver'}{'Version'} < "4.012")
1314 0 0 unless ($ret or $ac)
1330 0 0 unless my $dbh = $self->dbh
1340 0 0 unless $self->begin_work
1342 0 0 unless $self->commit
1348 0 0 if ($error)
1350 0 0 ref $error ? :
1352 0 0 if ($self->rollback) { }
1371 0 0 if ($name =~ /\W/ or $self->is_reserved_word($name))
1383 0 0 if ($name =~ /\W/ or $self->is_reserved_word($name))
1412 0 0 if ($name =~ /^(['"`])(.+)\1$/)
1433 0 0 unless my $dbh = $self->dbh
1443 16 0 if ($DBI::VERSION >= 1.21) { }
1459 0 0 $table ? :
1469 0 0 $table ? :
1479 0 0 ref $columns && @$columns ? :
1486 0 0 @_ == 1 ? :
1488 0 0 unless my $table = $args{'table'}
1492 0 0 unless defined $schema
1494 0 0 if $self->likes_lowercase_table_names
1496 0 0 if defined $schema and $self->likes_lowercase_schema_names
1499 0 0 if defined $catalog and $self->likes_lowercase_catalog_names
1521 0 0 if ($error or not $columns)
1524 0 0 unless defined $error
1530 0 0 wantarray ? :
1537 0 0 unless my $dbh = $self->dbh
1543 0 0 unless (defined $sth)
1566 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
1569 0 0 unless (defined $pk_info->{'COLUMN_NAME'})
1600 0 0 $_[1] ? :
1606 0 0 if $self->validate_boolean_keyword($_[1]) or $self->keyword_function_calls and $_[1] =~ /^\w+\(.*\)$/
1608 0 0 if $value =~ /^(?:t(?:rue)?|y(?:es)?|1)$/i
1609 0 0 if $value =~ /^(?:f(?:alse)?|no?|0)$/i
1620 0 0 if $self->validate_date_keyword($date) or $self->keyword_function_calls and $date =~ /^\w+\(.*\)$/
1629 0 0 if $self->validate_datetime_keyword($date) or $self->keyword_function_calls and $date =~ /^\w+\(.*\)$/
1640 0 24 if $self->validate_time_keyword($time) or $self->keyword_function_calls and $time =~ /^\w+\(.*\)$/
1643 0 24 if (defined $precision)
1645 0 0 if ($precision > 6) { }
0 0 elsif ($precision == 6) { }
0 0 elsif ($precision == 4) { }
1667 0 0 if $self->validate_timestamp_keyword($date) or $self->keyword_function_calls and $date =~ /^\w+\(.*\)$/
1675 0 0 if $self->validate_timestamp_keyword($date) or $self->keyword_function_calls and $date =~ /^\w+\(.*\)$/
1686 0 0 if (UNIVERSAL::isa($value, "DateTime") or $self->validate_date_keyword($value))
1700 0 0 if ($error)
1713 0 0 if (UNIVERSAL::isa($value, "DateTime") or $self->validate_datetime_keyword($value))
1728 0 0 if ($error)
1741 0 0 if (UNIVERSAL::isa($value, "DateTime") or $self->validate_timestamp_keyword($value))
1756 0 0 if ($error)
1769 0 0 if (UNIVERSAL::isa($value, "DateTime") or $self->validate_timestamp_keyword($value))
1784 0 0 if ($error)
1797 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+\(.*\)$/)
1813 6 24 if ($error)
1832 6 0 if ($second_error)
1847 0 0 unless defined $val
1849 0 0 if (ref $val)
1851 0 0 if ($size and $val->Size != $size)
1859 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) { }
1887 0 0 if ($size)
1902 0 0 if ref $_[0]
1903 0 0 if @_ > 1
1907 0 0 unless defined $val
1915 0 0 if ($_ eq 'NULL') { }
0 0 defined $1 ? :
1916 0 0 if defined $item
1927 0 0 unless ref $_[0] or defined $_[0]
1929 0 0 ref $_[0] ? :
1933 0 0 if (not defined $_) { }
0 0 elsif (/^[-+]?\d+(?:\.\d*)?$/) { }
1949 0 0 if (length $str > $self->max_array_characters)
1987 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+\(.*\)$/)
2009 12 206 if $16
2011 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) { }
2013 2 12 if ($sign or defined $units{'hours'} or defined $units{'minutes'} or defined $units{'seconds'})
2020 2 10 $1 && $1 eq '-' ? :
2024 0 12 if (defined $secs and $secs != int $secs)
2031 0 0 if ($len < 9) { }
0 0 elsif ($len > 9) { }
2049 0 10 if ($units{'decades'})
2054 2 26 if ($units{'days'})
2059 0 20 if ($units{'years'})
2064 0 18 if ($units{'hours'})
2069 0 14 if ($units{'months'})
2074 0 14 if ($units{'millenniums'})
2079 0 22 if ($units{'minutes'})
2084 0 26 if ($units{'seconds'})
2090 2 24 if ($units{'seconds'} != $secs)
2096 2 0 if ($len < 9) { }
0 0 elsif ($len > 9) { }
2110 0 10 if ($units{'weeks'})
2115 0 10 if ($units{'centuries'})
2125 34 40 if ($error)
2131 0 40 if ($value_pos != length $value)
2137 14 26 if (defined $units{'millenniums'})
2143 10 30 if (defined $units{'centuries'})
2149 10 30 if (defined $units{'decades'})
2155 6 16 if ($units{'hours'} or $units{'minutes'} or $units{'seconds'})
2166 0 40 if defined $end_of_month_mode
2168 8 32 $is_ago ? :
2173 0 8 if ($is_ago and defined $end_of_month_mode and $dt_duration->end_of_month_mode ne $end_of_month_mode)
2186 0 40 if (not defined $dur or $self->validate_interval_keyword($dur) or $self->keyword_function_calls and $dur =~ /^\w+\(.*\)$/)
2202 8 112 if $deltas{$_} == 1
2205 18 22 if $deltas{'years'}
2206 8 32 if $deltas{'years'} < 0
2208 0 40 if $neg and $deltas{'mons'} > 0
2209 14 26 if $deltas{'mons'}
2211 8 26 $deltas{'mons'} ? :
6 34 $deltas{'mons'} < 0 ? :
2214 6 34 if $neg and $deltas{'days'} > 0
2215 24 16 if $deltas{'days'}
2217 4 14 if ($deltas{'h'} or $deltas{'m'} or $deltas{'s'} or $dur->nanoseconds)
2220 8 14 $deltas{'days'} ? :
4 22 $deltas{'days'} < 0 ? :
2223 2 2 if ($neg and $deltas{'h'} > 0 || !$deltas{'h'} && $deltas{'m'} > 0 || !($deltas{'h'} || $deltas{'m'}) && $deltas{'s'} > 0)
2231 2 4 if not $deltas{'h'} and $deltas{'m'} < 0 || $deltas{'s'} < 0
2235 2 24 $nsec ? :
2237 26 0 if $deltas{'hms'}
2242 2 38 if (length $output > $self->max_interval_characters)
2278 0 0 $_[1] =~ /^\w+\(.*\)$/ ? :
2356 0 0 if (defined $offset) { }
2375 0 0 unless $hints
2376 0 0 $hints->{'comment'} ? :
2387 0 0 if ($tables)
2409 0 0 if ($key) { }
2411 0 0 $key->can('foreign_class') ? :
2418 0 0 if ($more) { }
2428 0 0 if ($table) { }
2430 0 0 if defined $map{$table}
2450 0 0 if ($tables)
2472 0 0 if ($key or not $more) { }
2474 0 0 if ($key) { }
2476 0 0 $key->can('foreign_class') ? :
2486 0 0 if $more
2488 0 0 if defined $map{$table}
2536 0 0 if exists $fk_info->{$param}
2549 0 0 $args{'include_views'} ? :
2559 0 0 unless my $dbh = $self->dbh
2577 0 0 if ($error)
2582 0 0 wantarray ? :
2599 0 0 unless defined $fixup_file and -e $fixup_file
2601 0 0 if (-e $fixup_file)
2603 0 0 if (-r $fixup_file) { }
2619 0 0 if (defined $rosedb_devinit)
2621 0 0 if (-e $rosedb_devinit) { }
2639 0 0 if ($rosedb_devinit->can("fixup"))
2646 0 0 if ($error or not defined $rosedb_devinit)
2658 0 0 unless ($error)
2669 0 0 if ($error) { }
2680 0 0 if ($rosedb_devinit->can("fixup"))
2708 0 0 unless ($YAML_Class)
2719 0 0 if ($error) { }
2732 0 0 if $Debug
2744 0 0 unless ($entry)
2769 0 0 if $cloning
2789 0 0 if defined $password
2800 48 6 if (ref $self_or_class)
2802 44 4 if (@_)
2810 2 4 if @_