| 1 | package DBIO::SQLite::Adapter; | ||||||||||||||||||||||||||||
| 2 | # ABSTRACT: SQLite base->native type resolver | ||||||||||||||||||||||||||||
| 3 | |||||||||||||||||||||||||||||
| 4 | 196 | ▶ | use strict; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 5 | 196 | ▶ | use warnings; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 6 | 196 | ▶ | use Carp qw/croak/; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 7 | 196 | ▶ | use base 'DBIO::Adapter::Base'; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 8 | |||||||||||||||||||||||||||||
| 9 | 196 | my %NATIVE = ( | |||||||||||||||||||||||||||
| 10 | integer => 'INTEGER', | ||||||||||||||||||||||||||||
| 11 | text => 'TEXT', | ||||||||||||||||||||||||||||
| 12 | boolean => 'BOOLEAN', | ||||||||||||||||||||||||||||
| 13 | double => 'REAL', | ||||||||||||||||||||||||||||
| 14 | blob => 'BLOB', | ||||||||||||||||||||||||||||
| 15 | timestamp => 'TEXT', | ||||||||||||||||||||||||||||
| 16 | ); | ||||||||||||||||||||||||||||
| 17 | |||||||||||||||||||||||||||||
| 18 | 39286 | ▶ | sub to_native { | ||||||||||||||||||||||||||
|
Subroutine
to_native: called CC=7 SCAR=20.2
Pod
undocumented
| |||||||||||||||||||||||||||||
| 19 | 39286 | my ($self, $col) = @_; | |||||||||||||||||||||||||||
| 20 | 39286 | my $b = $col->{base_type}; | |||||||||||||||||||||||||||
| 21 | 39286 | ▶ | return 'CHAR(' . ($col->{size} // 255) . ')' if $b eq 'char'; | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition50%1/2
$col->{"size"} // 255
MC/DC0%0/1
$col->{"size"} // 255
$col->{"size"}
Truth table50%1/2
A
A= $col->{"size"}
| |||||||||||||||||||||||||||||
| 22 | 38614 | ▶ | if ($b eq 'numeric') { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 23 | 2 | my ($p, $s) = @{$col}{qw/precision scale/}; | |||||||||||||||||||||||||||
| 24 | 2 | ▶ | return (defined $p && defined $s) ? "NUMERIC($p,$s)" : 'NUMERIC'; | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
defined $p and defined $s
MC/DC0%0/2
defined $p and defined $s
defined $p
defined $s
Truth table33%1/3
A and B
A= defined $pB= defined $s
| |||||||||||||||||||||||||||||
| 25 | } | ||||||||||||||||||||||||||||
| 26 | 38612 | ▶ | return $NATIVE{$b} // croak "no SQLite native type for base '$b'"; | ||||||||||||||||||||||||||
|
Condition66%2/3
$NATIVE{$b} // croak("no SQLite native type for base '${b}'")
MC/DC0%0/2
$NATIVE{$b} // croak("no SQLite native type for base '${b}'")
$NATIVE{$b}
croak("no SQLite native type for base '${b}'")
Truth table33%1/3
A // B
A= $NATIVE{$b}B= croak("no SQLite native type for base '${b}'")
| |||||||||||||||||||||||||||||
| 27 | } | ||||||||||||||||||||||||||||
| 28 | |||||||||||||||||||||||||||||
| 29 | 1 | ▶ | sub capabilities { return { supports_alter_column_type => 0 } } | ||||||||||||||||||||||||||
|
Subroutine
capabilities: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||
| 30 | |||||||||||||||||||||||||||||
| 31 | 196 | 1; | |||||||||||||||||||||||||||
| 32 | |||||||||||||||||||||||||||||
| 33 | __END__ | ||||||||||||||||||||||||||||
| 34 | |||||||||||||||||||||||||||||
| 35 | =pod | ||||||||||||||||||||||||||||
| 36 | |||||||||||||||||||||||||||||
| 37 | =encoding UTF-8 | ||||||||||||||||||||||||||||
| 38 | |||||||||||||||||||||||||||||
| 39 | =head1 NAME | ||||||||||||||||||||||||||||
| 40 | |||||||||||||||||||||||||||||
| 41 | DBIO::SQLite::Adapter - SQLite base->native type resolver | ||||||||||||||||||||||||||||
| 42 | |||||||||||||||||||||||||||||
| 43 | =head1 VERSION | ||||||||||||||||||||||||||||
| 44 | |||||||||||||||||||||||||||||
| 45 | version 0.900001 | ||||||||||||||||||||||||||||
| 46 | |||||||||||||||||||||||||||||
| 47 | =head1 AUTHOR | ||||||||||||||||||||||||||||
| 48 | |||||||||||||||||||||||||||||
| 49 | DBIO & DBIx::Class Authors | ||||||||||||||||||||||||||||
| 50 | |||||||||||||||||||||||||||||
| 51 | =head1 COPYRIGHT AND LICENSE | ||||||||||||||||||||||||||||
| 52 | |||||||||||||||||||||||||||||
| 53 | Copyright (C) 2026 DBIO Authors | ||||||||||||||||||||||||||||
| 54 | Portions Copyright (C) 2005-2025 DBIx::Class Authors | ||||||||||||||||||||||||||||
| 55 | Based on DBIx::Class, heavily modified. | ||||||||||||||||||||||||||||
| 56 | |||||||||||||||||||||||||||||
| 57 | This is free software; you can redistribute it and/or modify it under | ||||||||||||||||||||||||||||
| 58 | the same terms as the Perl 5 programming language system itself. | ||||||||||||||||||||||||||||
| 59 | |||||||||||||||||||||||||||||
| 60 | =cut | ||||||||||||||||||||||||||||