[CDBI] Re: Transaction over parent and children has_a objects

Perrin Harkins perrin at elem.com
Wed Apr 5 21:18:21 BST 2006


On Wed, 2006-04-05 at 10:39 -0500, Peter Speltz wrote:
> > What happens if you replace your call to $class->dbi_rollback with this:
> > $class->db_Main->rollback()
> >
> 
> Same thing. Figured it out though. When i removed an Ima::DBI patch i
> got from you in email it worked.

That's strange, because the patch is really pretty simple.  It works the
same as before, unless you change process IDs between calls to
db_Main().  It has been working well on a moderately large site where we
use transactions in the same way you're showing.

Are you overriding db_Main() in your base class?  One caveat here is
that I use Class::DBI 0.96, but since this is an Ima::DBI change, that
doesn't seem likely to be the problem.

> Now i have potential mod perl issues with Apache::DBI.  I've heard it
> should only  be an issue as long as you dont have any db connections
> made before apache forks at startup. That sound right?

That's the most common problem.  If you have any setup_table() calls,
they do make a connection during startup.

> Otherwise,
> the db_Main method on the wiki could work and i could load my modules
> at startup?

That works too.  I just thought this Ima::DBI approach was a lot
simpler, since it doesn't require you to change your code.

- Perrin





More information about the ClassDBI mailing list