Re: wiki confusion about db_Main
[prev]
[thread]
[next]
[Date index for 2005/03/08]
On Mon, 07 Mar 2005, John Beppu wrote:
> > Don't you have to have written a db_Main method in your class that
> > subclasses Class::DBI, as per the man page, for this to work? I don't
> > think Class::DBI has a db_Main method. It only uses it if it exists.
> Class::DBI inherits from Ima::DBI and
> Ima::DBI will create a db_Main method when you call set_db().
I just noticed that in the Ima::DBI docs.
Foo->set_db($db_name, $data_source, $user, $password);
Foo->set_db($db_name, $data_source, $user, $password, \%attr);
This method is used in place of DBI->connect to create your database
handles. It sets up a new DBI database handle associated to $db_name.
All other arguments are passed through to DBI->connect_cached.
A new method is created for each db you setup. This new method is called
"db_$db_name"... so, for example, Foo->set_db("foo", ...) will create
a method called "db_foo()". (Spaces in $db_name will be translated into
underscores: '_')
I will just replace my question with your note on the wiki.
Thanks for setting me straight.
--
Greg Matheson, Taiwan
|
|
Re: wiki confusion about db_Main
Greg Matheson 01:38 on 08 Mar 2005
|