Branch Coverage

lib/DB/Object.pm
Criterion Covered Total %
branch 24 542 4.4


line true false branch
117 0 0 if @_ == 1
166 0 0 if ($name) { }
168 0 0 if exists $attr{$name}
177 0 0 if (exists $attr{$name} and defined $value and $attr{$name})
201 1 0 ref $self ? :
222 0 0 $self->{'bind'} ? :
0 0 Want::want('VOID') ? :
223 0 0 if (@_)
231 0 0 if ($self->isa("${base_class}::Statement")) { }
0 0 elsif ($self->{'cache'} and @$queries) { }
300 0 0 if (/$driver/s)
315 0 0 ref $this ? :
326 0 0 unless exists $param->{'driver'}
327 0 0 unless (exists $$driver2pack{$param->{'driver'}})
345 0 0 if $@
348 0 0 exists $param->{'Debug'} ? :
0 0 exists $param->{'debug'} ? :
349 0 0 exists $that->{'cache_dir'} ? :
0 0 exists $param->{'cache_dir'} ? :
350 0 0 if exists $param->{'unknown_field'}
354 0 0 if (exists $param->{'opt'})
360 0 0 exists $param->{'db'} ? :
0 0 exists $param->{'database'} ? :
361 0 0 exists $param->{'server'} ? :
0 0 exists $param->{'host'} ? :
367 0 0 exists $param->{'use_cache'} ? :
368 0 0 exists $param->{'use_bind'} ? :
371 0 0 if exists $param->{'cache_connections'}
377 0 0 if $self->{'driver'}
378 0 0 unless exists $opt->{'RaiseError'}
379 0 0 unless exists $opt->{'AutoCommit'}
380 0 0 unless exists $opt->{'PrintError'}
391 0 0 unless $DB::Object::MOD_PERL
408 0 0 if $self->{'cache_dir'}
409 0 0 if $self->{'debug'}
421 0 0 unless (defined $cache_tables->set($cache))
435 0 0 if ref $def ne "HASH"
438 0 0 unless length $def->{$k}
446 0 0 unless length $def->{'file'}
447 0 0 unless -e $def->{'file'}
448 0 0 if (CORE::stat $def->{'file'})[9] != $ts
449 0 0 unless $qo
450 0 0 unless $self->_is_object($qo) and $qo->isa("DB::Object::Query")
451 0 0 if $self->database ne $qo->database_object->database
461 0 0 unless length $def->{$k}
463 0 0 unless $self->_is_object($def->{'query_object'}) and $def->{'query_object'}->isa("DB::Object::Query")
477 0 0 unless scalar keys %$ref
491 0 0 if @_
499 0 0 @_ == 1 ? :
0 0 if @_
506 0 0 if $@
512 0 0 if ($type) { }
514 0 0 ref $type ? :
525 0 0 wantarray ? :
0 0 unless @found
531 0 0 if @$_ != $len
536 0 0 wantarray ? :
0 0 unless %$hash
537 0 0 wantarray ? :
573 0 0 unless $sth->execute(@$param_ref)
586 0 0 if @_
594 0 0 if (defined $self->{'sth'}) { }
0 0 elsif ($self->{'dbh'}) { }
622 0 0 if (not ref $self) { }
0 0 elsif (defined $self->{'sth'} and $self->{'sth'}->errstr) { }
0 0 elsif (defined $self->{'dbh'} and $self->{'dbh'}->errstr) { }
645 0 0 if (@_)
677 0 0 unless $self->{'bind'}
690 0 0 if ($where and @$binded_where)
695 0 0 if ($group and @$binded_group)
700 0 0 if ($order and @$binded_order)
705 0 0 if ($limit and @$binded_limit)
732 0 0 unless @_
741 0 0 if (@_ == 1) { }
744 0 0 if scalar grep({/^${_}[ 0 ]$/i;} @supported)
756 0 0 if (scalar @found) { }
759 0 0 if not defined $value or $value eq ""
761 0 0 if ($type eq "AUTOCOMMIT" and $self->{'dbh'} and $value =~ /^(?:1|0)$/)
773 0 0 unless scalar @query
809 0 0 $@ ? :
825 0 0 if (ref $q and $q->isa("DB::Object::Query"))
833 0 0 unless ($dbo->ping)
844 0 0 if ($sth) { }
873 0 0 if (ref $q and $q->isa("DB::Object::Query"))
881 0 0 unless ($dbo->ping)
892 0 0 if ($sth) { }
923 0 0 if ($sth and not $result = $sth->execute) { }
939 16 0 unless ($dbh = $self->{'dbh'})
944 0 16 if not defined $str or uc $str eq "NULL"
945 16 0 if ($str =~ /^$DB::Object::RE{'num'}{'real'}$/) { }
965 0 0 if ($vars)
975 0 0 if ($@)
978 0 0 if ($self->fatal) { }
1006 0 0 if ($type) { }
1008 0 0 exists $ref->{$type} ? :
1012 0 0 wantarray ? :
0 0 unless %$ref
1013 0 0 wantarray ? :
1021 0 0 if (not ref $self) { }
1049 0 0 if ref $self ne $base_class
1053 0 0 unless $self->_load_class($table_class)
1058 0 0 unless $self->_is_hash($cache_table)
1059 0 0 unless exists $$cache_table{"${host}:$db"}
1063 0 0 if (not $tbl) { }
1117 0 0 if $ref->{'name'} eq $table
1121 0 0 unless scalar @$def
1145 0 0 unless (defined $cache_tables->set($hash))
1157 0 0 if @_ and $self->_is_hash($_[-1])
1158 0 0 if $opts->{'database'}
1160 0 0 unless ($opts->{'no_cache'} or $opts->{'live'})
1162 0 0 if (my $cache_tables = $self->cache_tables) { }
1179 0 0 if ($opts->{'no_cache'} or $opts->{'live'} or not scalar @$all)
1184 0 0 if scalar @$all
1194 0 0 if @_ and $self->_is_hash($_[0])
1221 0 0 unless (defined $cache_tables->set($hash))
1225 0 0 wantarray ? :
1245 0 0 if ref $self ne $base_class
1248 0 0 if $db eq $self->{'database'}
1249 0 0 unless (@DB::Object::AVAILABLE_DATABASES)
1253 0 0 unless (scalar grep({/^$db$/;} @DB::Object::AVAILABLE_DATABASES))
1272 0 0 if @_
1274 0 0 unless (%$vars)
1281 0 0 if %vars
1285 0 0 unless scalar @found
1317 0 0 ref $q && $q->isa('DB::Object::Query') ? :
1325 0 0 unless $self->_is_array($cachedb)
1330 0 0 if ($cache)
1332 0 0 if ($DB::Object::CACHE_SIZE > 0 and $cache_size > $DB::Object::CACHE_SIZE)
1341 0 0 if ($query and $obj->{'query'} and $obj->{'query'} eq $query)
1350 0 0 if ($cached_sth) { }
1364 0 0 if ($q and $self->_is_a($q, "DB::Object::Query"))
1368 0 0 if (scalar keys %$prepare_options) { }
1386 0 0 if ($cache) { }
0 0 elsif ($bind) { }
1398 0 0 if $self->_is_a($q, "DB::Object::Query")
1401 0 0 if ($q and $self->_is_object($q) and $q->isa("DB::Object::Query"))
1404 0 0 if (scalar keys %$constant)
1408 0 0 unless $constant->{$k}
1427 0 0 if (length $param->{$k} and not grep(/^$k$/, @$valid) and not exists $opts->{$k})
1433 0 0 if scalar @opts_to_remove
1435 0 0 if not length $param->{'database'} and $param->{'db'}
1443 0 0 unless $self->_is_hash($opts)
1454 0 0 if $param->{'opt'} and $self->_is_hash($param->{'opt'})
1470 0 0 if (not @_ % 2) { }
0 0 elsif (ref $_[0] eq 'HASH') { }
1500 0 0 if $ENV{$equi->{$prop}} and not length $param->{$prop}
1506 0 0 if ($param->{'uri'} or $ENV{'DB_CON_URI'})
1514 0 0 if (not $@ and $uri)
1518 0 0 if ($uri->can('port')) { }
0 0 elsif (length $uri->path) { }
1521 0 0 if $uri->port
1529 0 0 if $q{'host'}
1530 0 0 if $q{'port'}
1531 0 0 if $q{'database'}
1532 0 0 if $q{'schema'}
1533 0 0 if $q{'user'}
1534 0 0 if $q{'login'}
1535 0 0 if $q{'password'}
1536 0 0 if $q{'opt'}
1537 0 0 if not $param->{'login'} and $param->{'user'}
1538 0 0 if ($q{'opt'})
1544 0 0 if (defined *{"JSON::";})
1550 0 0 if ($@)
1554 0 0 if scalar keys %$jdata
1559 0 0 if ($param->{'conf_file'} or $param->{'config_file'} or $ENV{'DB_CON_FILE'})
1563 0 0 if (not $db_con_file->exists) { }
0 0 elsif ($db_con_file->is_empty) { }
0 0 elsif (not $db_con_file->can_read) { }
1584 0 0 if (defined *{"JSON::";})
1587 0 0 if (my $io = $db_con_file->open_utf8('<')) { }
1598 0 0 if ($@)
1602 0 0 unless $self->_is_hash($json)
1604 0 0 if (exists $json->{'databases'}) { }
1606 0 0 unless $self->_is_array($json->{'databases'})
1612 0 0 if (not $param->{'database'} and !$driver || $this->{'driver'} eq $driver) { }
0 0 elsif ($param->{'database'} and $this->{'database'} eq $param->{'database'} and !$param->{'host'} || $param->{'host'} eq $this->{'host'} and !$param->{'port'} || $param->{'port'} eq $this->{'port'}) { }
1630 0 0 if (scalar keys %$ref)
1634 0 0 if not length $param->{$k} and length $ref->{$k}
1638 0 0 if (exists $param->{'host'} and index($param->{'host'}, ":") != -1)
1643 0 0 if (not $param->{'opt'} and $ENV{'DB_OPT'})
1649 0 0 if (defined *{"JSON::";})
1655 0 0 if ($@)
1659 0 0 if scalar keys %$jdata
1668 0 0 ref $data ? :
1670 0 0 if not ref $data
1696 0 0 if ($self->{'cache_connections'}) { }
1718 0 0 unless $dbh
1726 0 0 unless length $json
1732 0 0 if $@
1746 0 0 if not scalar @_ or scalar @_ == 1 and not defined $_[0]
1748 0 0 unless $self->_is_hash($this)
1754 0 0 if $@
1764 0 0 unless $self->_load_class($pkg)
1777 0 0 ref $self eq $self->base_class ? :
0 0 $self->{'dbo'} ? :
1786 0 0 unless exists $data->{'selected_fields'}
1797 0 0 if (scalar @_)
1799 0 0 if ($self->_is_hash($_[0])) { }
0 0 elsif (not scalar(@_) % 2) { }
1821 0 0 unless ref($obj) =~ /^$base\::Query$/
1836 0 1 if $@
1840 1 0 if length $self->{'enhance'}
1842 0 1 unless $o->table_object($self)
1855 1 0 unless ($obj)
1873 0 0 unless $obj->isa("DB::Object::Query")
1881 0 0 if ($self->{'query'} and length $self->{'query'})
1892 1 0 if (not $self->{'query_reset'}) { }
1897 0 1 if $obj
1898 0 1 if ($obj and $obj->join_tables->length > 0)
1902 0 0 if $tbl->name eq $self->name
1904 0 0 if $this_query_object
1905 0 0 unless $tbl->use_bind > 1
1906 0 0 unless $tbl->use_cache > 1
1911 1 0 unless defined $self->{'bind'} and $self->{'bind'} > 1
1912 1 0 unless defined $self->{'cache'} and $self->{'cache'} > 1
1925 0 0 if &blessed($_[0]) or index($_[0], "::") != -1
1927 0 0 if ($self)
1932 0 0 if (index($meth, "::") != -1)
1953 0 0 if ($class eq $base_class and not scalar @_ and $self->table_exists($meth)) { }
0 0 elsif ($self and $self->can($meth) and defined &{"${class}::$meth";}) { }
0 0 elsif (defined &$meth) { }
0 0 elsif ($class =~ /^(?:$ok_classes)$/) { }
1970 0 0 if $self
1980 0 0 if (defined($filename = $INC{"$pkg.pm"}))
1983 0 0 if (-r $filename) { }
1985 0 0 unless ($filename =~ m[^/]s)
1995 0 0 unless (defined $filename)
2007 0 0 if ($@)
2009 0 0 if (substr($DB::Object::AUTOLOAD, -9) eq '::DESTROY') { }
2021 0 0 if ($filename =~ s/(\w{12,})\.al$/substr($1, 0, 11) . ".al";/e)
2032 0 0 unless ($@)
2035 0 0 if $self
2041 0 0 if ($self and exists $self->{'sth'}) { }
0 0 elsif ($self and $self->{'dbh'} && $self->{'dbh'}->can($meth) || defined &{'DBI::db::' . $meth;}) { }
0 0 elsif ($self and $self->{'dbh'} and exists $self->{'dbh'}{$meth}) { }
0 0 elsif (defined &{'DBI::' . $meth;}) { }
2044 0 0 if (exists $self->{'sth'}{$meth})
2046 0 0 if scalar @_
2049 0 0 unless ($self->executed)
2051 0 0 unless $self->execute
2066 0 0 if scalar @_
2072 0 0 if (defined $h) { }
2088 0 0 $self ? :
2096 0 1 if ($self->{'sth'}) { }
0 2 elsif ($self->{'dbh'} and $class =~ /^AI\:\:DB(?:\:\:(?:Postgres|Mysql|SQLite))?$/) { }
2098 0 0 if $DB::Object::DEBUG
2105 0 0 if ($DB::Object::DEBUG)
2114 0 1 if ($locks and $self->_is_array($locks))
2141 0 0 scalar @_ == 1 && ref $_[0] eq 'ARRAY' ? :
2147 0 0 wantarray ? :
2175 0 0 unless defined $elem
2176 0 0 if (&Scalar::Util::blessed($elem) and $elem->isa('DB::Object::Statement')) { }
2203 0 0 $val eq '?' || $self->_is_number($val) ? :
0 0 &Scalar::Util::blessed($val) && $val->isa('DB::Object::Fields::Field') ? :
2247 0 0 unless defined $elem
2248 0 0 if (&Scalar::Util::blessed($elem) and $elem->isa('DB::Object::Statement')) { }
2275 0 0 $val eq '?' || $self->_is_number($val) ? :
0 0 &Scalar::Util::blessed($val) && $val->isa('DB::Object::Fields::Field') ? :
2299 0 0 scalar @_ == 1 && ref $_[0] eq 'ARRAY' ? :
2310 0 0 wantarray ? :
2342 0 0 unless defined $elem
2343 0 0 if (&Scalar::Util::blessed($elem) and $elem->isa('DB::Object::Statement')) { }
2370 0 0 $val eq '?' || $self->_is_number($val) ? :
0 0 &Scalar::Util::blessed($val) && $val->isa('DB::Object::Fields::Field') ? :
2437 37 1 &Scalar::Util::reftype($str) eq 'SCALAR' ? :
2445 2 0 &Scalar::Util::reftype($str) eq 'SCALAR' ? :
2446 0 2 unless defined $$str and length $$str
2453 3 0 if (exists $DB::Object::Placeholder::REGISTRY->{$1})
2461 0 2 wantarray ? :
2467 0 3 if @_
2474 0 3 if @_