Re: Checking for existence in records?

Garry Williams <[email protected]>
Newsgroups gmane.comp.db.mysql.perl
Organization Zvolve Systems, Inc.
Message-ID <1112039870.4898.12.camel@tfr>
On Mon, 2005-03-28 at 14:44 -0500, KEVIN ZEMBOWER wrote:
> How can I check if the item already exists in the database, and not get an error if it doesn't?

Insert it and handle the duplicate key error.

This assumes (as you stated) that you want it inserted, if it's not
there.  It also eliminates the obvious race condition.

-- 
Garry Williams, Zvolve Systems, Inc., +1 770 813-4934
                                Cell: +1 404 353-2983


-- 
MySQL Perl Mailing List
For list archives: http://lists.mysql.com/perl
To unsubscribe:    http://lists.mysql.com/[email protected]
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.