I'm experimenting with adding a database component to a project. I've
arrived at a point where I could go one of two ways to deal with an
issue, and I'm not sure what the best approach is.

I have a TEXT column in one table that has a UNIQUE constraint, to
create a unique list of words. The interface allows users to update
the list after it's initially created, so there's a potential for them
to try to add a word to the list that the table already contains.

It seems to me there are two ways to handle this (and there are
probably more I'm totally oblivious to). I could check in advance to
see if a word is already in the list by doing a SELECT for that word,
and then skipping my INSERT if the SELECT is successful. Or I could
just INSERT the word and ignore the error if it's a constraint
violation (UNIQUE is the only constraint on that column).

I hope some database gurus can advise me. Is there a better way of
doing this? Is one of these ways preferable to the other?

If it makes any difference, I'm using the REALSQLDatabase for this.
_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>

Search the archives:
<http://support.realsoftware.com/listarchives/lists.html>

Reply via email to