Re: [Maypole] Direct access to DBI handle?

From: Toby Corkindale (maypole at wintrmute.net)
Date: Thu Dec 09 2004 - 16:58:35 GMT


On Thu, Dec 09, 2004 at 04:49:07PM +0000, Toby Corkindale wrote:
> 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..

Note: Doing this seems to work, although it seems to be the "wrong" way to do
it?

Thanks all,
Toby

-- 
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)

_______________________________________________ maypole mailing list maypole at lists.netthink.co.uk http://lists.netthink.co.uk/listinfo/maypole



This archive was generated by hypermail 2.1.3 : Thu Feb 24 2005 - 22:25:57 GMT