There is no || die anywhere in that eval? Even with RaiseError => 1 turned
on, in many cases the transaction does not fail, if not checking for some
sort of return. You are right, that eval does exit on error, I think I
replied a little to quick and didn't exress it right. In most cases you
would want to somehow check for the statement return. Also I've had cases
and still do, on SunOS where with error checking turned on it still does not
fail the script, not sure if that is driver specific rather than DBI, but
with the same version of DBD::Oracle on one machine it failed and on the
other it did not. I believe there were also a few threads that mentioned
the same problem (or maybe it is not a problem, but rather expected behavior
in some cases and environments). I always use || die() or specifically
check for return value when using eval with DBI.
Ilya Sterin
-----Original Message-----
From: Stephen Clouse [mailto:[EMAIL PROTECTED]]
Sent: Saturday, May 05, 2001 6:00 PM
To: Sterin, Ilya
Cc: [EMAIL PROTECTED]; [EMAIL PROTECTED]
Subject: Re: executing atomic transactions in DBI
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
On Sat, May 05, 2001 at 12:04:11PM -0400, Sterin, Ilya wrote:
> The problem with putting it into an eval block is that it will be commited
> no matter what and then your rollback statement is useless. You should
> really check on status of execute to commit/rollback based on that. Also
> with autocommit off is any of the statements fail though stopping the
> program, the inserts/updates would not of been commited. In your case
eval
> prevents from failing a script, though commiting no matter what.
Say what?!?
An eval block will exit at the point a die is triggered. It traps a fatal
and
then leaves the eval block without aborting the rest of the script. But it
doesn't continue executing the eval block like you suggest.
There's even an example in `perldoc DBI` that looks exactly like the given
code. What would be the point of it if it kept executing? eval *traps*
errors,
it doesn't completely disable them.
- --
Stephen Clouse <[EMAIL PROTECTED]>
Senior Programmer, IQ Coordinator Project Lead
The IQ Group, Inc. <http://www.theiqgroup.com/>
-----BEGIN PGP SIGNATURE-----
Version: PGP 6.5.8
iQA/AwUBOvR37gOGqGs0PadnEQKFjgCeIp5dWSKbi8yeowRKrie6b9dG8zgAoOv3
dJgg6PN6ZVLf+tdrDDF5b3o8
=BVYL
-----END PGP SIGNATURE-----