Re: Perl and AutoCommit

From: Madison Kelly <linux(at)alteeve(dot)com>
To: postgresql <pgsql-general(at)postgresql(dot)org>
Subject: Re: Perl and AutoCommit
Date: 2005-03-27 06:34:23
Message-ID: 424653EF.50602@alteeve.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Dan Sugalski wrote:
> At 12:31 AM -0500 3/27/05, Madison Kelly wrote:
>
>> Hi all,
>>
>> After looking at the postres and perl docs plus some Googling I
>> can't seem to find the answer I am looking for. I hope maybe someone
>> here can help. ^_^
>>
>> What I am trying to do is turn off autocommit for one particular
>> task in my program. I realize I can turn off AutoCommit when I connect
>> to the database but in this case that is not what I want to do. This
>> is a one-off task.
>
>
> Set the AutoCommit attribute of the database handle. Pull up the docs
> for DBI and search for the "Database Handle Attributes" section.

Hmm... I've read that now (thank you!) and I have added:

$acw=$DB->{AutoCommit};
print " |- AutoCommit was: [$acw]\n";
$DB->{AutoCommit} = 0 || die...
$acn=$DB->{AutoCommit};
print " |- AutoCommit now: [$acw]\n";
$DB->begin_work() || die...
#lot of transactions
$DB->commit() || die...

For some reason though my program dies on the '$DB->{AutoCommit}=0 ...'
line. I usually print '$DBI::errstr' in the 'die' to see what happened
but that is blank. I read in that section that some databases simply
don't support turning off AC and will die with a fatal error if you try
to turn it off. Could this be what is happening? If so, shouldn't there
be a more verbose error? Also, I know pgSQL supports AC being turned off
because I first read about this feature in there docs. Am I making an
mistake?

Many thanks!

Madison

--
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
Madison Kelly (Digimer)
TLE-BU, The Linux Experience; Back Up
http://tle-bu.thelinuxexperience.com
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Oleg Bartunov 2005-03-27 06:43:15 Re: psql variables
Previous Message Sim Zacks 2005-03-27 06:17:17 Re: Good Books