[CDBI] Re: atomic find_or_create()

[prev] [thread] [next] [Date index for 2005/10/24]

From: Perrin Harkins
Subject: [CDBI] Re: atomic find_or_create()
Date: 16:28 on 24 Oct 2005
On Fri, 2005-10-21 at 21:57 -0400, Edward J. Sabol wrote:
> Personally, I would just do the INSERT (using create()/insert()) and
> then check $@ for a DBMS-specific "attempt to insert duplicate key" error
> message. If that's the error, I'd search and return.

It feels kind of dirty, but I'll probably just end up doing that because
this condition is very unlikely.

> Another option is to DELETE and then INSERT, inside of a transaction.

I can't do that, or REPLACE, because I don't want to change the primary
key if it's already there.  I'm using a unique but non-primary key for
the search.

- Perrin


_______________________________________________
ClassDBI mailing list
ClassDBI@xxxxx.xxxxxxxxxxxxxxxx.xxx
http://lists.digitalcraftsmen.net/mailman/listinfo/classdbi

[CDBI] atomic find_or_create()
Perrin Harkins 00:33 on 22 Oct 2005

[CDBI] Re: atomic find_or_create()
Edward J. Sabol 01:57 on 22 Oct 2005

[CDBI] Re: atomic find_or_create()
Perrin Harkins 16:28 on 24 Oct 2005

Generated at 14:18 on 27 Oct 2005 by mariachi v0.52