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



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.





Relevant Pages

  • Always Die (was: RE: Getting spatial data?)
    ... don't use 'die' on DBI statements at all. ... fail. ... For that purpose I will open the DBI connection with these options ... policy without the explicit 'die' on every statement. ...
    (perl.dbi.users)
  • Re: Question about homeless on Kauai
    ... It's people who fail. ... And I never even mentioned food stanps. ... going to die and when you are going to die. ... >> I am also hard on our public education system and our ...
    (soc.culture.hawaii)
  • Re: trying to understand fork and wait
    ... > the perldoc for fork ... ... die had nothing to do with your problem. ... off checking whether functions fail: ... Unfortunately there is no one way to test for 'success' in Perl. ...
    (comp.lang.perl.misc)
  • Re: vbs output to txt file
    ... I guess I would have to see a specific real life ... COM object that will fail as you describe, ... Regardless, if you could do it on purpose, then I would posit ... not crash as a result of some problematic COM object not cleaning up ...
    (microsoft.public.scripting.wsh)
  • Re: Aristotle and his tautological influence
    ... clone Hitler, ..." ... I will die with my delusions and you will die not ... the purpose of proving that he is purposeless. ... to even engage a YEC, that would be like debating somebody believing ...
    (talk.origins)