| 1 | package DBIO::Firebird::Type; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2 | # ABSTRACT: Firebird type-system mapping (introspection + DDL directions) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4 | 43 | ▶ | use strict; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 5 | 43 | ▶ | use warnings; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 6 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 7 | 43 | our $VERSION = '0.900007'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 8 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 9 | 43 | ▶ | use Exporter 'import'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 10 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 11 | 43 | our @EXPORT_OK = qw(sql_type_from_rdb ddl_type_from_info render_size is_boolean_type is_binary_type is_numeric_type lob_kind); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 12 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 13 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 14 | # rdb$field_type number -> bare SQL type name (no size/precision; size is | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 15 | # carried separately in the introspected model). Numbers as the server stores | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 16 | # them in rdb$fields; the sub_type/charset-dependent ones (7/8/16/26 numeric | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 17 | # and decimal, 14/37 binary, 261 blob) are resolved in sql_type_from_rdb. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 18 | 43 | my %RDB_TYPE = ( | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 19 | 7 => 'smallint', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 20 | 8 => 'integer', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 21 | 9 => 'quad', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 22 | 10 => 'float', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 23 | 12 => 'date', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 24 | 13 => 'time', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 25 | 14 => 'char', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 26 | 16 => 'bigint', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 27 | 23 => 'boolean', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 28 | 24 => 'decfloat', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 29 | 26 => 'int128', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 30 | 27 => 'double precision', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 31 | 28 => 'time with time zone', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 32 | 29 => 'timestamp with time zone', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 33 | 35 => 'timestamp', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 34 | 37 => 'varchar', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 35 | 40 => 'cstring', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 36 | 261 => 'blob', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 37 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 38 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 39 | # Exact-number storage types; rdb$field_sub_type 1 = NUMERIC, 2 = DECIMAL, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 40 | # 0 = the plain integer type. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 41 | 43 | my %NUMERIC_STORAGE = map { $_ => 1 } (7, 8, 16, 26); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 42 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 43 | # rdb$character_set_id of OCTETS: CHAR/VARCHAR columns in it are BINARY/VARBINARY. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 44 | 43 | my $CHARSET_OCTETS = 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 45 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 46 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 47 | 30 | ▶ | sub sql_type_from_rdb { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
sql_type_from_rdb: called CC=15 SCAR=27.1
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 48 | 30 | my ($type_num, $sub_type, $charset_id) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 49 | 30 | ▶ | $type_num //= -1; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$type_num //= -1
MC/DC0%0/1
$type_num //= -1
$type_num
Truth table50%1/2
A
A= $type_num
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 50 | 30 | ▶ | $sub_type //= 0; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition100%2/2
$sub_type //= 0
MC/DC100%1/1
$sub_type //= 0
$sub_type
Truth table100%2/2
A
A= $sub_type
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 51 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 52 | 30 | ▶ | if ($NUMERIC_STORAGE{$type_num} && ($sub_type == 1 || $sub_type == 2)) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%6/6
$NUMERIC_STORAGE{$type_num} and $sub_type == 1 || $sub_type == 2
$sub_type == 1 or $sub_type == 2
MC/DC100%3/3
$NUMERIC_STORAGE{$type_num} and $sub_type == 1 || $sub_type == 2
$NUMERIC_STORAGE{$type_num}
$sub_type == 1
$sub_type == 2
Truth table100%4/4
A and B or C
A= $NUMERIC_STORAGE{$type_num}B= $sub_type == 1C= $sub_type == 2
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 53 | 4 | ▶ | return $sub_type == 1 ? 'numeric' : 'decimal'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 54 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 55 | 26 | ▶ | if ($type_num == 261) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 56 | 2 | ▶ | return $sub_type == 1 ? 'blob sub_type text' : 'blob'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 57 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 58 | 24 | ▶ | if (($type_num == 14 || $type_num == 37) && ($charset_id // -1) == $CHARSET_OCTETS) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%8/8
$type_num == 14 || $type_num == 37 and ($charset_id // -1) == $CHARSET_OCTETS
$type_num == 14 or $type_num == 37
$charset_id // -1
MC/DC100%3/3
$type_num == 14 || $type_num == 37 and ($charset_id // -1) == $CHARSET_OCTETS
$type_num == 14
$type_num == 37
$charset_id
Truth table100%5/5
A or B and C
A= $type_num == 14B= $type_num == 37C= $charset_id
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 59 | 2 | ▶ | return $type_num == 14 ? 'binary' : 'varbinary'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 60 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 61 | 22 | ▶ | return $RDB_TYPE{$type_num} // 'varchar'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition100%2/2
$RDB_TYPE{$type_num} // "varchar"
MC/DC100%1/1
$RDB_TYPE{$type_num} // "varchar"
$RDB_TYPE{$type_num}
Truth table100%2/2
A
A= $RDB_TYPE{$type_num}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 62 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 63 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 64 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 65 | 796 | ▶ | sub ddl_type_from_info { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
ddl_type_from_info: called CC=42 SCAR=37.5
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 66 | 796 | my ($info) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 67 | 796 | ▶ | my $type = lc($info->{data_type} // 'varchar'); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition100%2/2
$info->{"data_type"} // "varchar"
MC/DC100%1/1
$info->{"data_type"} // "varchar"
$info->{"data_type"}
Truth table100%2/2
A
A= $info->{"data_type"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 68 | 796 | my $size = $info->{size}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 69 | 796 | ▶ | return 'INTEGER' if $type eq 'integer' || $type eq 'int'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
$type eq "integer" or $type eq "int"
MC/DC100%2/2
$type eq "integer" or $type eq "int"
$type eq "integer"
$type eq "int"
Truth table100%3/3
A or B
A= $type eq "integer"B= $type eq "int"
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 70 | 404 | ▶ | return 'BIGINT' if $type eq 'bigint'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 71 | 382 | ▶ | return 'SMALLINT' if $type eq 'smallint' || $type eq 'tinyint'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
$type eq "smallint" or $type eq "tinyint"
MC/DC100%2/2
$type eq "smallint" or $type eq "tinyint"
$type eq "smallint"
$type eq "tinyint"
Truth table100%3/3
A or B
A= $type eq "smallint"B= $type eq "tinyint"
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 72 | 339 | ▶ | return 'BIGINT' if $type eq 'bigserial' || $type eq 'serial'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
$type eq "bigserial" or $type eq "serial"
MC/DC50%1/2
$type eq "bigserial" or $type eq "serial"
$type eq "bigserial"
$type eq "serial"
Truth table66%2/3
A or B
A= $type eq "bigserial"B= $type eq "serial"
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 73 | # the core canon: string without a size is text, with one it is VARCHAR(n) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 74 | 338 | ▶ | return defined $size ? 'VARCHAR' . render_size($size) : 'BLOB SUB_TYPE TEXT' if $type eq 'string'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 75 | 334 | ▶ | return 'VARCHAR' . (render_size($size) || '(255)') | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%8/8
$type eq "varchar" or $type eq "nvarchar" or $type eq "character varying"
$type eq "varchar" or $type eq "nvarchar"
render_size($size) || '(255)'
MC/DC100%3/3
$type eq "varchar" or $type eq "nvarchar" or $type eq "character varying"
$type eq "varchar"
$type eq "nvarchar"
$type eq "character varying"
MC/DC100%1/1
render_size($size) || '(255)'
render_size($size)
Truth table100%4/4
A or B or C
A= $type eq "varchar"B= $type eq "nvarchar"C= $type eq "character varying"
Truth table100%2/2
A
A= render_size($size)
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 76 | if $type eq 'varchar' || $type eq 'nvarchar' || $type eq 'character varying'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 77 | 243 | ▶ | return 'CHAR' . (render_size($size) || '(1)') if $type eq 'char' || $type eq 'nchar' || $type eq 'character'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%8/8
$type eq "char" or $type eq "nchar" or $type eq "character"
$type eq "char" or $type eq "nchar"
render_size($size) || '(1)'
MC/DC100%3/3
$type eq "char" or $type eq "nchar" or $type eq "character"
$type eq "char"
$type eq "nchar"
$type eq "character"
MC/DC100%1/1
render_size($size) || '(1)'
render_size($size)
Truth table100%4/4
A or B or C
A= $type eq "char"B= $type eq "nchar"C= $type eq "character"
Truth table100%2/2
A
A= render_size($size)
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 78 | 229 | ▶ | return 'BINARY' . (render_size($size) || '(1)') if $type eq 'binary'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition50%1/2
render_size($size) || '(1)'
MC/DC0%0/1
render_size($size) || '(1)'
render_size($size)
Truth table50%1/2
A
A= render_size($size)
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 79 | 225 | ▶ | return 'VARBINARY' . (render_size($size) || '(255)') if $type eq 'varbinary'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition50%1/2
render_size($size) || '(255)'
MC/DC0%0/1
render_size($size) || '(255)'
render_size($size)
Truth table50%1/2
A
A= render_size($size)
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 80 | 221 | ▶ | return 'BLOB' if $type eq 'bytea' || $type eq 'blob'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
$type eq "bytea" or $type eq "blob"
MC/DC50%1/2
$type eq "bytea" or $type eq "blob"
$type eq "bytea"
$type eq "blob"
Truth table66%2/3
A or B
A= $type eq "bytea"B= $type eq "blob"
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 81 | 201 | ▶ | return 'BLOB SUB_TYPE TEXT' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition83%10/12
$type eq "text" or $type eq "clob" or $type eq "long" or $type eq "mediumtext" or $type eq "longtext"
$type eq "text" or $type eq "clob" or $type eq "long" or $type eq "mediumtext"
$type eq "text" or $type eq "clob" or $type eq "long"
$type eq "text" or $type eq "clob"
MC/DC60%3/5
$type eq "text" or $type eq "clob" or $type eq "long" or $type eq "mediumtext" or $type eq "longtext"
$type eq "text"
$type eq "clob"
$type eq "long"
$type eq "mediumtext"
$type eq "longtext"
Truth table66%4/6
A or B or C or D or E
A= $type eq "text"B= $type eq "clob"C= $type eq "long"D= $type eq "mediumtext"E= $type eq "longtext"
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 82 | if $type eq 'text' || $type eq 'clob' || $type eq 'long' || $type eq 'mediumtext' || $type eq 'longtext'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 83 | 150 | ▶ | return 'DATE' if $type eq 'date'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 84 | 147 | ▶ | return 'TIMESTAMP' if $type eq 'datetime' || $type eq 'timestamp'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
$type eq "datetime" or $type eq "timestamp"
MC/DC100%2/2
$type eq "datetime" or $type eq "timestamp"
$type eq "datetime"
$type eq "timestamp"
Truth table100%3/3
A or B
A= $type eq "datetime"B= $type eq "timestamp"
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 85 | 134 | ▶ | return 'TIMESTAMP WITH TIME ZONE' if $type eq 'timestamptz'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 86 | 134 | ▶ | return 'DOUBLE PRECISION' if $type eq 'double precision' || $type eq 'double' || $type eq 'float' || $type eq 'real'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%9/9
$type eq "double precision" or $type eq "double" or $type eq "float" or $type eq "real"
$type eq "double precision" or $type eq "double" or $type eq "float"
$type eq "double precision" or $type eq "double"
MC/DC100%4/4
$type eq "double precision" or $type eq "double" or $type eq "float" or $type eq "real"
$type eq "double precision"
$type eq "double"
$type eq "float"
$type eq "real"
Truth table100%5/5
A or B or C or D
A= $type eq "double precision"B= $type eq "double"C= $type eq "float"D= $type eq "real"
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 87 | 71 | ▶ | return 'DECIMAL' . (render_size($size) || '(18,6)') if $type eq 'numeric' || $type eq 'decimal'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%5/5
$type eq "numeric" or $type eq "decimal"
render_size($size) || '(18,6)'
MC/DC100%2/2
$type eq "numeric" or $type eq "decimal"
$type eq "numeric"
$type eq "decimal"
MC/DC100%1/1
render_size($size) || '(18,6)'
render_size($size)
Truth table100%3/3
A or B
A= $type eq "numeric"B= $type eq "decimal"
Truth table100%2/2
A
A= render_size($size)
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 88 | 8 | ▶ | return 'BOOLEAN' if is_boolean_type($type); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 89 | 1 | return uc($type); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 90 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 91 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 92 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 93 | 520 | ▶ | sub is_boolean_type { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
is_boolean_type: called CC=3 SCAR=11.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 94 | 520 | my ($data_type) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 95 | 520 | ▶ | return 0 unless defined $data_type; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 96 | 508 | ▶ | return lc($data_type) =~ /\A(?:boolean|bool)\z/ ? 1 : 0; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 97 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 98 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 99 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 100 | 18 | ▶ | sub is_binary_type { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
is_binary_type: called CC=3 SCAR=11.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 101 | 18 | my ($data_type) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 102 | 18 | ▶ | return 0 unless defined $data_type; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 103 | 16 | ▶ | return ddl_type_from_info({ data_type => $data_type }) =~ /\A(?:BLOB\z|BINARY\b|VARBINARY\b)/ ? 1 : 0; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 104 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 105 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 106 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 107 | 362 | ▶ | sub is_numeric_type { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
is_numeric_type: called CC=3 SCAR=11.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 108 | 362 | my ($data_type) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 109 | 362 | ▶ | return 0 unless defined $data_type; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 110 | 356 | ▶ | return ddl_type_from_info({ data_type => $data_type }) =~ /\A(?:SMALLINT|INTEGER|BIGINT|DECIMAL|DOUBLE PRECISION)\b/ ? 1 : 0; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 111 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 112 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 113 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 114 | 54 | ▶ | sub lob_kind { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
lob_kind: called CC=4 SCAR=13.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 115 | 54 | my ($data_type, $size) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 116 | 54 | ▶ | return undef unless defined $data_type; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 117 | 54 | my $ddl = ddl_type_from_info({ data_type => $data_type, size => $size }); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 118 | 54 | ▶ | return $ddl eq 'BLOB SUB_TYPE TEXT' ? 'text' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 119 | : $ddl eq 'BLOB' ? 'binary' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 120 | : undef; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 121 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 122 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 123 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 124 | 419 | ▶ | sub render_size { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
render_size: called CC=3 SCAR=11.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 125 | 419 | my ($size) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 126 | 419 | ▶ | return '' unless defined $size; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 127 | 208 | ▶ | return "($size->[0],$size->[1])" if ref $size eq 'ARRAY'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 128 | 161 | return "($size)"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 129 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 130 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 131 | 43 | 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 132 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 133 | __END__ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||