blib/lib/DBIx/DBO/DBD/SQLite.pm

filter: Statementstmt 85.1% 23 / 27 Branchbran 30.0% 3 / 10 Conditioncond 33.3% 2 / 6 MC/DCmcdc 0.0% 0 / 3 Subroutinesub 100% 8 / 8 Podpod n/a totaltotal 66.6% 36 / 54 CC 8 SCAR 14.8
CC
8
Cov
65%
_build_limit
9.3
_get_table_schema
4.9
BEGIN
2.1
CRAP 4.4
« blib/lib/DBIx/DBO/DBD/MariaDB.pm ↑ Summary blib/lib/DBIx/DBO/Table.pm »
1 1 ▶use 5.014;
Subroutine BEGIN: called CC=1 SCAR=0.0
2 1 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
3 1 ▶use DBD::SQLite 1.31;
Subroutine BEGIN: called CC=1 SCAR=0.0
4  
5 1 ▶BEGIN { die 'DBD::SQLite version 1.31 required (but not version 1.38_01)' if $DBD::SQLite::VERSION eq '1.38_01' }
Subroutine BEGIN: called CC=2 SCAR=7.6
Branch: 1 branch
BranchTrueFalseTotal
if $DBD::SQLite::VERSION eq "1.38_01" 0 1 1
6  
7 package # hide from PAUSE
8 DBIx::DBO::DBD::SQLite;
9 1 ▶use Carp 'croak';
Subroutine BEGIN: called CC=1 SCAR=0.0
10  
11 5 ▶sub _get_table_schema {
Subroutine _get_table_schema: called CC=4 SCAR=15.9
12 5 my($class, $me, $table) = @_;
13  
14 5 my $q_table = $table =~ s/([\\_%])/\\$1/gr;
15  
16 # Try just these types
17 5 my $info = $me->rdbh->table_info(undef, undef, $q_table,
18 'TABLE,VIEW,GLOBAL TEMPORARY,LOCAL TEMPORARY,SYSTEM TABLE', {Escape => '\\'})->fetchall_arrayref;
19 5 ▶ croak 'Invalid table: '.$class->_qi($me, $table) unless $info and @$info == 1 and $info->[0][2] eq $table;
Branch: 1 branch
BranchTrueFalseTotal
unless $info and @$info == 1 and $info->[0][2] eq $table 0 5 5
Condition33%2/6
$info and @$info == 1 and $info->[0][2] eq $table
!ll&&!rl&&r
005
$info and @$info == 1
!ll&&!rl&&r
005
MC/DC0%0/3
$info and @$info == 1 and $info->[0][2] eq $table
$info @$info == 1 $info->[0][2] eq $table
Truth table25%1/4
A and B and C
A= $infoB= @$info == 1C= $info->[0][2] eq $table
ABCresult
0XX0
10X0
1100
1111
20 5 return $info->[0][1];
21 }
22  
23 7 ▶sub _save_last_insert_id {
Subroutine _save_last_insert_id: called CC=1 SCAR=0.0
24 7 my($class, $me, $sth) = @_;
25 7 $sth->{Database}->last_insert_id(undef, @$me{qw(Schema Name)}, undef);
26 }
27  
28 39 ▶sub _build_limit {
Subroutine _build_limit: called CC=4 SCAR=22.3
29 39 my($class, $me) = @_;
30 39 my $h = $me->_build_data;
31 39 ▶ return '' unless defined $h->{limit};
Branch: 1 branch
BranchTrueFalseTotal
unless defined $h->{"limit"} 39 0 39
32 0 my $sql = 'LIMIT ';
33 0 ▶ $sql .= $h->{limit}[0] >= 0 ? $h->{limit}[0] : -1;
Branch: 1 branch
BranchTrueFalseTotal
$h->{'limit'}[0] >= 0 ? : 0 0 0
34 0 ▶ $sql .= ' OFFSET '.$h->{limit}[1] if $h->{limit}[1];
Branch: 1 branch
BranchTrueFalseTotal
if $h->{"limit"}[1] 0 0 0
35 0 return $sql;
36 }
37  
38 1 1;
« blib/lib/DBIx/DBO/DBD/MariaDB.pm ↑ Summary blib/lib/DBIx/DBO/Table.pm »