Beefy Boxes and Bandwidth Generously Provided by pair Networks
Think about Loose Coupling

Error handling and transactions

by runrig (Abbot)
on Jul 11, 2004 at 20:12 UTC ( #373508=note: print w/replies, xml ) Need Help??

in reply to DBI recipes

Just to answer Abigail-II's concerns mentioned earlier, I'll mention that there is a section in the DBI docs on Transactions that goes over an idiomatic method of error handling. I won't repeat it in detail, but to summarize, set RaiserError on, wrap all DBI operations in one big eval block, check $@ after exiting the eval block, and rollback the transaction if there was an error (update: and commit if there was no error). You can even set RaiseError during the connect (in which case you would not rollback if there were an error during the connect), and do the connect inside the eval block, which the example in the docs does not do.

An updated link: DBI transactions

Replies are listed 'Best First'.
Re: Error handling and transactions
by tphyahoo (Vicar) on Dec 12, 2005 at 14:09 UTC
    Just to be a little more concrete, I think the section being referred to is here.

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://373508]
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others cooling their heels in the Monastery: (4)
As of 2020-11-26 02:27 GMT
Find Nodes?
    Voting Booth?

    No recent polls found