Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change
 
PerlMonks  

How to disable SQL Warning in DBI.pm

by joperocho (Initiate)
on Mar 17, 2014 at 17:30 UTC ( [id://1078636]=perlquestion: print w/replies, xml ) Need Help??

joperocho has asked for the wisdom of the Perl Monks concerning the following question:

Anyway to disable SQL Warning from being printed in errstr? I've tried setting PrintWarn, Warn, PrintError to 0, yet sql warnings are still being set in errstr. Sample Warning: DBI Error: 513: IBMCLI DriverDB2/LINUXZ64 SQL0513W The SQL statement will modify an entire table or view. SQLSTATE=01504 Please advise. Thanks in advance.

Replies are listed 'Best First'.
Re: How to disable SQL Warning in DBI.pm
by runrig (Abbot) on Mar 17, 2014 at 17:48 UTC
      Unfortunately, specifying / trapping the code is a fix, but not the solution I'm looking for. I want to suppress all warning message from being printed in errstr.
        The docs list a connection attribute "db2_quiet_mode". Does that do anything?

        If PrintWarn doesn't work though, I'd report that as a bug.

Re: How to disable SQL Warning in DBI.pm
by mje (Curate) on Mar 18, 2014 at 08:39 UTC

    What version of DBI are you using? I ask because Changes in DBI 1.630 says "NOTE: This release enables PrintWarn by default regardless of $^W. Your applications may generate more log messages than before." May be there is a problem with that change.

      We are using DBI version 1.607, setting PrintWarn to 0, doesn't work.

        And your script uses -w?

        Please re-read mje's post, and/or try to upgrade to recent DBI (in a local folder) and see if that fixes your problem


        Enjoy, Have FUN! H.Merijn
Re: How to disable SQL Warning in DBI.pm
by runrig (Abbot) on Mar 18, 2014 at 15:44 UTC

    I'm a little confused by this statement:

    disable SQL Warning from being printed in errstr? I've tried setting PrintWarn, Warn, PrintError to 0, yet sql warnings are still being set in errstr.

    Do you mean that errstr is just being set and you are printing the contents of errstr, or that warnings are being printed with no explicit print statements on your part?

      errstr is being populated by SQL Warning messages.
        Then there is no problem with PrintWarn (at least it sounds like your problem has nothing to do with PrintWarn). You can change the behavior with HandleSetErr, but why are you printing errstr or even caring what is in errstr if there are no errors? The problem resolution seems like it should be "Don't print errstr if there are no errors detected".

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://1078636]
Front-paged by Arunbear
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others taking refuge in the Monastery: (3)
As of 2024-04-24 02:11 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found