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 144 unless ($dbh->{'mock_can_connect'})
59 2 142 unless ($dbh->{'mock_can_prepare'})
63 3 139 if $dbh->{'mock_can_prepare'} < 0
68 2 2 if (ref $parser eq 'CODE') { }
76 2 140 if ($@)
89 46 94 if (my $session = $dbh->{'mock_session'}) { }
92 29 12 if (ref $rs eq 'ARRAY' and scalar @{$rs;} > 0) { }
104 5 41 if ($@)
115 55 39 if (my $all_rs = $dbh->{'mock_rs'})
116 41 14 defined $all_rs->{'named'}{$statement} ? :
44 11 if (my $by_name = defined $all_rs->{'named'}{$statement} ? $all_rs->{'named'}{$statement} : &first(sub { $statement =~ /$_->{'regexp'}/; } , @{$$all_rs{'matching'};})) { }
124 1 10 if (ref $rs eq 'HASH')
132 52 42 if (ref $rs eq 'ARRAY' and scalar @{$rs;} > 0 || $callback) { }
139 48 4 if ($fields)
154 0 140 unless ($dbh->FETCH('Active'))
181 5 1 if ($dbh->FETCH('AutoCommit')) { }
184 0 5 unless my $sth = $dbh->prepare('BEGIN WORK')
186 1 4 unless my $rc = $sth->execute
199 1 3 if ($dbh->FETCH('AutoCommit') and $dbh->FETCH('Warn'))
203 0 3 unless my $sth = $dbh->prepare('COMMIT')
205 1 2 unless my $rc = $sth->execute
209 1 1 if ($begin_work_commit)
219 1 3 if ($dbh->FETCH('AutoCommit') and $dbh->FETCH('Warn'))
223 0 3 unless my $sth = $dbh->prepare('ROLLBACK')
225 1 2 unless my $rc = $sth->execute
229 1 1 if ($begin_work_commit)
256 0 2 unless defined $a_ref or ref $a_ref ne 'ARRAY'
259 1 1 if (ref $attrib->{'Columns'} eq 'ARRAY')
272 148 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])/) { }
291 6 0 if ($dbh->{'mock_attribute_aliases'})
292 6 0 if (exists do { $$dbh{'mock_attribute_aliases'}{'db'} }->{$attrib})
295 0 6 if (ref $mock_attrib eq 'CODE') { }
316 95 871 if ($attrib eq 'AutoCommit')
320 86 9 $value ? :
323 5 961 if ($attrib eq 'mock_clear_history') { }
6 955 elsif ($attrib eq 'mock_add_parser') { }
30 925 elsif ($attrib eq 'mock_add_resultset') { }
3 922 elsif ($attrib eq 'mock_start_insert_id') { }
31 891 elsif ($attrib eq 'mock_session') { }
1 890 elsif ($attrib =~ /^mock_(add_)?data_sources/) { }
4 886 elsif ($attrib =~ /^mock_add_table_info$/) { }
1 885 elsif ($attrib =~ /^mock_clear_table_info$/) { }
501 384 elsif ($attrib =~ /^mock/) { }
382 2 elsif ($attrib =~ /^(private_|dbi_|dbd_|[A-Z])/) { }
324 5 0 if ($value)
333 1 5 if ($parser_type eq 'CODE') { }
1 5 elsif ($parser_type and not $parser_type =~ /^(ARRAY|HASH|SCALAR)$/) { }
340 4 2 unless ($is_valid_parser)
359 7 23 if (ref $value eq 'ARRAY') { }
23 0 elsif (ref $value eq 'HASH') { }
366 20 3 $value->{'results'} ? :
368 1 22 if (not defined $name) { }
4 18 elsif (ref $name eq 'Regexp') { }
372 1 0 ref $value->{'failure'} ? :
380 1 3 ref $value->{'failure'} ? :
383 1 2 if $_->{'regexp'} eq $name
384 3 1 unless grep {$_ = $matching if $_->{'regexp'} eq $name;} @{$$dbh{'mock_rs'}{'matching'};}
390 1 17 ref $value->{'failure'} ? :
402 3 0 if (ref $value eq 'ARRAY') { }
404 2 1 unless $dbh->{'mock_last_insert_ids'}
416 22 9 if defined $value
428 0 4 if (ref $value ne 'HASH')
432 6 10 defined $_ ? :
437 1 0 if ($value)
462 13 62 if (my $session = $dbh->{'mock_session'})
463 0 13 if ($session->has_states_left)
471 1 10 if (my $session = $dbh->{'mock_session'})
472 1 0 if ($session->has_states_left)