On 7/25/06 12:49 PM, "Sean Davis" <[EMAIL PROTECTED]> wrote:

> I have a set of classes and am finding that I need to do an explicit commit
> despite a Rose::DB subclass that is given below.  Is this a normal behavior,
> as from the docs, it appears that the AutoCommit should default to 1 and
> even with it set explicitly as below, it still requires a commit to get into
> the database?  I'm using the latest versions of DBI, DBD::Pg, RDBO and
> Rose::DB.
> 
> Thanks,
> Sean
> 
> package Spot::DB;
> use strict;
> use warnings;
> use Rose::DB;
> our @ISA = qw(Rose::DB);
> 
> Spot::DB->register_db(
>     domain    => 'development',
>     type      => 'main',
>     driver    => 'Pg',
>     database  => 'spot',
>     host      => 'localhost',
> );
> 
> __PACKAGE__->default_connect_options({AutoCommit=>1,
>                       RaiseError=>1,
>                       PrintError=>1,
>                       Warn      =>1,}
> );
> __PACKAGE__->default_domain('development');
> __PACKAGE__->default_type('main');

Just to follow up a bit:  this is the resulting dump of an object
instantiated from a Spot::DB:

  DB<2> x $pop->db 
0  Spot::DB::__RoseDBPrivate__::Rose::DB::Pg=HASH(0x1f20a24)
   '_dbh_refcount' => 1
   '_origin_class' => 'Spot::DB'
   'connect_options' => HASH(0x18a7a28)
      'AutoCommit' => 0
      'PrintError' => 1
      'RaiseError' => 1
      'Warn' => 1
   'connect_options_for' => HASH(0x1f20a78)
      'development' => HASH(0x1f20ac0)
         'main' => 1
   'database' => 'spot'
   'database_version' => undef
   'dbh' => DBI::db=HASH(0xf481c)
        empty hash
   'domain' => 'development'
   'driver' => 'pg'
   'dsn' => 'dbi:Pg:dbname=spot;host=sherlock.nci.nih.gov'
   'error' => undef
   'host' => 'sherlock.nci.nih.gov'
   'id' => "[EMAIL PROTECTED]"
   'password_closure' => CODE(0xe51c8)
      -> &Rose::DB::__ANON__[/Library/Perl/5.8.6/Rose/DB.pm:419] in
/Library/Perl/5.8.6/Rose/DB.pm:419-419
   'type' => 'main'
   'username' => 'sdavis'

Note that AutoCommit=>0.  If I explicitly set:

$pop->autocommit(1)

Then the connect_options hash looks like:

   'connect_options' => HASH(0x18a7a28)
      'AutoCommit' => 1
      'PrintError' => 1
      'RaiseError' => 1
      'Warn' => 1

This connect_options hash is what I would have expected given the
default_connection_options that I specified (and what is in the docs as the
default).  What am I missing?


-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys -- and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Rose-db-object mailing list
Rose-db-object@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/rose-db-object

Reply via email to