RE: dynamically defining base class for a CDBI table module

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

From: Gianni, Andrew
Subject: RE: dynamically defining base class for a CDBI table module
Date: 13:55 on 11 Mar 2005
> On Thu, 2005-03-10 at 16:35 -0500, Gianni, Andrew wrote:
> > Never mind, I think I figured it out. It's pretty simple actually; I
> > just need to update the ISA array for each table module that I
import to
> > point to the module that contains the db_Main that I want to use.
>=20
> You've totally lost me.  I thought you just said that you don't need
to
> use different database connections.  If that's the case, and your base
> classes don't define any additional methods, why are you switching
base
> classes?

The issue is that, by default, these tables will use the database
connections defined by their parent class (the schema owner's username
and password). But in a particular project, I want all tables to share a
single connection, owned by that particular project. My idea was that in
a given project, I would run a require on all the modules I need
(multiple tables across multiple schemas) and then redefine them as
sub-classes of the project's parent cdbi class, thus allowing them to
all share a single connection.

However, if this isn't going to work under mod_perl, that may be an
issue. It's looking more and more like Class::DBI::Factory is the
answer.

Andrew

RE: dynamically defining base class for a CDBI table module
Gianni, Andrew 13:55 on 11 Mar 2005

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