Branch Coverage

blib/lib/DBD/Mock/db.pm
Criterion Covered Total %
branch 134 152 88.1


line true false branch
30 17 8 unless $_
34 2 3 unless $dbh->{'mock_table_info'}{$cataloge}{$schema}{$table}{$type}
40 0 5 unless my $sponge = 'DBI'->connect('dbi:Sponge:', '', '')
43 0 5 unless my $sth = $sponge->prepare('table_info', {'rows', \@rows, 'NUM_OF_FIELDS', scalar @$fieldNames, 'NAME', $fieldNames})
55 2 148 unless ($dbh->{'mock_can_connect'})
59 2 146 unless ($dbh->{'mock_can_prepare'})
63 3 143 if $dbh->{'mock_can_prepare'} < 0
68 2 2 if (ref $parser eq 'CODE') { }
76 2 144 if ($@)
89 46 98 if (my $session = $dbh->{'mock_session'}) { }
92 29 12 if (ref $rs eq 'ARRAY' and scalar @{$rs;} > 0) { }
104 5 41 if ($@)
115 59 39 if (my $all_rs = $dbh->{'mock_rs'})
116 45 14 defined $all_rs->{'named'}{$statement} ? :
48 11 if (my $by_name = defined $all_rs->{'named'}{$statement} ? $all_rs->{'named'}{$statement} : &first(sub { $statement =~ /$_->{'regexp'}/; } , @{$$all_rs{'matching'};})) { }
126 1 10 if (ref $rs eq 'HASH')
136 56 42 if (ref $rs eq 'ARRAY' and scalar @{$rs;} > 0 || $callback) { }
145 52 4 if ($fields)
160 0 144 unless ($dbh->FETCH('Active'))
186 5 1 if ($dbh->FETCH('AutoCommit')) { }
189 0 5 unless my $sth = $dbh->prepare('BEGIN WORK')
191 1 4 unless my $rc = $sth->execute
204 1 3 if ($dbh->FETCH('AutoCommit') and $dbh->FETCH('Warn'))
208 0 3 unless my $sth = $dbh->prepare('COMMIT')
210 1 2 unless my $rc = $sth->execute
214 1 1 if ($begin_work_commit)
224 1 3 if ($dbh->FETCH('AutoCommit') and $dbh->FETCH('Warn'))
228 0 3 unless my $sth = $dbh->prepare('ROLLBACK')
230 1 2 unless my $rc = $sth->execute
234 1 1 if ($begin_work_commit)
261 0 2 unless defined $a_ref or ref $a_ref ne 'ARRAY'
264 1 1 if (ref $attrib->{'Columns'} eq 'ARRAY')
277 152 75 if ($attrib eq 'Active') { }
12 63 elsif ($attrib eq 'mock_all_history') { }
1 62 elsif ($attrib eq 'mock_all_history_iterator') { }
6 56 elsif ($attrib =~ /^mock/) { }
50 6 elsif ($attrib =~ /^(private_|dbi_|dbd_|[A-Z])/) { }
296 6 0 if ($dbh->{'mock_attribute_aliases'})
297 6 0 if (exists do { $$dbh{'mock_attribute_aliases'}{'db'} }->{$attrib})
300 0 6 if (ref $mock_attrib eq 'CODE') { }
321 99 911 if ($attrib eq 'AutoCommit')
325 90 9 $value ? :
328 5 1005 if ($attrib eq 'mock_clear_history') { }
6 999 elsif ($attrib eq 'mock_add_parser') { }
34 965 elsif ($attrib eq 'mock_add_resultset') { }
3 962 elsif ($attrib eq 'mock_start_insert_id') { }
31 931 elsif ($attrib eq 'mock_session') { }
1 930 elsif ($attrib =~ /^mock_(add_)?data_sources/) { }
4 926 elsif ($attrib =~ /^mock_add_table_info$/) { }
1 925 elsif ($attrib =~ /^mock_clear_table_info$/) { }
525 400 elsif ($attrib =~ /^mock/) { }
398 2 elsif ($attrib =~ /^(private_|dbi_|dbd_|[A-Z])/) { }
329 5 0 if ($value)
338 1 5 if ($parser_type eq 'CODE') { }
1 5 elsif ($parser_type and not $parser_type =~ /^(ARRAY|HASH|SCALAR)$/) { }
345 4 2 unless ($is_valid_parser)
364 7 27 if (ref $value eq 'ARRAY') { }
27 0 elsif (ref $value eq 'HASH') { }
371 24 3 $value->{'results'} ? :
373 1 26 if (not defined $name) { }
4 22 elsif (ref $name eq 'Regexp') { }
380 1 0 ref $value->{'failure'} ? :
390 1 3 ref $value->{'failure'} ? :
392 1 2 if $_->{'regexp'} eq $name
393 3 1 unless grep {$_ = $matching if $_->{'regexp'} eq $name;} @{$$dbh{'mock_rs'}{'matching'};}
402 1 21 ref $value->{'failure'} ? :
413 3 0 if (ref $value eq 'ARRAY') { }
415 2 1 unless $dbh->{'mock_last_insert_ids'}
427 22 9 if defined $value
439 0 4 if (ref $value ne 'HASH')
443 6 10 defined $_ ? :
448 1 0 if ($value)
473 13 66 if (my $session = $dbh->{'mock_session'})
474 0 13 if ($session->has_states_left)
482 1 10 if (my $session = $dbh->{'mock_session'})
483 1 0 if ($session->has_states_left)