I posted this as a bug against DBD::SQLite but haven't heard back. I would be happy to fix this myself

This program shows that DBD::SQLite returns unusual type info. I would
appreciate any pointers on where to go to fix this. It looks like one
just needs to write a mapper of some sort:

my %type_conv =
 ( 'CHAR' => 1,
   'INT'  => 4
  );

But the problem is figuring out how DBD::SQLite services the
$sth->FETCH('TYPE') call from DBI.

       ~/hacks/dbirs $ perl tryselect.pl sqlite
INT CHAR(20) INT CHAR(20) at tryselect.pl line 26.

       ~/hacks/dbirs $ perl tryselect.pl pg
4 1 4 1 at tryselect.pl line 26.

       ~/hacks/dbirs $ cat tryselect.pl
use DBI;
use DBD::SQLite;

my %dsn =
 (
  sqlite => 'dbi:SQLite:test.db',
  pg     => 'dbi:Pg:dbname=test'
 )
 ;

my $dsn_key = shift or die 'must supply dsn key';

my $dsn = $dsn{$dsn_key} or die "$dsn_key not found";

my $dbh = DBI->connect
 ($dsn, undef, undef, { RaiseError => 1 } );

my $tbl = 'dbixrs1';
my $sql = "SELECT * FROM $tbl WHERE 1=0"  ;

$sth = $dbh->prepare($sql);
$sth->execute;

my $type = $sth->FETCH('TYPE');

warn "@$type";






Reply via email to