[CDBI] Class::DBI with multiple db connections
Sk8board Kid
sk8boardkid at gmail.com
Thu Jan 11 16:42:10 GMT 2007
i'm trying to use Class::DBI with several db connections, but i'm
finding that i have to alter the set_db() method from:
sub set_db {
my ($class, $db_name, $data_source, $user, $password, $attr) = @_;
# 'dbi:Pg:dbname=foo' we want 'Pg'. I think this is enough.
my ($driver) = $data_source =~ /^dbi:(\w+)/i;
$class->__driver($driver);
$class->SUPER::set_db('Main', $data_source, $user, $password, $attr);
}
to:
sub set_db {
my ($class, $db_name, $data_source, $user, $password, $attr) = @_;
# 'dbi:Pg:dbname=foo' we want 'Pg'. I think this is enough.
my ($driver) = $data_source =~ /^dbi:(\w+)/i;
$class->__driver($driver);
$class->SUPER::set_db($db_name, $data_source, $user, $password, $attr);
}
for it to work correctly. With this mod i can then use set_sql() with
a handle name and it all works.
I'm I missing something here?
More information about the ClassDBI
mailing list