in reply to Re: SQL through perl is giving error
in thread SQL through perl is giving error
Now if I add a rollback before the 2nd eval:
It works! Apparently, the rollback resets $@, but why is the $@ message different in the 2nd eval without the rollback?warn $inventoryUpdate.$statement."\n"; eval{ $result=$db->do($inventoryUpdate.$statement); warn "result1=$result\n"; }; if($@){ warn "Can't update. Trying insert.\n\n$inventoryInsert$statement"; $db->rollback; eval{ $result=$db->do($inventoryInsert.$statement); warn "result1=$result\n"; }; if ($@){ warn "Aborted because $@"; $db->rollback; return 0; } } $db->commit;
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: SQL through perl is giving error
by Anonymous Monk on Sep 01, 2011 at 03:17 UTC | |
by remiah (Hermit) on Sep 01, 2011 at 05:56 UTC |