Postgres and overriding db_Main
[prev]
[thread]
[next]
[Date index for 2005/07/21]
I just started using Perrin's code on the wiki for using Class::DBI
under mod_perl. Works great except that I noticed that when using
PostgreSQL, AutoCommit was turned On instead of the normal Class::DBI
default of turning AutoCommit Off for PostgreSQL.
It turns out that this is because a call to set_db sets an internal
accessor that tells Class::DBI which driver is being used, and this in
turn changes the values that _default_attributes returns. Since this
call to set_db doesn't happen anymore, _default_attributes does not
return the correct values.
So if you are using PostgreSQL (or Oracle) and you override db_Main
and don't call set_db, then you should call __driver directly and tell
it what driver you are using before you call _default_attributes.
__PACKAGE__->__driver('Pg');
my $db_options =3D { __PACKAGE__->_default_attributes };
Cheers,
Cees
|
Postgres and overriding db_Main
Cees Hek 13:56 on 21 Jul 2005
|