Re: [CDBI] Re: Class::DBI with multiple db connections

Perrin Harkins <[email protected]>
Newsgroups gmane.comp.lang.perl.modules.class-dbi
Message-ID <[email protected]>
On Thu, 2007-01-11 at 13:58 -0500, Edward J. Sabol wrote:
> > [Am] I missing something here?
> 
> Class::DBI forces the Ima::DBI database connection name to be "Main". This
> was an intentional design decision to simplify the API.

Yes.  To get multiple database support for my project, I set them all up
with set_db() calls (to the Ima::DBI::set_db, not the Class::DBI version
that forces the db_name) and override db_Main() in my base class to call
the correct database handle method for the database I want.  The method
is called 'db_' . $db_name.

> If you do override this design decision to enable multiple database
> connections, I think you will need to turn off the object index

Yes, you will.

- Perrin
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.