Beefy Boxes and Bandwidth Generously Provided by pair Networks
Do you know where your variables are?
 
PerlMonks  

Re: DBI - get info from statement handles (ShowErrorStatement)

by htoug (Deacon)
on Sep 30, 2004 at 05:28 UTC ( #395247=note: print w/ replies, xml ) Need Help??


in reply to DBI - get info from statement handles

Unless you turn off PrintError on your $db_handle the DBI will print the errormessage whenever an error occurs.
Adding $db_handle->{ShowErrorStatement} = 1 will add the SQL statement to the error message (with bound paramters added for readability in newer DBIs and DBDs).

There is no need to eval the executes, they won't die unless you have RaiseError set on the db-handle. So it just won't work as you expect. Any errors on the execute phase will go undetected.

My recommendation is to use RaiseError, and add a HandleError for cases when a simple die is not good enough.

janitored by ybiC: Retitle from "ShowErrorStatement" because onewordnodetitles hinder site search


Comment on Re: DBI - get info from statement handles (ShowErrorStatement)

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others chanting in the Monastery: (7)
As of 2015-03-06 13:06 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    When putting a smiley right before a closing parenthesis, do you:









    Results (161 votes), past polls