| 1 | package Type::Guess::Role::SQL::SQLite; | ||||||||||||||||||||||||||||
| 2 | |||||||||||||||||||||||||||||
| 3 | 1 | ▶ | use Moo::Role; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 4 | |||||||||||||||||||||||||||||
| 5 | 11 | ▶ | sub to_sql { | ||||||||||||||||||||||||||
|
Subroutine
to_sql: called CC=7 SCAR=19.7
Pod
undocumented
| |||||||||||||||||||||||||||||
| 6 | 11 | my $self = shift; | |||||||||||||||||||||||||||
| 7 | 11 | ▶ | my $type = ref $self->type ? $self->type->name : $self->type; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 8 | 11 | ▶ | return "INTEGER" if $type eq "Int"; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 9 | 7 | ▶ | return "DATETIME" if $self->type eq 'DateTime'; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 10 | 7 | ▶ | return "FLOAT" if $type eq "Num"; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 11 | 5 | ▶ | return sprintf "VARCHAR(%d)", $self->length if $type eq "Str" && $self->length < 1024; | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
$type eq "Str" and $self->length < 1024
MC/DC50%1/2
$type eq "Str" and $self->length < 1024
$type eq "Str"
$self->length < 1024
Truth table66%2/3
A and B
A= $type eq "Str"B= $self->length < 1024
| |||||||||||||||||||||||||||||
| 12 | 1 | return "TEXT"; | |||||||||||||||||||||||||||
| 13 | } | ||||||||||||||||||||||||||||
| 14 | |||||||||||||||||||||||||||||
| 15 | 1 | 1; | |||||||||||||||||||||||||||
| 16 | |||||||||||||||||||||||||||||
| 17 | __DATA__ | ||||||||||||||||||||||||||||