Branch Coverage

blib/lib/RDF/Trine/Store/DBI.pm
Criterion Covered Total %
branch 204 282 72.3


line true false branch
132 9 2 if (scalar @_ == 0) { }
1 1 elsif (&blessed($_[0]) and $_[0]->isa('DBI::db')) { }
0 1 elsif (&blessed($_[0]) and $_[0]->isa('DBIx::Connector')) { }
141 0 1 if ($name eq 'MySQL') { }
0 1 elsif ($name eq 'PostgreSQL') { }
1 0 elsif ($name eq 'SQLite') { }
154 0 1 if ($dsn =~ /^DBI:mysql:/i) { }
0 1 elsif ($dsn =~ /^DBI:Pg:/i) { }
1 0 elsif ($dsn =~ /^DBI:SQLite:/i) { }
165 0 1 unless ($conn)
200 0 0 unless &blessed($obj) and $obj->isa('DBI::db')
220 0 0 unless ($dbh->do("DROP TABLE Statements$id;"))
221 0 0 unless ($dbh->do("DELETE FROM Models WHERE ID = $id"))
280 63 18 if (scalar @_ >= 4)
284 4 59 if (&blessed($g) and not $g->is_variable)
295 83 169 defined $_ ? :
296 44 10 defined $_ ? :
63 18 $use_quad ? :
302 63 18 $use_quad ? :
304 2 79 if &blessed($context) and $context->is_variable
313 72 591 unless defined $row
316 504 87 $use_quad ? :
318 1933 344 if ($node->is_variable) { }
324 158 1775 if ($row->{$node} == 0) { }
1704 71 elsif (defined(my $u = $row->{$uri})) { }
29 42 elsif (defined(my $n = $row->{$name})) { }
42 0 elsif (defined(my $v = $row->{$value})) { }
345 87 504 @triple == 3 ? :
376 19 20 if (my $o = $args{'orderby'})
380 3 27 unless ($dir =~ /^(ASC|DESC)$/)
398 32 78 unless $row
405 80 84 if (defined(my $u = $row->{$uri})) { }
20 64 elsif (defined(my $n = $row->{$name})) { }
48 16 elsif (defined(my $v = $row->{$value})) { }
424 16 20 if (my $o = $args{'orderby'})
428 23 4 if (exists $vars{$col})
454 0 8 unless defined $row
459 2 6 if ($row->{$ctx} == 0) { }
6 0 elsif ($row->{$uri}) { }
0 0 elsif ($row->{$name}) { }
0 0 elsif (defined $row->{$value}) { }
494 200 97 if ($stmt->isa('RDF::Trine::Statement::Quad')) { }
495 2 198 if (&blessed($context))
500 8 89 $context ? :
505 283 12 unless ($sth->fetch)
525 0 246 unless (&blessed($stmt))
529 178 68 if ($stmt->isa('RDF::Trine::Statement::Quad')) { }
530 2 176 if (&blessed($context))
535 8 60 if (&blessed($context)) { }
568 14 34 if (defined $node)
575 12 0 $where ? :
589 10 1089 if $node->is_nil
590 18 1071 if ($node->is_blank) { }
1039 32 elsif ($node->is_resource) { }
32 0 elsif ($node->isa('RDF::Trine::Node::Literal')) { }
602 10 22 if ($node->has_language) { }
8 14 elsif ($node->has_datatype) { }
615 73 1016 unless ($sth->fetch)
637 149 40 if (scalar @_ >= 4)
641 24 125 if (&blessed($g) and not $g->is_variable)
652 104 492 defined $_ ? :
653 13 107 defined $_ ? :
149 40 $use_quad ? :
656 149 40 $use_quad ? :
657 149 40 $use_quad ? :
713 12 11 unless $r->{'literal'}
714 23 0 unless $r->{'resource'}
715 19 4 unless $r->{'blank'}
752 0 889 unless ($col)
761 889 0 if $select_vars{$var}
766 666 2001 if ($context->{'restrict'}{$var}{$type}) { }
779 0 3183 if ($where->[$i] =~ /\b$column_alias_name\b/)
789 0 929 if $from->[$i] =~ /^[()]$/
792 889 40 if ($alias eq $col_table)
795 666 2001 if $context->{'restrict'}{$var}{$type}
798 0 2001 if $seen_joins{$valias}++
812 441 448 if ($restricted)
837 0 310 if ($p->isa('RDF::Query::Algebra::Union')) { }
841 0 310 if (@disjunction) { }
845 0 0 if ($pvars ne $variables)
862 310 0 if ($self->can($method)) { }
890 81 229 $args{'unique'} ? :
893 4 306 unless (@cols)
899 21 0 if $from_clause and $from_clause =~ /[^(]$/ and not $f =~ /^([)]|LEFT JOIN)/
903 177 133 @$where ? :
906 149 161 if ($args{'count'})
909 40 270 if ($args{'count-distinct'})
912 149 161 if ($args{'count'})
916 121 189 $unique ? :
924 16 294 if (my $o = $args{'orderby'})
928 23 4 if (exists $vars->{$col})
932 12 4 if (@sort)
941 40 270 if ($args{'count-distinct'})
988 0 0 if ($expr->isa('RDF::Query::Expression::Function')) { }
0 0 elsif ($expr->isa('RDF::Query::Expression::Binary')) { }
991 0 0 if ($func eq 'sparql:isliteral' and &blessed($args[0]) and $args[0]->isa('RDF::Trine::Node::Variable')) { }
0 0 elsif ($func =~ qr/^sparql:is[iu]ri$/ and &blessed($args[0]) and $args[0]->isa('RDF::Trine::Node::Variable')) { }
0 0 elsif ($func =~ qr/^sparql:isblank$/ and &blessed($args[0]) and $args[0]->isa('RDF::Trine::Node::Variable')) { }
0 0 elsif ($func eq 'sparql:logical-or') { }
1006 0 0 if ($expr->op eq '==') { }
1043 0 0 if ($e->isa('RDF::Query::Expression::Function') and $e->uri->uri_value eq 'sparql:logical-or') { }
1061 0 0 unless ($sorted[0]->isa('RDF::Trine::Node::Variable'))
1064 0 0 unless ($sorted[1]->isa('RDF::Trine::Node') and not $sorted[1]->isa('RDF::Trine::Node::Variable'))
1071 0 0 if (my $existing_col = _get_var($context, $name)) { }
1095 0 331 defined $self->{'restrictions'} ? :
1100 58 273 if ($args{'semantics'} eq 'triple')
1103 224 107 $quad ? :
1112 0 1217 unless defined $node
1115 907 310 if ($node->isa('RDF::Trine::Node::Variable'))
1121 107 224 unless ($quad)
1122 2 105 if (defined $ctx) { }
0 105 elsif ($self->{'join_context_nodes'}) { }
1135 907 312 if ($node->isa('RDF::Trine::Node::Variable')) { }
249 63 elsif ($node->isa('RDF::Trine::Node::Resource')) { }
18 45 elsif ($node->isa('RDF::Trine::Node::Blank')) { }
33 12 elsif ($node->isa('RDF::Trine::Node::Literal')) { }
12 0 elsif ($node->is_nil) { }
1137 18 889 if (my $existing_col = _get_var($context, $name)) { }
1185 0 0 unless scalar @patterns
1203 0 0 if (ref $_[0])
1224 0 68 'RDF::Trine::XS'->can('hash') ? :
1243 0 2389 unless &blessed($node)
1244 72 2317 if $node->is_nil
1247 2194 123 if ($node->isa('RDF::Trine::Node::Resource')) { }
44 79 elsif ($node->isa('RDF::Trine::Node::Blank')) { }
79 0 elsif ($node->isa('RDF::Trine::Node::Literal')) { }
1255 0 79 unless (defined $value)
1352 2113 108 if (my $conn = $self->{'conn'}) { }
1389 11 6 unless ($self->_table_exists('Literals'))
1390 0 11 unless ($dbh->do("\t\t\tCREATE TABLE Literals (\n\t\t\t\tID NUMERIC(20) PRIMARY KEY,\n\t\t\t\tValue text NOT NULL,\n\t\t\t\tLanguage text NOT NULL DEFAULT '',\n\t\t\t\tDatatype text NOT NULL DEFAULT ''\n\t\t\t);\n"))
1398 0 11 unless ($dbh->do("\t\t\tCREATE TABLE Resources (\n\t\t\t\tID NUMERIC(20) PRIMARY KEY,\n\t\t\t\tURI text NOT NULL\n\t\t\t);\n"))
1404 0 11 unless ($dbh->do("\t\t\tCREATE TABLE Bnodes (\n\t\t\t\tID NUMERIC(20) PRIMARY KEY,\n\t\t\t\tName text NOT NULL\n\t\t\t);\n"))
1410 0 11 unless ($dbh->do("\t\t\tCREATE TABLE Models (\n\t\t\t\tID NUMERIC(20) PRIMARY KEY,\n\t\t\t\tName text NOT NULL\n\t\t\t);\n"))
1417 0 11 unless $dbh->commit
1420 11 6 unless ($self->_table_exists("Statements$id"))
1421 0 11 unless ($dbh->do("\t\t\tCREATE TABLE Statements$id (\n\t\t\t\tSubject NUMERIC(20) NOT NULL,\n\t\t\t\tPredicate NUMERIC(20) NOT NULL,\n\t\t\t\tObject NUMERIC(20) NOT NULL,\n\t\t\t\tContext NUMERIC(20) NOT NULL DEFAULT 0,\n\t\t\t\tPRIMARY KEY (Subject, Predicate, Object, Context)\n\t\t\t);\n"))
1443 29 22 ref $row ? :
1448 10 0 if (my $dbh = $self->dbh)
1451 2 8 if ($self->{'remove_store'})
1467 7 150 unless ($dbh->{'AutoCommit'})
1476 0 10 if ($IGNORE_CLEANUP) { }