On Thu, Apr 19, 2007 at 04:59:18PM -0400, John Siracusa wrote:
> The full DBI trace output is included below. I don't see multiple
> disconnects (or any disconnects, really) in the output, so I'm pretty
> sure it's only using one $dbh.
It's the Manager that seems to be closing the connection.
Perhaps I'm using it incorrectly?
[EMAIL PROTECTED]:~/dbi$ perl rose.pl
dbh = [DBI::db=HASH(0x8c92a88)]
dbh = [DBI::db=HASH(0x8c92a88)]
dbh = [DBI::db=HASH(0x8c92a88)]
Fetched all with manager
dbh = [DBI::db=HASH(0x8c92a88)]
dbh = [DBI::db=HASH(0x8c92a88)]
dbh = [DBI::db=HASH(0x8c92a88)]
dbh = [DBI::db=HASH(0x8c92a88)]
dbh = [DBI::db=HASH(0x8c92a88)]
Fetched all with second time manager
dbh = [DBI::db=HASH(0x8d52abc)]
dbh = [DBI::db=HASH(0x8d52abc)]
dbh = [DBI::db=HASH(0x8d52abc)]
dbh = [DBI::db=HASH(0x8d52abc)]
dbh = [DBI::db=HASH(0x8d52abc)]
delete() - execute on disconnected handle at
/usr/local/share/perl/5.8.8/Rose/DB/Object.pm line 1432.
at rose.pl line 45
[EMAIL PROTECTED]:~/dbi$ cat rose.pl
package A;
use base 'Rose::DB::Object';
__PACKAGE__->meta->setup(table => 't1', columns => [ qw(id a) ]);
our $DB;
sub init_db
{
my $dbh = DBI->connect_cached( 'dbi:Pg:dbname=test' );
return $DB = Rose::DB->new( driver => 'pg', dbh => $dbh ) unless($DB);
$DB->dbh($dbh);
return $DB;
}
package main;
use strict;
use Rose::DB::Object::Manager;
#DBI->trace(1);
my $o = A->new(id => 1, a => 5)->save;
show_dbh( $o );
my $o2 = A->new(id => 1)->load;
show_dbh( $o2 );
A->new( id => $_, a => $_ )->save for 2 .. 5;
my $o2 = A->new( id => 2)->load;
show_dbh( $o2 );
my $all = Rose::DB::Object::Manager->get_objects( object_class => 'A' );
print "Fetched all with manager\n";
show_dbh( $_ ) for @$all;
my $all = Rose::DB::Object::Manager->get_objects( object_class => 'A' );
print "Fetched all with second time manager\n";
show_dbh( $_ ) for @$all;
$o = undef;
$o2->delete;
sub show_dbh {
printf("dbh = [%s]\n", shift->dbh );
}
--
Bill Moseley
[EMAIL PROTECTED]
-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Rose-db-object mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/rose-db-object