![]() |
|
Problems? Is your data what you think it is? | |
PerlMonks |
comment on |
( #3333=superdoc: print w/replies, xml ) | Need Help?? |
You could write it as
$query->execute() or do { $SQL_FAIL = 1};But for a single line statement, you really don't need the braces, just : $query->execute() or $SQL_FAIL = 1;But why are you doing it this way? This means that you then have to check the value of SQL_FAIL every line before processing the next statement. Wrapping it all in an eval and using RaiseError really works a treat, looks clean makes your life simpler. If you are using the value of SQL_FAIL to figure out what statement failed, then you could go the other way and have $sql_stage (note, not all in capitals because this implies a constant, which it isn't) and you could just set $sql_stage to the current stage you're working on. As in
In reply to Re: Catching DBI (or other) errors
by clinton
|
|