in reply to Re: mod_perl ApacheDBI
in thread mod_perl ApacheDBI

Thanks for your answer. When i look at the error_log after enabling $Apache::DBI::DEBUG, i see that Apache DBI is always giving me the same handler with the default parameters parameters from my DBI Connect :

I use a Database object to encapsulate the call to DBI. Here is the constructor :

sub new {
my $pkg = shift;

my $user = $ENV{DB_USER} ;
my $password = $ENV{DB_PASSWORD} ;
my $dsn = $ENV{DB_DSN} ;
my $dbh = DBI->connect($dsn,$user, $password, { AutoCommit => 1, RaiseError => 1 } )||
die "ERROR NO_CONNECTION_TO_POSTMASTER\n";

my $obj = {_dbh => $dbh};

bless $obj, $pkg;

return $obj;

}

And all my other objects calls this contructor with :

my $db = new Database();

Then when i need to change autocommit parameters, i do a simple $db->{_dbh}->{AutoCommit} = 0;

What i can see is that i can't modify the database handlers pool from Apache::DBI, all i can do is modify my local copy.

Next time one of my object ask for the same DBI handler, i get the original with AutoCommit == 1;

Christophe