Branch Coverage

blib/lib/Basset/Object/Persistent.pm
Criterion Covered Total %
branch 19 434 4.3


line true false branch
389 0 0 ref $record eq 'ARRAY' ? :
393 0 0 unless $pkg->is_attribute($attribute, 'non_primary')
403 0 0 ref $record eq 'ARRAY' ? :
407 0 0 unless $pkg->is_attribute($attribute, 'primary')
419 0 0 if (defined $type and $type eq 'primary') { }
0 0 elsif (defined $type and $type eq 'non_primary') { }
438 0 0 if (defined $type)
439 0 0 if ($type eq 'primary') { }
0 0 elsif ($type eq 'non_primary') { }
548 0 0 if (@_) { }
551 0 0 if (defined $val and not $valid and not $self->loading)
552 0 0 unless $self->load_pkg($class)
553 0 0 unless ($class->exists($val))
569 0 0 unless my $interceptor = shift()
573 0 0 if ($self->committing) { }
626 0 3 if (@_ == 1) { }
632 0 3 unless $table = $class->factory('type', 'table', @_)
645 0 0 unless my $tables = shift() || $class->tables
652 0 0 unless $class->add_attr($attribute)
663 0 3 unless @_
669 0 3 if $existing_table{$table->name}
672 0 3 if ($table->create_attributes)
706 0 0 unless @_
710 0 0 unless my $table = $class->factory('type', 'table', 'primary_column', $class->attributes('primary'), 'non_primary_columns', $class->attributes('non_primary'), %$storage)
977 0 0 unless my $prop = shift()
986 0 0 if (ref $val eq 'HASH') { }
0 0 elsif (ref $val eq 'ARRAY') { }
1041 0 0 unless my $prop = shift()
1045 0 0 if ($self->is_instantiated($prop) and not $$clauses{'temporary'})
1051 0 0 unless my $relationship_data = $$relationships{$prop}
1059 0 0 if ref $table eq 'ARRAY'
1062 0 0 unless $self->load_pkg($fclass)
1064 0 0 unless my($referencing_cols, $foreign_cols) = $self->relationship_columns($prop)
1066 0 0 unless @$foreign_cols and @$referencing_cols
1073 0 0 if ($$clauses{'where'}) { }
1079 0 0 unless my $instantiated = $$clauses{'value'} || $$relationship_data{'class'}->load_all({'key', $$relationship_data{'key'}, 'constructor', {'tied_to_parent', $$relationship_data{'tied_to_parent'}}, %$clauses}, @values)
1090 0 0 if ($$relationship_data{'singleton'})
1094 0 0 if ($$clauses{'temporary'})
1124 0 0 unless my $prop = shift()
1162 0 0 unless my $attribute = shift()
1163 0 0 unless my $fclass = shift()
1198 0 0 if (@_) { }
0 0 elsif ($$h{'instantiating'} eq 'lazy') { }
0 0 elsif ($self->is_instantiated($attr)) { }
1207 0 0 unless $self->is_instantiated($attr)
1406 0 0 unless my $attribute = shift()
1407 0 0 unless my $fclass = shift()
1413 0 0 if (ref $fclass eq 'ARRAY')
1416 0 0 if (defined $class->bridge_classes->{$bridgekey}) { }
1423 0 0 unless $class->load_pkg($loadclass)
1428 0 0 unless $class->load_pkg($c)
1450 0 0 unless ($$init{'singleton'})
1451 0 0 unless $class->create_isa_to_method($attribute)
1485 0 0 unless my $attribute = shift()
1487 0 0 unless my $relationship_data = $self->relationships->{$attribute}
1499 0 0 if (@_ == 1) { }
1505 0 0 if ref $table eq 'ARRAY'
1507 0 0 unless my($referencing_cols, $foreign_cols) = $self->relationship_columns($attribute)
1515 0 0 unless $obj = $$relationship_data{'class'}->new(%init)
1519 0 0 if ($$relationship_data{'accessibility'} eq 'private')
1523 0 0 if (my $key = $$relationship_data{'key'}) { }
1524 0 0 unless defined $obj->$key
1531 0 0 if (my $foreign_method = $$relationship_data{'foreign_has_a'})
1532 0 0 unless $obj->$foreign_method($self)
1569 0 0 $_[0] eq 'singletons' ? :
1575 0 0 unless keys %$instantiated
1583 0 0 unless $deleted_obj->delete
1586 0 0 if @$deleted_relationships
1592 0 0 if $$seen{$rel}++
1595 0 0 if $$relationship_data{'accessibility'} ne 'private' or $$relationship_data{'singleton'} != $singletons
1599 0 0 if ($$relationship_data{'singleton'}) { }
1602 0 0 if ($$relationship_data{'key'}) { }
1613 0 0 unless my($referencing_cols, $foreign_cols) = $self->relationship_columns($rel)
1623 0 0 if ($obj->commit) { }
1669 0 0 unless $deleted_obj->delete
1680 0 0 unless $$relationship_data{'accessibility'} eq 'private'
1686 0 0 if ($$relationship_data{'singleton'}) { }
0 0 elsif ($$relationship_data{'key'}) { }
1696 0 0 if ($obj->delete) { }
1709 0 0 if $$seen{$rel}++
1712 0 0 unless $$relationship_data{'accessibility'} eq 'private'
1715 0 0 if ($$relationship_data{'singleton'}) { }
1718 0 0 if ($$relationship_data{'key'}) { }
1728 0 0 if ($obj->delete) { }
1765 0 0 unless my $attribute = shift()
1767 0 0 $self->relationships->{$attribute} ? :
1785 0 0 unless my $prop = shift()
1789 0 0 unless my $relationship_data = $$relationships{$prop}
1795 0 0 if (ref $table eq 'ARRAY')
1803 0 0 if ($$relationship_data{'foreign_has_a'}) { }
0 0 elsif ($$relationship_data{'relationship_key'}) { }
0 0 elsif ($$relationship_data{'singleton'}) { }
1808 0 0 unless ($foreign_cols, $referencing_cols) = $fclass->relationship_columns($foreign_relationship_method)
1816 0 0 ref $$relationship_data{'relationship_key'} eq 'ARRAY' ? :
1818 0 0 if (ref $$referencing_cols[0] eq 'ARRAY') { }
1885 0 0 if ($self->deleted) { }
0 0 elsif ($flag eq 'composite') { }
0 0 elsif ($flag eq 'string') { }
0 0 elsif (@primary_cols > 1) { }
1927 0 0 unless my $copy = $self->SUPER::copy(@_)
1930 0 0 if (UNIVERSAL::isa($copy, 'Basset::Object::Persistent'))
1931 0 0 if (my $table = $self->primary_table)
1986 0 0 if ($self->should_be_deleted)
1991 0 0 if ($self->tied_to_parent and not $self->should_be_committed)
1995 0 0 if ($self->deleted)
2003 0 0 unless $self->begin
2005 0 0 unless $self->cleanup
2008 0 0 unless $self->commit_relationships('singletons')
2010 0 0 unless my(@tables) = @{$self->tables;}
2015 0 0 if (not $self->force_insert and $self->in_db) { }
2017 0 0 unless my $update_query = $table->update_query
2022 0 0 unless my $query = $table->attach_to_query($update_query, {'where', join(' and ', map({"$_ = ?";} $table->primary_cols))})
2026 0 0 unless my(@values) = map({$self->$_;} $table->alias_column($table->update_bindables))
2028 0 0 unless $self->arbitrary_sql('query', $query, 'vars', \@values, 'table', $table, 'cols', [$table->update_bindables])
2039 0 0 unless my $insert_query = $table->insert_query
2041 0 0 unless my(@values) = map({$self->$_;} $table->alias_column($table->insert_bindables))
2043 0 0 unless $self->arbitrary_sql('query', $insert_query, 'vars', \@values, 'table', $table, 'cols', [$table->insert_bindables])
2050 0 0 if ($table->autogenerated)
2052 0 0 unless my $driver = $self->driver
2054 0 0 unless my $id_stmt = $driver->prepare_cached($table->last_insert_query)
2057 0 0 unless $id_stmt->execute
2062 0 0 unless $id_stmt->finish
2073 0 0 unless $self->commit_relationships('nonsingletons')
2082 0 0 unless (defined $$load_cache{$primary_identifier})
2087 0 0 unless $self->end
2286 1 37 unless ref $self
2288 1 36 unless my $method = shift()
2290 1 35 unless my $table = $self->primary_table
2295 15 20 if (not $self->force_insert and $self->loaded || $self->committed) { }
2304 15 20 if $bindable eq $method
2353 0 0 unless @_
2355 0 0 unless my $table = $class->primary_table
2414 0 0 unless @ids
2416 0 0 unless my $table = $class->primary_table
2419 0 0 if (@cols > 1)
2437 0 0 unless my $iterator = $class->iterator
2478 0 0 unless my $self = $class->new(@_)
2480 0 0 unless $self->commit
2609 0 0 if (@_)
2618 0 0 if ($$clauses{'tables'})
2624 0 0 unless @$tables
2629 0 0 unless my $tableClass = $class->pkg_for_type('table')
2631 0 0 unless my $multiselect_query = $tableClass->multiselect_query('tables', $tables, 'omit_columns_from_tables', $omit_tables, 'use_aliases', 1)
2637 0 0 unless my $query = $tableClass->attach_to_query($multiselect_query, $clauses)
2642 0 0 unless $$clauses{'_loading_next'}
2644 0 0 unless my $stmt = $class->iterator || $class->arbitrary_sql('query', $query, 'vars', \@args, 'iterator', 1)
2652 0 0 if ($iterated and not $class->iterator)
2661 0 0 unless my $obj = $class->new('loading', 1, 'in_db', 1, %$stuff, %{$$clauses{'constructor'};}, 'loaded', 1)
2667 0 0 if (defined $$load_cache{$primary_identifier}) { }
2675 0 0 unless $obj->setup
2681 0 0 if (my $transform = $$clauses{'transform'})
2683 0 0 unless $obj->is_relationship($transform) and ref $transformed
2690 0 0 if ($iterated)
2695 0 0 unless $stmt->finish
2698 0 0 if ($iterated and not @objs)
2703 0 0 if ($$clauses{'singleton'}) { }
2704 0 0 unless my $return = $objs[0]
2705 0 0 $$clauses{'force_arrayref'} ? :
2709 0 0 if (my $key = $$clauses{'key'}) { }
2715 0 0 $$clauses{'force_arrayref'} ? :
2742 0 0 unless my $table = $class->primary_table
2749 0 0 @args ? :
2752 0 0 if (ref $args[0] eq 'HASH')
2756 0 0 unless my $query = $table->attach_to_query($table->count_query, $clauses)
2761 0 0 unless my $data = $class->arbitrary_sql('query', $query, 'vars', [@args], 'into', 'hash')
2796 0 0 unless ($self->in_db)
2801 0 0 if ($self->tied_to_parent and not $self->should_be_deleted)
2807 0 0 unless my $table = $self->primary_table
2809 0 0 unless $self->begin
2814 0 0 unless my $query = $table->attach_to_query($table->delete_query, {'where', join(' and ', map({"$_ = ?";} $table->primary_cols))})
2818 0 0 unless my(@values) = map({$self->$_;} $table->alias_column($table->delete_bindables))
2820 0 0 unless $self->arbitrary_sql('query', $query, 'vars', \@values, 'table', $table, 'cols', [$table->delete_bindables])
2827 0 0 unless $self->delete_relationships
2829 0 0 unless $self->end
2910 0 0 unless my(@clauses) = @_
2914 0 0 if (ref $clauses[0] eq 'HASH')
2919 0 0 if (ref $clauses[0] eq 'ARRAY')
2920 0 0 @clauses == 2 ? :
2925 0 0 $$additional_clauses{'tables'} ? :
2929 0 0 unless defined $clause
2953 0 0 if (ref $_[0] and ref $_[1] eq 'HASH') { }
3054 0 0 unless $init{'query'} or $init{'stmt'}
3059 0 0 if $init{'table'} and not $init{'cols'} or not $init{'table'} and $init{'cols'}
3065 0 0 unless my $driver = $init{'driver'} || $self->driver
3072 0 0 if ($init{'selecting_query'} or $init{'query'} =~ /^\s*$arbitrary_selectables/i)
3076 0 0 unless $self->begin
3078 0 0 $selecting_query ? :
3080 0 0 unless my $stmt = $init{'stmt'} || $driver->prepare_cached($init{'query'})
3084 0 0 if ($init{'vars'}) { }
3086 0 0 unless ref $init{'vars'}
3093 0 0 if $init{'table'}
3094 0 0 defined $_ ? :
3097 0 0 $init{'table'} ? :
0 0 unless $stmt->bind_param($place + 1, $init{'vars'}[$place], $init{'table'} ? $driver->sql_type($$definition{$init{'cols'}[$place]}) : undef)
3111 0 0 unless $stmt->execute
3113 0 0 unless $self->end
3115 0 0 if $init{'iterator'}
3117 0 0 if ($selecting_query)
3122 0 0 $init{'into'} =~ /^array$/i ? :
3126 0 0 if ($fetchmethod eq 'fetchrow_hashref') { }
3136 0 0 unless $stmt->finish
3142 0 0 unless $stmt->finish
3179 0 0 if $self->local_driver
3181 0 0 if (@_) { }
0 0 elsif (my $driver = $self->_driver) { }
3185 0 0 unless ($driver->ping)
3186 0 0 if ($driver->stack)
3193 0 0 unless my $driver = $self->factory('type', 'driver')
3234 0 0 ref $self ? :
3282 0 0 unless my $driver = $self->driver
3308 0 0 unless my $driver = $self->driver
3333 0 0 unless my $driver = $self->driver
3359 0 0 unless my $driver = $self->driver
3383 0 0 unless my $driver = $self->driver
3432 0 0 if (defined $driver and @_ and defined $_[0])
3437 1 1 if ref $self
3438 1 1 if ref $self