Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister
 
PerlMonks  

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


Comment on Error handling and transactions
Download Code
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?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others avoiding work at the Monastery: (7)
As of 2014-07-23 21:25 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    My favorite superfluous repetitious redundant duplicative phrase is:









    Results (152 votes), past polls