From: | Dan Sugalski <dan(at)sidhe(dot)org> |
---|---|
To: | Madison Kelly <linux(at)alteeve(dot)com>, postgresql <pgsql-general(at)postgresql(dot)org> |
Subject: | Re: Perl and AutoCommit |
Date: | 2005-03-27 07:40:34 |
Message-ID: | a06210201be6c133449d2@[192.168.0.8] |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
At 1:34 AM -0500 3/27/05, Madison Kelly wrote:
>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.
Well.. yeah. Assignment's an expression, with a value of the right
hand side of the expression. Since the assignment part of the logical
or is false, the right hand side's evaluated and you die, not because
anything failed.
The docs say it's a fatal error to use an unsupported value, so I'd
assume it actually dies and you'd need to trap with eval.
--
Dan
--------------------------------------it's like this-------------------
Dan Sugalski even samurai
dan(at)sidhe(dot)org have teddy bears and even
teddy bears get drunk
From | Date | Subject | |
---|---|---|---|
Next Message | Tom Lane | 2005-03-27 07:49:07 | Re: Major Performance issue |
Previous Message | Guy Rouillier | 2005-03-27 07:06:47 | Re: Command prompt window (8.0) |