http://qs321.pair.com?node_id=535222


in reply to Re^2: Catching DBI (or other) errors
in thread Catching DBI (or other) errors

That would execute all queries even if one of them failed though. And if after your code finishes, $sql_stage is 1, you still don't know whether it was $query or $query2 that failed. Now add 3 or 4 more queries to that list and the $sql_stage variable becomes practically useless for anything except comparing to the total number of queries.

Replies are listed 'Best First'.
Re^4: Catching DBI (or other) errors
by clinton (Priest) on Mar 09, 2006 at 10:31 UTC
    But wrapped in an eval and combined with RaiseError, it would stop counting at the point where your query goes wrong.

    It is a bit annoying in that you have to count your queries to know which went wrong, but there may be one or two specific action points: if queries 1-4 succeeded, but 5-8 failed do X, otherwise do Y.