I did not also unset PrintError, but I just tried that, and still no luck. I am using the ODBC DBD at the time, but I believe I had also tried this with Oracle. Basically, I have code which wants RaiseError on for a prepare and execute. Then, I do NOT want it on for the fetches, because there is a fetch that could potentially throw an error. With RaiseError off (what I want) this code works:
# there is more to fetch, so set this high if ($sth->fetchrow_arrayref) { $extraFetch = 5000000; } else { $extraFetch = $numRowsDisplayed; }
This fetch could potentially be outside the boundaries of the rows returned. With RaiseError off, I don't die and the conditiom works fine. With RaiseError on, I get this error:

DBD::ODBC::st fetchrow_arrayref failed: (DBD: no select statement currently executing err=-1)

If RaiseError could be off at this point, all would be good.

However there are other areas in my code where I would have this same problem. Typically I will want to encapsulate a few statements in a transaction (with eval) and want RaiseError on for that. Then I will want it off, as there is code that follows which does things along the lines of

execute($sql) || handle the error

(where a die being thrown would never get into my "handle the error code)

Matt

In reply to Re^2: Toggling dbi attribute within a connection? by JupiterCrash
in thread Toggling dbi attribute within a connection? by JupiterCrash

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.