thanks, jonathan.
that is (roughly) the approach i tried after sending my last mail,
package Vinq::RDBO::_mysql;
use base 'Rose::DB::Object';
use strict;
use warnings;
use Vinq::Globals qw($dbh);
use Vinq::RDB::MySQL;
our $MAKING_CLASSES = 0;
sub init_db {
my $_dbh = $dbh; # Global
if ($MAKING_CLASSES) {
## RDBO has trouble auto_initializing from Vinq::DB, so get
'pure' dbh
$dbh->_connect if $dbh->{connectionNeeded};
$_dbh = $dbh->{connectionHandle};
}
my $db = Vinq::RDB::MySQL->new(driver => 'mysql', dbh => $_dbh);
return $db;
}
1;
and then Vinq::RDBO::User (et al) isa Vinq::RDBO::_mysql. so far so
good!
On Feb 8, 2007, at 4:41 PM, Jonathan Vanasco wrote:
>
> On Feb 8, 2007, at 7:24 PM, Michael Reece wrote:
>
>> trying every which way to make Rose::DB::Object(s) always use my
>> custom global $dbh,
>>
>
> i have no idea why your package isn't working (i have a few ideas,
> but no time to test)
>
> i suggest trying this approach, which is essentially what i do:
>
> package Vinq::RDB::Object;
> use Vinq:: Globals ();
> use Vinq::RDB::MySQL ();
> use Rose::DB::Object ();
> use base qw(Rose::DB::Object);
>
> sub init_db {
> my $db= Vinq::RDB::MySQL->new();
> $db->dbh( $Vinq::Globals::dbh );
> return $db;
> };
>
> Then have objects inherit from Vinq::RDB::Object instead of
> Rose::DB::Object.
>
> My system is different, I keep a 'bad' dbh by default and stuff a
> valid dbh manually after i get a read/write/config dbh from a factory
> class.
>
> // Jonathan Vanasco
---
michael reece :: software engineer :: [EMAIL PROTECTED]
-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier.
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
Rose-db-object mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/rose-db-object