[CDBI] Re: atomic find_or_create()
[prev]
[thread]
[next]
[Date index for 2005/10/24]
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