Subject: | column_info doesn't parse sizes with spaces |
Date: | Sun, 19 Jun 2016 22:10:26 +0100 |
To: | bug-DBD-SQLite [...] rt.cpan.org |
From: | ilmari [...] ilmari.org (Dagfinn Ilmari Mannsåker) |
Column type specifications like 'varchar( 10 )' or 'decimal(5, 3)' don't
get parsed correctly into the size and decimal digits fields:
Show quoted text
0> my $dbh = DBI->connect('dbi:SQLite:')
$res[0] = bless( {}, 'DBI::db' )
Show quoted text1> $dbh->do('create table test ( foo varchar(10), bar varchar( 15 ), baz decimal(3,3), bat decimal(4, 4))')
$res[1] = '0E0'
Show quoted text2> +{ map +($_->{COLUMN_NAME} => { $_->%{qw(TYPE_NAME COLUMN_SIZE DECIMAL_DIGITS)} }), $dbh->column_info(undef, undef, 'test', '%')->fetchall_arrayref({})->@* }
$res[2] = {
'bar' => {
'COLUMN_SIZE' => undef,
'DECIMAL_DIGITS' => undef,
'TYPE_NAME' => 'varchar( 15 )'
},
'bat' => {
'COLUMN_SIZE' => undef,
'DECIMAL_DIGITS' => undef,
'TYPE_NAME' => 'decimal(4, 4)'
},
'baz' => {
'COLUMN_SIZE' => '3',
'DECIMAL_DIGITS' => '3',
'TYPE_NAME' => 'decimal'
},
'foo' => {
'COLUMN_SIZE' => '10',
'DECIMAL_DIGITS' => undef,
'TYPE_NAME' => 'varchar'
}
}
--
"The surreality of the universe tends towards a maximum" -- Skud's Law
"Never formulate a law or axiom that you're not prepared to live with
the consequences of." -- Skud's Meta-Law