| 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
| |||||||||||||||||||||||||||||||||||||||||||
| 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
Condition33%2/6
$info and @$info == 1 and $info->[0][2] eq $table
$info and @$info == 1
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
| |||||||||||||||||||||||||||||||||||||||||||
| 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
| |||||||||||||||||||||||||||||||||||||||||||
| 32 | 0 | my $sql = 'LIMIT '; | |||||||||||||||||||||||||||||||||||||||||
| 33 | 0 | ▶ | $sql .= $h->{limit}[0] >= 0 ? $h->{limit}[0] : -1; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 34 | 0 | ▶ | $sql .= ' OFFSET '.$h->{limit}[1] if $h->{limit}[1]; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 35 | 0 | return $sql; | |||||||||||||||||||||||||||||||||||||||||
| 36 | } | ||||||||||||||||||||||||||||||||||||||||||
| 37 | |||||||||||||||||||||||||||||||||||||||||||
| 38 | 1 | 1; | |||||||||||||||||||||||||||||||||||||||||