[Maypole] Direct access to DBI handle?

Toby Corkindale maypole@wintrmute.net
Thu, 9 Dec 2004 16:49:07 +0000


On Thu, Dec 09, 2004 at 11:33:27AM -0500, Jesse Sheidlower wrote:
> On Thu, Dec 09, 2004 at 04:12:29PM +0000, Toby Corkindale wrote:
> > On Thu, Dec 09, 2004 at 11:02:32AM -0500, Jesse Sheidlower wrote:
> > > On Thu, Dec 09, 2004 at 03:51:52PM +0000, Toby Corkindale wrote:
[snip]
> > > > A-S-Postgres requires one to pass the Handle => $dbh parameter, where
> > > > $dbh is the open DBI handle. How can I access that?  I've traced as
> > > > far as that ->loader will contain the Class::DBI::Loader object, which
> > > > is related, but I don't know how to obtain the DBI handle from it..
> > > 
> > > MyApp::MyClass->db_Main()
> > 
> > Thanks!
> > Unfortunately.. I had tried something like that, like so:
> > 
> > EHS::Diesel->setup($config->dsn, $config->dbuser, $config->dbpass,
> >                    { AutoCommit => 1,
> > 				     PrintError => 1
> > 				 });
> 
> Try wrapping the above in a BEGIN block, i.e.
> 
> BEGIN {
>  EHS::Diesel->setup($config->dsn, $config->dbuser, $config->dbpass,
>                     { AutoCommit => 1,
>                       PrintError => 1 });
> }

Thanks. I've just tried this, and unfortunately it didn't change the error
message.

I'm calling this in my base class, not the model classes - I've used the
db_Main() call in them successfully before.

Should I try using a dummy class, eg.
Handle => EHS::Diesel::Users->db_Main()
instead of EHS::Diesel->db_Main()? It seems like the "wrong thing" to do
though..

tjc.


-- 
Turning and turning in the widening gyre/The falcon cannot hear the falconer;
Things fall apart, the centre cannot hold/Mere anarchy is loosed upon the world
(gpg --keyserver www.co.uk.pgp.net --recv-key 897E5FF3)