Always Die (was: RE: Getting spatial data?)

Always Die (was: RE: Getting spatial data?)

am 23.06.2006 00:22:05 von Will.Rutherdale

Just to expand on that piece of the discussion, there are cases where I
don't use 'die' on DBI statements at all.

For instance, I may have a system script (not for end users) whose
purpose is to do some database update operations and either succeed or
fail. If it succeeds then it does the whole job correctly, if it fails
then it makes no changes and returns an error code. The specific errors
in the failure case will show up in the log, and everything will be
rolled back.

For that purpose I will open the DBI connection with these options
(amongst others): { PrintError =3D> 1, RaiseError =3D> 1, AutoCommit =3D> 0
}.

As Larry says, there is more than one way to do it, and for some
purposes you can use this as a consistent and clean error handling
policy without the explicit 'die' on every statement.

-Will


> -----Original Message-----
> From: Garrett, Philip (MAN-Corporate)=20
> [mailto:Philip.Garrett@manheim.com]=20
> Sent: Thursday 22 June 2006 14:08
> To: dbi-users@perl.org
> Subject: RE: Getting spatial data?
>=20
> Just nit picking here, but don't forget "|| die $connect->errstr"
> after your prepare statement.


- - - - - Appended by Scientific Atlanta, a Cisco company - - - - -=20
This e-mail and any attachments may contain information which is confidenti=
al, proprietary, privileged or otherwise protected by law. The information =
is solely intended for the named addressee (or a person responsible for del=
ivering it to the addressee). If you are not the intended recipient of this=
message, you are not authorized to read, print, retain, copy or disseminat=
e this message or any part of it. If you have received this e-mail in error=
, please notify the sender immediately by return e-mail and delete it from =
your computer.

RE: Always Die (was: RE: Getting spatial data?)

am 23.06.2006 06:34:01 von Philip.Garrett

------_=_NextPart_001_01C6967E.B3593E8C
Content-Type: text/plain;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

Yeah, you're right. T definitely IMTOWTDI. Using RaiseError is a valid =
choice, as is checking each call for errors. However, you do need one =
or the other. Calling a method on a undefined variable is rarely one of =
TWTDI.

________________________________

From: Rutherdale, Will [mailto:Will.Rutherdale@sciatl.com]
Sent: Thu 6/22/2006 6:22 PM
To: dbi-users@perl.org
Subject: Always Die (was: RE: Getting spatial data?)



Just to expand on that piece of the discussion, there are cases where I
don't use 'die' on DBI statements at all.

For instance, I may have a system script (not for end users) whose
purpose is to do some database update operations and either succeed or
fail. If it succeeds then it does the whole job correctly, if it fails
then it makes no changes and returns an error code. The specific errors
in the failure case will show up in the log, and everything will be
rolled back.

For that purpose I will open the DBI connection with these options
(amongst others): { PrintError =3D> 1, RaiseError =3D> 1, AutoCommit =
=3D> 0
}.

As Larry says, there is more than one way to do it, and for some
purposes you can use this as a consistent and clean error handling
policy without the explicit 'die' on every statement.

-Will


> -----Original Message-----
> From: Garrett, Philip (MAN-Corporate)
> [mailto:Philip.Garrett@manheim.com]
> Sent: Thursday 22 June 2006 14:08
> To: dbi-users@perl.org
> Subject: RE: Getting spatial data?
>
> Just nit picking here, but don't forget "|| die $connect->errstr"
> after your prepare statement.


- - - - - Appended by Scientific Atlanta, a Cisco company - - - - -
This e-mail and any attachments may contain information which is =
confidential, proprietary, privileged or otherwise protected by law. The =
information is solely intended for the named addressee (or a person =
responsible for delivering it to the addressee). If you are not the =
intended recipient of this message, you are not authorized to read, =
print, retain, copy or disseminate this message or any part of it. If =
you have received this e-mail in error, please notify the sender =
immediately by return e-mail and delete it from your computer.




------_=_NextPart_001_01C6967E.B3593E8C--