[CDBI] "commit ineffective" and CDBI::Loader

[prev] [thread] [next] [Date index for 2005/10/28]

From: Bill Moseley
Subject: [CDBI] "commit ineffective" and CDBI::Loader
Date: 03:22 on 28 Oct 2005
The summary of the problem is CDBI::Loader is creating a db_Main for
every class instead of the more common db_Main in a base class.

This results in connect_cached() being called the first time each
class is accessed.  If this happens during a transaction then DBI's
AutoCommit can get turned back on -- and that causes the "commit
ineffective" message.

I'm not clear what happens in DBI -- seems like the commit still
happens.  Maybe that's DBD-specific, though.  I didn't look at that.


What's the best solution?  One option would be for Loader to create
db_Main in its super class -- but that breaks if more than one
connection is used.  Another option is for Loader to generate a unique
class and make all loaded classes inherit from that class.  But, that
doesn't work if some classes are not not created with Loader.

Really, what should happen is loader should be passed a base class and
use that.  That way classes that are not loaded by CDBI::Loader will
use the same db_Main method as the loaded classes.

Although there's "left_base_classes" and "additional_base_classes"
they are both arrays.  Should there be a "base_class" option?  And
what to do when there is no base class provided?

Again, this only happens the first time a class is accessed -- and
when in a transaction -- so it's not much of a problem it seems.

Maybe the solution is to stay away from Loader. ;)

        -- 
        Bill Moseley
moseley@xxxx.xxx


_______________________________________________
ClassDBI mailing list
ClassDBI@xxxxx.xxxxxxxxxxxxxxxx.xxx
http://lists.digitalcraftsmen.net/mailman/listinfo/classdbi

[CDBI] "commit ineffective" and CDBI::Loader
Bill Moseley 03:22 on 28 Oct 2005

Generated at 09:28 on 02 Nov 2005 by mariachi v0.52