Re: Class::DBI::Factory and Apache::DBI don't play nice

[prev] [thread] [next] [Date index for 2004/11/21]

From: Perrin Harkins
Subject: Re: Class::DBI::Factory and Apache::DBI don't play nice
Date: 22:00 on 21 Nov 2004
Tim Bunce wrote:
>>That would probably be useful. I have several sites with database
>>switching going on that I wouldn't be able to use the current code with.
> 
> 
> I can add that easily enough to my work-in-progres object index patch.
> Let me know.

Seems like a good idea to me.  With the other changes you made, it 
should also be easy for users to override the method that makes the key.

> If I understand the description then I think that's fixed.
> Ima::DBI 0.33 does:
> 
> sub _mk_db_closure {
>     my ($class, @connection) = @_;
>     my $dbh;
>     return sub {
> 	unless ($dbh && $dbh->FETCH('Active') && $dbh->ping) {
> 	    $dbh = DBI->connect_cached(@connection);
> 	}
> 	return $dbh;
>     };
> }
> 
> and since DBI 1.40 connect_cached() can use Apache::DBI::connect:

Unfortunately, that doesn't fix this problem.  The issue is that 
Apache::DBI doesn't push the cleanup handler for a particular request 
unless you call Apache::DBI::connect() during that request.  The closure 
that Ima::DBI makes never calls it if it has a valid handle cached. 
There are many ways to solve this, from adding an explicit call into 
Ima::DBI to restructuring Apche::DBI to make the cleanup handler logic 
more flexible.  There are easy workarounds too, like pushing the cleanup 
handler yourself at the start of each request.

- Perrin

(message missing)

Class::DBI::Factory and Apache::DBI don't play nice
Alexander =?iso-8859-1?Q?Gr=E4fe?= 21:34 on 19 Nov 2004

Re: Class::DBI::Factory and Apache::DBI don't play nice
Alexander =?iso-8859-1?Q?Gr=E4fe?= 22:35 on 19 Nov 2004

Re: Class::DBI::Factory and Apache::DBI don't play nice
Alexander =?iso-8859-1?Q?Gr=E4fe?= 08:13 on 20 Nov 2004

Re: Class::DBI::Factory and Apache::DBI don't play nice
Perrin Harkins 22:00 on 21 Nov 2004

Generated at 11:34 on 01 Dec 2004 by mariachi v0.52