Re: verifying sql INSERTs

From: Date: Tue, 26 Aug 2003 20:26:47 +0000
Subject: Re: verifying sql INSERTs
References: 1 2  Groups: php.general 
Request: Send a blank email to php-general+get-160850@lists.php.net to get a copy of this message
From: "Curt Zirzow" <php-general@zirzow.dyndns.org> > > I should instead just try to perform the INSERT and then if it fails I > > know I've already got a record. If it doesn't I know everything is cool. > > I've debated with myself several times if this is really a good > method to not have duplicates in the database. > > Like what happens if for some reason the constraint gets dropped? > having your progam rely on the constraint will cause all data > integrity to go to hell. For one little script inserting into it's own little table, yeah, it really doesn't matter. Consider, though, a business making use of this database not only through a PHP script, but through an Access frontend in marketing, some ASP scripts in HR, etc. Now, if you don't enforce the constraints in the database, each and every program must enforce the constraits itself. It's easier to do it in one place. :) ---John Holmes...

« previous php.general (#160850) next »