ATTENTION: I've decided to put the upgrade on hold due to a compatibility issue of our server environment with the latest CS installer package. CS 2008 now requires SQL Server 2005 as the backend DB but our database server currenlty has SQL Server 2000 installed on it. I'll resume the upgrade once I figure out when Telligent is releasing a patch to the schema compatibility issue. For now, we will continue to use the old version of CS while waiting for the said patch. If you have any questions about this process, please don't hesitate to post them on our forums and I'll answer them as soon as I can. Thanks for your patience and support guys! I'll let you know as soon as this is resolved. - Keith Rull

handling unique constraint violations

unique constraints are very common for database table designs in applications nowadays.  there are two ways to safely code an application to cater for this unique constraint requirement. (1) do an existence check/query before doing the insert. (2) let the database throw a unique constraint and handle it.

i have always viewed option 1 to be the wrong way to do it because it is still possible to fail if an insert of the same unique data happened in between the checking and the intended insert.  i always advise option 2, let it throw.  performance wise, option 1 involves two queries as opposed to option 2's single action query.

i was surprised that they opted for option 1 but the rare scenario is still handled by their application:  user will be issued by an error page, user will re-fill up the same data (unlucky him), and when the duplicate check is done again, he will be presented by a "data already exist" message.


Posted Apr 24 2007, 06:52 PM by jokiz
Filed under: , ,

Add a Comment

(required)  
(optional)
(required)  
Remember Me?

Enter the numbers above:

Copyright DevPinoy 2005-2008