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

Re: Re: DBI HandleError statement display

by axelrose (Scribe)
on Aug 07, 2002 at 10:58 UTC ( [id://188277]=note: print w/replies, xml ) Need Help??


in reply to Re: DBI HandleError statement display
in thread DBI HandleError statement display

Thanks for your reply, Tommy!

I tried "$dbh->{ShowErrorStatement} =1" as well as "$inssth->{ShowErrorStaement = 1" without any visible change in the error message.

The statement handles are indeed varying so I cannot use "$sth->Statement".

Some improvement though gives:
$dbh->{HandleError} = sub { warn $DBI::lasth->{Statement}; Carp::confess; }
Now the error messages looks like:
insert into mytable values ( ?, ? ) main::__ANON__('DBD::Oracle::st execute failed: ORA-01722: ...
I found a message from Tim Bunce in perl.dbi.dev that he is planning an extension for showing the bound parameters as well. That means for the moment I'm stuck unless I give up the placeholders.

Replies are listed 'Best First'.
Re: Re: Re: DBI HandleError statement display
by hmerrill (Friar) on Aug 07, 2002 at 13:41 UTC
    Tommy, have you tried using $dbh->trace? Not sure what your application is doing, but if you're trying to insert invalid data, hopefully that means that you just haven't beefed up your edits enough yet. Use $dbh->trace to help figure out what "bad" data you're trying to insert, then beef up your edits to prevent that data from making it that far. I could swear that I've used Carp's cluck before and gotten a meaningful stack trace that *did* show the placeholder values trying to get inserted(or updated, whatever).

    HTH.

      Thanks for the hint. Yes, I found the culprit by using $dbh->trace(2).

      Nonetheless I wonder what the best *general* solution for reporting errors looks like.

Re: DBI HandleError statement display
by Anonymous Monk on Aug 07, 2002 at 20:05 UTC
    $dbh->{ShowErrorStatement}=1 before the prepare() should certainly work. Please double check and post a trace() extract to dbi-users if you can't fix it. Placeholder values will be shown if ShowErrorStatement is true _and_ the driver supports the new ParamValues attribute (few do yet). Tim.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others examining the Monastery: (1)
As of 2024-04-19 00:18 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found