perl-embperl mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Terrence Brannon <metap...@urth.org>
Subject fixing the type info for DBD::SQLite
Date Fri, 28 Nov 2003 13:24:52 GMT
I posted this as a bug against DBD::SQLite. The test suite now passes 
for DBD::Pg. DBD::SQLite is failing because the bind types are not useable.

This program shows that DBD::SQLite returns unuseable 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";




---------------------------------------------------------------------
To unsubscribe, e-mail: embperl-unsubscribe@perl.apache.org
For additional commands, e-mail: embperl-help@perl.apache.org


Mime
View raw message