RE: dynamically defining base class for a CDBI table module

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

From: Gianni, Andrew
Subject: RE: dynamically defining base class for a CDBI table module
Date: 20:46 on 10 Mar 2005
> On Thu, 2005-03-10 at 15:18 -0500, Gianni, Andrew wrote:
> > For now, I just want to make sure I'm sharing the database handle
within
> > the application, which (I think) is usually done through the db_Main
> > method in the base class. Each transaction of the web application
can be
> > expected to make multiple calls to a number of tables across a
number of
> > schemas.
>=20
> Rather than change the base classes to connect to different databases,
> you can override db_Main and have it choose the right connection
> dynamically.  I think you'll find examples on the wiki.

Actually, I can access all of the tables with the same connection, but
there's a different base class for each schema, so each time I access a
table in a given schema for the first time. That said, I'd like to have
the ability to define a base class for each schema, because there are
times that I need to access them that way; when testing, for example,
I'd like to connect with the user that owns the schema.

That said, overriding db_Main may be the answer, but where would I
override it so it would apply to all of the modules I'm requiring. The
key is that I need all of the modules to inherit the same db_Main method
and its persistent dbh, but that method will vary by application.

RE: dynamically defining base class for a CDBI table module
Gianni, Andrew 20:46 on 10 Mar 2005

Generated at 08:54 on 14 Mar 2005 by mariachi v0.52