Re: Pass a DBI Object?

[prev] [thread] [next] [Date index for 2004/08/18]

From: Branislav Zahradnik
Subject: Re: Pass a DBI Object?
Date: 15:04 on 18 Aug 2004
Brian E. Lozier wrote:
> Is there a way to pass an already-existing DBH to Class::DBI instead of  
> using its connection() method?
> 
> Thanks,
> Brian
> 

... try this

package My::Class::DBI::Project;

our $dbh;

sub db_Main { $dbh; }

...

package main;

$My::Class::DBI::Project::dbh = $my_dbh;

----------

Explanation:
   connection method calls Ima::DBI's method set_db with first parameter 
'Main'. It creates method db_Main, witch should return some db handler.

So, if you provides your own db_Main method, you can use your own dbh.
(this is neccessary e.g. if you want handle broken db connection without 
restarting your application)

In my opinion, this is great disadvantage of Class::DBI.

By,

Barney

(message missing)

Method Names (was: Stolen Ideas)
Jay Strauss 14:20 on 11 Aug 2004

Re: Method Names (was: Stolen Ideas)
Tony Bowden 22:14 on 11 Aug 2004

Re: Method Names (was: Stolen Ideas)
Jay Strauss 15:04 on 12 Aug 2004

Re: Method Names (was: Stolen Ideas)
Tony Bowden 15:54 on 12 Aug 2004

Re: Method Names (was: Stolen Ideas)
Jay Strauss 15:11 on 13 Aug 2004

Re: Method Names (was: Stolen Ideas)
Jay Strauss 16:35 on 14 Aug 2004

Pass a DBI Object?
Brian E. Lozier 18:22 on 14 Aug 2004

Re: Method Names (was: Stolen Ideas)
Tim Bunce 11:54 on 18 Aug 2004

Re: Pass a DBI Object?
Branislav Zahradnik 15:04 on 18 Aug 2004

Generated at 11:34 on 01 Dec 2004 by mariachi v0.52