On Wed, Mar 27, 2002 at 06:29:10PM -0500, Matthew Brooks wrote:
> MessageChecking for the existence of a particular record in a database before 
>performing an UPDATE/DELETE on it is just good programming practice. An UPDATE/DELETE 
>by definition, and in comparison to an INSERT, assumes that the record already exists.

It is acceptable to check the return value though to see if the UPDATE/DELETE
succeeded.  If n rows are updated or deleted, DBI will return you an n.

Checking before doing something is not always the recommended way of working.
Do you check for a file's readability before open()ing it?  No, you
open || report failure.  I treat database updates the same way.

That doesn't help with the database hanging when the WHERE clause matches
no records, but checking before UPDATEing is not the solution.  Fixing the
underlying problem is the solution.  This Shouldn't Be Happening.

>   I'm using DBI 1.14 on WindowsNT with SQL Server.

Ah.  Which version of Squeal Sewer?  I betcha MS have changed the protocols
out from under our feet and so DBI is getting its knickers in a twist.

-- 
David Cantrell    |    Reprobate    |    http://www.cantrell.org.uk/david

       23.5 degrees of axial tilt is the reason for the season

Reply via email to