Re: CDBI::Loader::Pg

[prev] [thread] [next] [Date index for 2004/12/28]

From: Sean Davis
Subject: Re: CDBI::Loader::Pg
Date: 22:09 on 28 Dec 2004
Simon,

Does this work for Class::DBI::Loader(s)?

In any case, this is what I am doing after READING the manual more 
closely:

use Class::DBI::Loader;

my $loader = Class::DBI::Loader->new(
     dsn                  => 'dbi:Pg:dbname=sardb',
     user                 => 'xxxxx',
     password             => 'xxxxx',
				     );
my $class = $loader->find_class('users');
my %stuff = (username    => 'sdavis',
	     first_name   => 'Sean',
	     last_name    => 'Davis',
	     password     => 'p4ssword',
	    );
$class->db_Main->{AutoCommit}=1;  #turn on autocommit (could be done 
locally)
my $obj   = $class->create(\%stuff);
$obj->commit;
my $newobj = $class->retrieve(1);
print "";

Sean

On Dec 28, 2004, at 4:56 PM, Simon Flack wrote:

> Sean Davis wrote:
>> In answer to my own question, I see that I need to call dbi_commit() 
>> if I have AUTOCOMMIT off (which it is by default in Pg).  Is there a 
>> way to pass the AUTOCOMMIT parameter to DBI using CDBI::Loader?
>
> __PACKAGE__->connection($dsn, $user, $pass, {AutoCommit => 1});
>
> AutoCommit is enabled by default unless the driver is Oracle or Pg.
>
> --simonflk
>
>> Thanks,
>> Sean
>> On Dec 28, 2004, at 4:46 PM, Sean Davis wrote:
>>> I am interested in using CDBI::Loader::Pg (or CDBI::Pg?).  However, 
>>> I can't find a way to update the table in Pg.  If I do an explicit 
>>> update, I still do not get a database entry after creating the 
>>> object.  What am I missing (probably a good deal)?
>>>
>>> Thanks,
>>> Sean

CDBI::Loader::Pg
Sean Davis 21:46 on 28 Dec 2004

Re: CDBI::Loader::Pg
Sean Davis 21:51 on 28 Dec 2004

Re: CDBI::Loader::Pg
Simon Flack 21:56 on 28 Dec 2004

Re: CDBI::Loader::Pg
Simon Flack 22:02 on 28 Dec 2004

Re: CDBI::Loader::Pg
Sean Davis 22:09 on 28 Dec 2004

Generated at 12:15 on 16 Jan 2005 by mariachi v0.52