RE: Always Die (was: RE: Getting spatial data?)
- From: Philip.Garrett@xxxxxxxxxxx (Philip Garrett)
- Date: Fri, 23 Jun 2006 00:34:01 -0400
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@xxxxxxxxxx]
Sent: Thu 6/22/2006 6:22 PM
To: dbi-users@xxxxxxxx
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 => 1, RaiseError => 1, AutoCommit => 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@xxxxxxxxxxx]
Sent: Thursday 22 June 2006 14:08
To: dbi-users@xxxxxxxx
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.
- References:
- Always Die (was: RE: Getting spatial data?)
- From: Will Rutherdale
- Always Die (was: RE: Getting spatial data?)
- Prev by Date: RE: Speed test for connecting to Oracle for Windows via ODBC - Solved!
- Next by Date: Unable to install DBD::Oracle on windows XP
- Previous by thread: Always Die (was: RE: Getting spatial data?)
- Next by thread: multiple perl installs - OT
- Index(es):
Relevant Pages
|