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:18 on 10 Mar 2005
> -----Original Message-----
> From: Perrin Harkins [mailto:perrin@xxxx.xxx]
> Sent: Thursday, March 10, 2005 2:49 PM
> To: Gianni, Andrew
> Cc: cdbi-talk@xxxxxx.xxxxx.xxx
> Subject: Re: dynamically defining base class for a CDBI table module
>=20
> On Thu, 2005-03-10 at 14:35 -0500, Gianni, Andrew wrote:
> > I have a number of schemas that contain tables that are accessed by
> > multiple applications. Rather than redefining the modules for each
> > application to use the CGIP base class for the project, I'd like to
be
> > able to define the CDBI table modules in a central location, but I
would
> > like to be able to dynamically have it set the appropriate base
class
>=20
> What are you trying to change by changing the base class?
>=20
> You may want to look at Class::DBI::Factory.

I think that'll do it.

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
The app will likely eventually run under mod_perl, in which case
Class::DBI::Factory looks perfect. In the meantime, however, can I
expect to take a significant performance hit by using
Class::DBI::Factory in a non-mod_perl environment? From the pod:

The factory object will do as little work and load as little machinery
as possible, but it's still a relatively expensive thing to build.

I'm guessing that the savings of not having to open multiple database
handles will outweigh the cost of using CDBI::F, but can someone speak
to this from experience?

Andrew

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

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