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

Perrin Harkins perrin at elem.com
Thu Jan 11 19:23:55 GMT 2007


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





More information about the ClassDBI mailing list