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

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

From: Tim Bunce
Subject: Re: Class::DBI::Factory and Apache::DBI don't play nice
Date: 13:56 on 22 Nov 2004
On Sun, Nov 21, 2004 at 05:00:20PM -0500, Perrin Harkins wrote:
> 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.

Yes. Given that there's no need for any more explicit support.

> >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. 

Ah, okay.

> 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.

Seems like Apache::DBI should have a way for applications to say (once)
"Please setup Apache such that cleanup handler gets called for every request".

Tim.

(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
Tim Bunce 13:56 on 22 Nov 2004

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