Fellow DBIers,

This script reveals two issues, one with DBD::SQLite and one with the DBI itself:

#!/usr/bin/perl

use strict;

use DBI;
my $dbh = DBI->connect_cached('dbi:SQLite:dbname=test.db', {RaiseError => 1 });
$dbh->begin_work;
print "SQLite $dbh: $dbh->{AutoCommit}\n";
$dbh = DBI->connect_cached('dbi:SQLite:dbname=test.db', {RaiseError => 1 });
print "SQLite $dbh: $dbh->{AutoCommit}\n";


$dbh = DBI->connect_cached('dbi:Pg:dbname=testing', 'postgres', 'postgres',
{RaiseError => 1 });
$dbh->begin_work;
print "Pg $dbh: $dbh->{AutoCommit}\n";
$dbh = DBI->connect_cached('dbi:Pg:dbname=testing', 'postgres', 'postgres',
{RaiseError => 1 });
print "Pg $dbh: $dbh->{AutoCommit}\n";

The output is:

SQLite DBI::db=HASH(0x80a44c):
SQLite DBI::db=HASH(0x80843c): 1
Pg     DBI::db=HASH(0x85cc3c):
Pg     DBI::db=HASH(0x85cc3c): 1

The first two lines tell me that DBD::SQLite doesn't work properly with connect_cached().

The second two lines tell me that, somehow, connect_cached() is resetting AutoCommit. I wouldn't think that this should happen, but perhaps I'm wrong.

Am I wrong?

Many TIA,

David

Attachment: smime.p7s
Description: S/MIME cryptographic signature



Reply via email to