CC: | corwin [...] mpls.cx |
Subject: | Patch for possible bug with Class::DBI (SQLlite. Win32, Custom db_Main)) |
Howdy. Not sure this is actually a bug; quite willing to believe
there's just something I'm doing wrong here.
Found when using Class::DBI ($VERSION = qv('3.0.17');) under SQLite and
with a custom &db_Main.
Program works as expected however a warning is being issued:
Use of uninitialized value in lc at C:/Perl/site/lib/Class/DBI.pm line
196.
If there's something obvious that this warning should be pointing out to
me I would appreciate information in that regard. For the record,
here's my base-class:
package PicPac::DBI;
require PicPac;
use base 'Class::DBI';
__PACKAGE__->autoupdate( 1 );
our $db = PicPac::db_file(); # c:\picpac\my.db
my $dbh;
sub db_Main
{
unless ($dbh)
{
$dbh = DBI->connect_cached
(
"dbi:SQLite:dbname=$db", '', '',
{ __PACKAGE__->_default_attributes }
);
$dbh->do( 'PRAGMA foreign_keys = ON' );
}
return $dbh;
}
Meanwhile, here's a patch that resolved this for me (no more warning):
--- DBI.pm 2011-01-28 16:14:09.000000000 -0800
+++ my-DBI.pm 2011-01-28 16:15:47.000000000 -0800
@@ -198,7 +198,7 @@
ShowErrorStatement => 1,
AutoCommit => 1,
ChopBlanks => 1,
- %{ $Per_DB_Attr_Defaults{ lc $class->__driver }
|| {} },
+ %{ ($class->__driver && $Per_DB_Attr_Defaults{
lc $class->__driver }) || {} },
);
}
}