Branch Coverage

Test/DBO.pm
Criterion Covered Total %
branch 102 256 39.8


line true false branch
16 0 12 if ($ENV{'DBO_TEST_SQL'})
21 0 12 if ($ENV{'DBO_CARP_VERBOSE'}) { }
12 0 elsif ($ENV{'AUTOMATED_TESTING'}) { }
34 90 0 unless my $dbg = $ENV{'DBO_TEST_SQL'}
36 0 0 if ($dbg > 1) { }
58 42 0 if $Carp::Verbose
59 42 0 if $Carp::Verbose
67 12 0 if exists $INC{'Devel/Cover.pm'}
83 0 13 unless defined $dbd
85 4 9 unless grep(($_ eq $dbd), "DBI"->available_drivers)
90 0 9 if ($@)
91 0 0 unless $@ =~ /\binstall_driver\b/u
96 1 8 unless (eval { do { "DBIx::DBO::DBD"->_require_dbd_class($dbd) } })
97 0 1 if ($@ =~ m[^Can't locate ([\w/]+)\.pm in \@INC ]mu) { }
0 1 elsif ($@ =~ /^([\w:]+ version [\d\.]+ required.*?) at /mu) { }
1 0 elsif ($@ =~ /^(\Q$dbd_name\E is not yet supported)/mu) { }
117 1 7 if (exists $opt{'tempdir'})
120 0 1 if (ref $opt{'tempdir'}) { }
123 0 1 unless chdir $dir
131 0 8 if (exists $opt{'try_connect'})
135 2 6 if exists $opt{'try_connect'} or exists $opt{'connect_ok'}
137 1 7 unless exists $opt{'tests'}
140 2 5 if (exists $opt{'connect_ok'}) { }
141 0 2 unless my $dbo = connect_ok(@{$opt{"connect_ok"};})
156 0 0 if @bind
171 0 2 if (grep defined($_), @env)
172 0 0 if $$dbo_ref = connect_dbo(@env)
187 0 6 unless my $rv = $dbo->selectall_arrayref("SELECT * FROM $quoted_table")
205 1 0 $can{'auto_increment_id'} ? :
208 1 0 if ($dbo->do("CREATE TABLE $quoted_table ($quoted_cols[2] VARCHAR(20), $quoted_cols[1] INT, $quoted_cols[0] VARCHAR(8), PRIMARY KEY ($quoted_cols[0], $quoted_cols[1]))")) { }
216 0 1 unless is_deeply($t->{'PrimaryKeys'}, ["type", "id"], "Check PrimaryKeys")
220 0 1 unless $dbo->do("DROP TABLE $quoted_table") and $dbo->do($create_table) or diag(sql_err($dbo))
236 0 0 unless &ok(scalar $dbo->do($create_table), "Create the test table") or diag(sql_err($dbo))
246 0 1 unless $t
254 0 1 defined $test_sch ? :
258 0 1 unless $dbo->do("INSERT INTO $quoted_table VALUES (1, 'John Doe')")
259 0 1 unless $dbo->do("INSERT INTO $quoted_table VALUES (?, ?)", undef, 2, "Jane Smith")
263 0 1 unless @$rv = $dbo->selectrow_array("SELECT * FROM $quoted_table")
266 0 1 unless $rv = $dbo->selectrow_arrayref("SELECT * FROM $quoted_table")
273 0 1 unless $rv = $t->insert("id", 3, "name", "Uncle Arnie")
284 0 1 unless $rv = $t->insert($c, {"FUNC", 4}, "name", "NotUsed", "name", \"'James Bond'")
291 0 1 unless $rv = $t->delete("id", 3)
294 1 0 if ($can{'auto_increment_id'}) { }
295 0 1 unless $t->insert("name", "Vernon Lyon")
297 0 0 unless $t->insert("id", 5, "name", "Vernon Lyon")
301 0 1 unless $can{'auto_increment_id'}
302 0 1 unless &is(scalar $t->last_insert_id, 5, "Method DBIx::DBO::Table->last_insert_id")
308 1 0 unless ($can{'truncate'})
309 0 1 unless $t->delete
312 0 0 unless $t->truncate
319 0 1 unless $rv = $t->bulk_insert("rows", [map([@$_{"id", "name"}], @$bulk_data)])
322 0 1 unless $t->delete
324 0 1 unless $rv = $t->bulk_insert("rows", \@$bulk_data)
327 0 1 unless $t->delete
329 0 1 unless $rv = $t->bulk_insert("columns", ["name", "id"], "rows", [map([@$_{"name", "id"}], @$bulk_data)])
332 0 1 unless $t->delete
334 0 1 unless $rv = $t->bulk_insert("columns", ["name", "id"], "rows", \@$bulk_data)
346 0 1 unless $t
349 0 1 unless my $rv = $t->insert("id", {"FUNC", "? + 3", "VAL", 3}, "name", \"'Harry Harrelson'")
352 0 1 unless $t->insert("id", 7, "name", "Amanda Huggenkiss")
353 0 1 unless $t->insert("id", 8, "name", undef)
356 0 1 unless $rv = $t->delete("id", \"NOT NULL", "name", undef)
366 0 0 unless $t->insert("id", 6, "name", "Harry Harrelson")
367 0 0 unless $t->insert("id", 7, "name", "Amanda Huggenkiss")
388 0 1 unless &ok(scalar $r->load("id", [2, 3], "name", "Jane Smith"), "Method DBIx::DBO::Row->load")
397 0 1 unless &is(scalar $r->update("name", "Someone Else"), 1, "Method DBIx::DBO::Row->update")
398 0 1 unless is_deeply(\@$r, [2, "Someone Else"], "Row updated correctly (internal)")
399 0 1 unless $r->load("id", 2)
400 0 1 unless is_deeply(\@$r, [2, "Someone Else"], "Row updated correctly (external)")
402 0 1 unless $r->update("name", "Nobody", $t ** "name", "Anybody")
403 0 1 unless is_deeply(\@{$r->load("id", 2);}, [2, "Anybody"], "Row update removes duplicates")
407 0 1 unless $r->update("id", 3, "name", \"'Uncle Arnie'")
408 0 1 unless &ok(!$r->is_empty, "Row reloaded on update") or $r->load("id", [2, 3])
410 0 1 unless &ok(scalar $r->delete, "Method DBIx::DBO::Row->delete")
438 0 1 unless &ok(scalar $q->run, "Method DBIx::DBO::Query->run")
476 0 1 unless $q->run
488 0 1 unless &ok(scalar $q->where("name", "LIKE", \"'%o%'"), "Method DBIx::DBO::Query->where")
501 0 1 unless is_deeply($got, [4, 5, 6], "Method DBIx::DBO::Query->open_bracket")
507 0 1 unless &is(scalar $q->update("id", {"FUNC", "? + 10", "COL", "id"}), 3, "Method DBIx::DBO::Query->update")
528 0 1 unless &ok(scalar($q->group_by({"FUNC", "SUBSTR(?, 1, 1)", "COL", "name"}), $q->run), "Method DBIx::DBO::Query->group_by")
544 0 1 unless &is($r->{'key'}, 16, "Alias returns correct value")
545 0 1 unless &ok(scalar $r->update("id", $r->{'key'}), "Can update a Row despite using aliases")
546 0 1 unless &ok(scalar $r->load("id", 15), "Can load a Row despite using aliases")
571 0 1 unless $can{'collate'}
573 0 1 unless &ok(scalar $q->run, "Method DBIx::DBO::Query->order_by COLLATE")
577 0 1 unless &ok(scalar($q->run && $q->fetch->{'name'} eq 'JOHN DOE'), "Method DBIx::DBO::Query->show")
588 0 1 unless my $case_sensitive = $dbo->selectrow_arrayref($case_sensitivity_sql, undef, "a", "A")
590 0 1 $case_sensitive ? :
595 0 1 unless my $a = $q->col_arrayref
598 0 1 unless $a = $q->arrayref
601 0 1 unless $a = $q->hashref("id")
605 1 0 $dbd eq 'SQLite' ? :
607 1 0 $dbo->{'dbd_class'}->_alias_preference($q, 'having') ? :
645 0 1 unless &is(scalar $q->count_rows, 3, "Method DBIx::DBO::Query->count_rows")
646 0 1 unless &is(scalar $q->found_rows, 36, "Method DBIx::DBO::Query->found_rows")
656 0 1 if $dbd eq "Oracle"
658 0 0 unless $q->run or &fail("JOIN ON") or diag(sql_err($q))
659 0 1 unless $r = $q->fetch or &fail("JOIN ON")
662 0 1 unless $r->load($t1 ** "id", 2)
683 0 0 unless $q->run or diag(sql_err($q)) or &fail("LEFT JOIN")
684 0 1 unless $r = $q->fetch or &fail("LEFT JOIN")
692 1 0 unless $can{'multi_table_update'}
693 0 0 unless &ok(scalar $r->update($t1 ** "name", "Vernon Wayne Lyon"), "Method DBIx::DBO::Row->update")
714 0 1 unless $dbo->do($sql)
723 0 0 if (builtin::blessed($val) and not defined $var)
724 0 0 if ($val->isa('DBIx::DBO')) { }
0 0 elsif ($val->isa('DBIx::DBO::Table')) { }
0 0 elsif ($val->isa('DBIx::DBO::Query')) { }
0 0 elsif ($val->isa('DBIx::DBO::Row')) { }
739 0 0 if (ref $val)
742 0 0 if (builtin::reftype($val) eq 'ARRAY') { }
0 0 elsif (builtin::reftype($val) eq 'HASH') { }
0 0 elsif (builtin::reftype($val) eq 'REF') { }
747 0 0 defined wantarray ? :
752 0 0 unless ref $val
754 0 0 if $val == $_
758 0 0 if (builtin::blessed($val))
759 0 0 if ($val->isa('DBIx::DBO')) { }
0 0 elsif ($val->isa('DBIx::DBO::Table')) { }
0 0 elsif ($val->isa('DBIx::DBO::Query')) { }
0 0 elsif ($val->isa('DBIx::DBO::Row')) { }
765 0 0 unless $k =~ /^t\d+$/u
766 0 0 if $val == $v
779 0 0 if (builtin::reftype($val) eq 'ARRAY') { }
0 0 elsif (builtin::reftype($val) eq 'HASH') { }
0 0 elsif (builtin::reftype($val) eq 'REF') { }
797 2 10 if $table ne $Test::DBO::test_tbl
807 22 2 if $_[1] eq "DBI:Sponge:"