| 1 | package DBIO::SQLite::Adapter; | ||||||||||||||||||||||||||||
| 2 | # ABSTRACT: SQLite base->native type resolver | ||||||||||||||||||||||||||||
| 3 | |||||||||||||||||||||||||||||
| 4 | 191 | ▶ | use strict; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 5 | 191 | ▶ | use warnings; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 6 | |||||||||||||||||||||||||||||
| 7 | 191 | our $VERSION = '0.900007'; | |||||||||||||||||||||||||||
| 8 | |||||||||||||||||||||||||||||
| 9 | 191 | ▶ | use Carp qw/croak/; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 10 | 191 | ▶ | use base 'DBIO::Adapter::Base'; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 11 | |||||||||||||||||||||||||||||
| 12 | 191 | my %NATIVE = ( | |||||||||||||||||||||||||||
| 13 | integer => 'INTEGER', | ||||||||||||||||||||||||||||
| 14 | text => 'TEXT', | ||||||||||||||||||||||||||||
| 15 | boolean => 'BOOLEAN', | ||||||||||||||||||||||||||||
| 16 | double => 'REAL', | ||||||||||||||||||||||||||||
| 17 | blob => 'BLOB', | ||||||||||||||||||||||||||||
| 18 | timestamp => 'TEXT', | ||||||||||||||||||||||||||||
| 19 | ); | ||||||||||||||||||||||||||||
| 20 | |||||||||||||||||||||||||||||
| 21 | 42511 | ▶ | sub to_native { | ||||||||||||||||||||||||||
|
Subroutine
to_native: called CC=7 SCAR=19.5
Pod
documented
| |||||||||||||||||||||||||||||
| 22 | 42511 | my ($self, $col) = @_; | |||||||||||||||||||||||||||
| 23 | 42511 | my $b = $col->{base_type}; | |||||||||||||||||||||||||||
| 24 | 42511 | ▶ | return 'CHAR(' . ($col->{size} // 255) . ')' if $b eq 'char'; | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%2/2
$col->{"size"} // 255
MC/DC100%1/1
$col->{"size"} // 255
$col->{"size"}
Truth table100%2/2
A
A= $col->{"size"}
| |||||||||||||||||||||||||||||
| 25 | 41795 | ▶ | if ($b eq 'numeric') { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 26 | 9 | my ($p, $s) = @{$col}{qw/precision scale/}; | |||||||||||||||||||||||||||
| 27 | 9 | ▶ | return (defined $p && defined $s) ? "NUMERIC($p,$s)" : 'NUMERIC'; | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
defined $p and defined $s
MC/DC50%1/2
defined $p and defined $s
defined $p
defined $s
Truth table66%2/3
A and B
A= defined $pB= defined $s
| |||||||||||||||||||||||||||||
| 28 | } | ||||||||||||||||||||||||||||
| 29 | 41786 | ▶ | return $NATIVE{$b} // croak "no SQLite native type for base '$b'"; | ||||||||||||||||||||||||||
|
Condition100%2/2
$NATIVE{$b} // croak("no SQLite native type for base '${b}'")
MC/DC0%0/1
$NATIVE{$b} // croak("no SQLite native type for base '${b}'")
$NATIVE{$b}
Truth table50%1/2
A
A= $NATIVE{$b}
| |||||||||||||||||||||||||||||
| 30 | } | ||||||||||||||||||||||||||||
| 31 | |||||||||||||||||||||||||||||
| 32 | 1 | ▶ | sub capabilities { return { supports_alter_column_type => 0 } } | ||||||||||||||||||||||||||
|
Subroutine
capabilities: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||
| 33 | |||||||||||||||||||||||||||||
| 34 | 191 | 1; | |||||||||||||||||||||||||||
| 35 | |||||||||||||||||||||||||||||
| 36 | __END__ | ||||||||||||||||||||||||||||