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

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

From: Tim Bunce
Subject: Re: Class::DBI::Factory and Apache::DBI don't play nice
Date: 21:43 on 21 Nov 2004
On Sun, Nov 21, 2004 at 12:17:46PM +0000, Tony Bowden wrote:
> On Sat, Nov 20, 2004 at 10:12:01PM -0500, Perrin Harkins wrote:
> > Why is that?  Because the object index is class data but CDF is changing 
> > the database underneath?  Maybe we could incorporate a unique identifier 
> > for the database connection into the object index key.
> 
> 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.

> > The big issue with Apache::DBI and Ima::DBI is that Ima::DBI 
> > caches the handles in closures and doesn't go back to Apache::DBI when 
> > you ask for them again, so the cleanup handler with the automatic 
> > rollback for transactional databases doesn't get pushed onto the stack 
> > by Apache::DBI.
> 
> Any suggestions?

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:

http://search.cpan.org/~timb/DBI/Changes#Changes_in_DBI_1.40,_7th_January_2004

  Changed connect_cached() when running under Apache::DBI
    to route calls to Apache::DBI::connect().

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 21:43 on 21 Nov 2004

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