Branch Coverage

blib/lib/Rose/DB.pm
Criterion Covered Total %
branch 188 580 32.4


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 62 0 if (@_)
584 0 62 if $self->{'dsn'}
595 9 0 if (@_)
597 0 9 if $self->{'dsn'}
607 0 0 if defined $self->{'database_version'}
617 54 41 if (@_)
624 31 10 $self->{'password_closure'} ? :
640 2 70 if $self->{'dsn'}
655 70 0 if (exists $registry->{$domain} and exists $registry->{$domain}{$type}) { }
661 0 0 if $self->{'driver'}
665 66 0 unless ($args{'refresh'} or $self->{'connect_options_for'}{$domain} and $self->{'connect_options_for'}{$domain}{$type})
668 28 38 if (my $custom_options = $db_info->{'connect_options'})
681 317 224 if ($field ne 'connect_options' and defined $value and not defined $self->{$field})
702 25 25 if @_
710 45 6 unless (@_)
715 6 0 if (my $dsn = shift()) { }
757 6 0 if ('DBI'->can('parse_dsn')) { }
778 4 12 if (my $method = $self->dsn_attribute_to_db_method($name)) { }
12 0 elsif ($self->can($name)) { }
788 0 6 unless ($init{'database'})
807 41 0 unless (@_)
809 0 41 if (my $dbh = $self->{'dbh'})
812 0 0 if (!$INC{'threads.pm'} || $dbh->{'private_tid'} == 'threads'->tid and $dbh->{'private_pid'} == $$)
828 0 0 unless (defined $_[0])
841 76 0 if (@_ > 1)
845 2 74 if (defined $driver and defined $_[0]{'driver'} and $_[0]{'driver'} ne $driver)
861 0 0 unless my $dbh = $self->dbh
871 68 0 unless my $dbh = $self->{'dbh'}
873 0 0 if ($args{'force'})
878 0 0 if (UNIVERSAL::isa($dbh, 'Apache::DBI::db')) { }
891 0 0 unless ($self->{'_dbh_refcount'} or $self->{'_dbh_has_foreign_owner'})
893 0 0 if (my $sqls = $self->pre_disconnect_sql)
905 0 0 unless $dbh->do($sql)
913 0 0 if ($error)
932 0 0 if (@_)
934 0 0 if (my $dbh = $self->{'dbh'}) { }
944 0 0 if (my $dbh = $self->{'dbh'}) { }
957 0 0 $_[0] ? :
0 0 @_ ? :
965 0 41 if $Debug
978 0 41 if $INC{'threads.pm'}
989 0 0 unless ($dbh)
995 0 0 if ($dbh->{'private_rose_db_inited'}) { }
1004 0 0 if ($self->{'__dbh_attributes'})
1009 0 0 unless defined $val
1014 0 0 if (my $sqls = $self->post_connect_sql and not $dbh->{'private_rose_db_did_post_connect_sql'})
1027 0 0 unless $dbh->do($sql)
1034 0 0 if ($error)
1059 25 0 if (@_)
1061 0 25 $_[0] ? :
1064 0 25 if $self->{'dbh'}
1067 0 25 $self->{'dbh'} ? :
1075 0 0 unless $self->dbh
1083 68 0 unless $self->release_dbh(@_)
1092 0 0 unless my $dbh = $self->dbh
1094 0 0 if ($dbh->{'AutoCommit'})
1113 0 0 unless ($dbh->{'Active'})
1115 0 0 if ($dbh->{'Driver'}{'Name'} eq 'mysql' and $dbh->{'Driver'}{'Version'} < 4.012) { }
1133 0 0 if ($error)
1140 0 0 unless ($ret)
1154 0 0 unless my $dbh = +(shift())->{'dbh'}
1155 0 0 $dbh->{'AutoCommit'} ? :
1162 0 0 defined $self->{'dbh'} && $self->{'dbh'}{'Active'} ? :
1164 0 0 unless (defined $self->{'dbh'})
1170 0 0 unless my $dbh = $self->dbh
1172 0 0 unless ($dbh->{'AutoCommit'})
1193 0 0 if ($error)
1198 0 0 unless ($is_active)
1200 0 0 if ($dbh->{'Driver'}{'Name'} eq 'mysql' and $dbh->{'Driver'}{'Version'} < 4.012)
1214 0 0 unless ($ret)
1233 0 0 defined $self->{'dbh'} && $self->{'dbh'}{'Active'} ? :
1235 0 0 unless (defined $self->{'dbh'})
1241 0 0 unless my $dbh = $self->dbh
1245 0 0 if $ac
1266 0 0 if ($error)
1271 0 0 unless ($is_active)
1273 0 0 if ($dbh->{'Driver'}{'Name'} eq 'mysql' and $dbh->{'Driver'}{'Version'} < 4.012)
1287 0 0 unless ($ret or $ac)
1303 0 0 unless my $dbh = $self->dbh
1313 0 0 unless $self->begin_work
1315 0 0 unless $self->commit
1321 0 0 if ($error)
1323 0 0 ref $error ? :
1325 0 0 if ($self->rollback) { }
1344 0 0 if ($name =~ /\W/ or $self->is_reserved_word($name))
1356 0 0 if ($name =~ /\W/ or $self->is_reserved_word($name))
1385 0 0 if ($name =~ /^(['"`])(.+)\1$/)
1406 0 0 unless my $dbh = $self->dbh
1416 16 0 if ($DBI::VERSION >= 1.21) { }
1432 0 0 $table ? :
1442 0 0 $table ? :
1452 0 0 ref $columns && @$columns ? :
1459 0 0 @_ == 1 ? :
1461 0 0 unless my $table = $args{'table'}
1465 0 0 unless defined $schema
1467 0 0 if $self->likes_lowercase_table_names
1469 0 0 if defined $schema and $self->likes_lowercase_schema_names
1472 0 0 if defined $catalog and $self->likes_lowercase_catalog_names
1494 0 0 if ($error or not $columns)
1497 0 0 unless defined $error
1503 0 0 wantarray ? :
1510 0 0 unless my $dbh = $self->dbh
1516 0 0 unless (defined $sth)
1539 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
1542 0 0 unless (defined $pk_info->{'COLUMN_NAME'})
1573 0 0 $_[1] ? :
1579 0 0 if $self->validate_boolean_keyword($_[1]) or $self->keyword_function_calls and $_[1] =~ /^\w+\(.*\)$/
1581 0 0 if $value =~ /^(?:t(?:rue)?|y(?:es)?|1)$/i
1582 0 0 if $value =~ /^(?:f(?:alse)?|no?|0)$/i
1593 0 0 if $self->validate_date_keyword($date) or $self->keyword_function_calls and $date =~ /^\w+\(.*\)$/
1602 0 0 if $self->validate_datetime_keyword($date) or $self->keyword_function_calls and $date =~ /^\w+\(.*\)$/
1613 0 24 if $self->validate_time_keyword($time) or $self->keyword_function_calls and $time =~ /^\w+\(.*\)$/
1616 0 24 if (defined $precision)
1618 0 0 if ($precision > 6) { }
0 0 elsif ($precision == 6) { }
0 0 elsif ($precision == 4) { }
1640 0 0 if $self->validate_timestamp_keyword($date) or $self->keyword_function_calls and $date =~ /^\w+\(.*\)$/
1648 0 0 if $self->validate_timestamp_keyword($date) or $self->keyword_function_calls and $date =~ /^\w+\(.*\)$/
1659 0 0 if (UNIVERSAL::isa($value, 'DateTime') or $self->validate_date_keyword($value))
1673 0 0 if ($error)
1686 0 0 if (UNIVERSAL::isa($value, 'DateTime') or $self->validate_datetime_keyword($value))
1701 0 0 if ($error)
1714 0 0 if (UNIVERSAL::isa($value, 'DateTime') or $self->validate_timestamp_keyword($value))
1729 0 0 if ($error)
1742 0 0 if (UNIVERSAL::isa($value, 'DateTime') or $self->validate_timestamp_keyword($value))
1757 0 0 if ($error)
1770 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+\(.*\)$/)
1786 6 24 if ($error)
1805 6 0 if ($second_error)
1820 0 0 unless defined $val
1822 0 0 if (ref $val)
1824 0 0 if ($size and $val->Size != $size)
1832 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) { }
1860 0 0 if ($size)
1875 0 0 if ref $_[0]
1876 0 0 if @_ > 1
1880 0 0 unless defined $val
1888 0 0 $_ eq 'NULL' ? :
0 0 defined $1 ? :
1889 0 0 if defined $item
1900 0 0 unless ref $_[0] or defined $_[0]
1902 0 0 ref $_[0] ? :
1906 0 0 if (not defined $_) { }
0 0 elsif (/^[-+]?\d+(?:\.\d*)?$/) { }
1922 0 0 if (length $str > $self->max_array_characters)
1960 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+\(.*\)$/)
1982 12 206 if $16
1984 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) { }
1986 2 12 if ($sign or defined $units{'hours'} or defined $units{'minutes'} or defined $units{'seconds'})
1993 2 10 $1 && $1 eq '-' ? :
1997 0 12 if (defined $secs and $secs != int $secs)
2004 0 0 if ($len < 9) { }
0 0 elsif ($len > 9) { }
2022 0 10 if ($units{'decades'})
2027 2 26 if ($units{'days'})
2032 0 20 if ($units{'years'})
2037 0 18 if ($units{'hours'})
2042 0 14 if ($units{'months'})
2047 0 14 if ($units{'millenniums'})
2052 0 22 if ($units{'minutes'})
2057 0 26 if ($units{'seconds'})
2063 2 24 if ($units{'seconds'} != $secs)
2069 2 0 if ($len < 9) { }
0 0 elsif ($len > 9) { }
2083 0 10 if ($units{'weeks'})
2088 0 10 if ($units{'centuries'})
2098 34 40 if ($error)
2104 0 40 if ($value_pos != length $value)
2110 14 26 if (defined $units{'millenniums'})
2116 10 30 if (defined $units{'centuries'})
2122 10 30 if (defined $units{'decades'})
2128 6 16 if ($units{'hours'} or $units{'minutes'} or $units{'seconds'})
2139 0 40 if defined $end_of_month_mode
2141 8 32 $is_ago ? :
2146 0 8 if ($is_ago and defined $end_of_month_mode and $dt_duration->end_of_month_mode ne $end_of_month_mode)
2159 0 40 if (not defined $dur or $self->validate_interval_keyword($dur) or $self->keyword_function_calls and $dur =~ /^\w+\(.*\)$/)
2175 8 112 if $deltas{$_} == 1
2178 18 22 if $deltas{'years'}
2179 8 32 if $deltas{'years'} < 0
2181 0 40 if $neg and $deltas{'mons'} > 0
2182 14 26 if $deltas{'mons'}
2184 8 26 $deltas{'mons'} ? :
6 34 $deltas{'mons'} < 0 ? :
2187 6 34 if $neg and $deltas{'days'} > 0
2188 24 16 if $deltas{'days'}
2190 4 14 if ($deltas{'h'} or $deltas{'m'} or $deltas{'s'} or $dur->nanoseconds)
2193 8 14 $deltas{'days'} ? :
4 22 $deltas{'days'} < 0 ? :
2196 2 2 if ($neg and $deltas{'h'} > 0 || !$deltas{'h'} && $deltas{'m'} > 0 || !($deltas{'h'} || $deltas{'m'}) && $deltas{'s'} > 0)
2204 2 4 if not $deltas{'h'} and $deltas{'m'} < 0 || $deltas{'s'} < 0
2208 2 24 $nsec ? :
2210 26 0 if $deltas{'hms'}
2215 2 38 if (length $output > $self->max_interval_characters)
2251 0 0 $_[1] =~ /^\w+\(.*\)$/ ? :
2329 0 0 if (defined $offset) { }
2348 0 0 unless $hints
2349 0 0 $hints->{'comment'} ? :
2360 0 0 if ($tables)
2382 0 0 if ($key) { }
2384 0 0 $key->can('foreign_class') ? :
2391 0 0 if ($more) { }
2401 0 0 if ($table) { }
2403 0 0 if defined $map{$table}
2423 0 0 if ($tables)
2445 0 0 if ($key or not $more) { }
2447 0 0 if ($key) { }
2449 0 0 $key->can('foreign_class') ? :
2459 0 0 if $more
2461 0 0 if defined $map{$table}
2509 0 0 if exists $fk_info->{$param}
2522 0 0 $args{'include_views'} ? :
2532 0 0 unless my $dbh = $self->dbh
2550 0 0 if ($error)
2555 0 0 wantarray ? :
2572 0 0 unless defined $fixup_file and -e $fixup_file
2574 0 0 if (-e $fixup_file)
2576 0 0 if (-r $fixup_file) { }
2592 0 0 if (defined $rosedb_devinit)
2594 0 0 if (-e $rosedb_devinit) { }
2612 0 0 if ($rosedb_devinit->can('fixup'))
2619 0 0 if ($error or not defined $rosedb_devinit)
2631 0 0 unless ($error)
2642 0 0 if ($error) { }
2653 0 0 if ($rosedb_devinit->can('fixup'))
2681 0 0 unless ($YAML_Class)
2692 0 0 if ($error) { }
2705 0 0 if $Debug
2717 0 0 unless ($entry)
2742 0 0 if $cloning
2762 0 0 if defined $password
2773 48 6 if (ref $self_or_class)
2775 44 4 if (@_)
2783 2 4 if @_