[Maypole] Direct access to DBI handle?
Dave Howorth
dhoworth@mrc-lmb.cam.ac.uk
Thu, 09 Dec 2004 17:19:46 +0000
Toby Corkindale wrote:
>>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?
The DBI handle belongs (indirectly) to CDBI, which your model classes
inherit from; your main application class doesn't. Your main model class
or any of the subclasses should be OK, AFAIK. You can only access it
after the application class setup method has run, because that's what
initializes CDBI and sets up the inheritance path you want to use.
Cheers, Dave