Simon,

Thanks for your reply.  Just for clairfication in the eval{} do I need to do 
a sth->prepare($statement) then an sth->execute() for each statement in the 
eval?

Can you give me an example of two statements?

Thanks,
Kevin


>From: Simon Oliver <[EMAIL PROTECTED]>
>To: [EMAIL PROTECTED]
>Subject: Re: Transaction in PostgreSQL
>Date: Wed, 25 Apr 2001 09:37:06 +0100
>
>Set AutoCommit to 0 to enable transaction, something like:
>
>From the DBI man pages:
>
>$dbh->{AutoCommit} = 0;  # enable transactions, if possible
>   $dbh->{RaiseError} = 1;
>   eval {
>       foo(...)        # do lots of work here
>       bar(...)        # including inserts
>       baz(...)        # and updates
>       $dbh->commit;   # commit the changes if we get this far
>   };
>   if ($@) {
>       warn "Transaction aborted because $@";
>       $dbh->rollback; # undo the incomplete changes
>       # add other application on-error-clean-up code here
>   }
>
>
>K Old wrote:
>
>>Hello,
>>
>>I was wondering if someone could show me the syntax for doing a
>>transaction in Perl via the DBI.  When I try to just send the
>>appropriate SQL, the compiler says to use the DBI to process
>>transactions.  I can't find the appropriate functions to use.
>>
>>Any help is appreciated.
>>
>>Thanks
>>Kevin
>>[EMAIL PROTECTED]
>>_________________________________________________________________
>>Get your FREE download of MSN Explorer at http://explorer.msn.com
>
>
>--
>   Simon Oliver
>
>---------------------------------------
>   Department of Biomolecular Sciences
>   UMIST, PO Box 88, Sackville St
>   Manchester, M60 1QD
>   United Kingdom
>
>   Phone:  +44 161 200 8912
>   Fax:    +44 161 236 0409
>   Mobile: +44 776 183 0327
>   Email:  [EMAIL PROTECTED]
>---------------------------------------
>

_________________________________________________________________
Get your FREE download of MSN Explorer at http://explorer.msn.com

Reply via email to