Re: DB uniqueness constraints and dealing with them
Re: DB uniqueness constraints and dealing with them
- Subject: Re: DB uniqueness constraints and dealing with them
- From: Jerome Chan <email@hidden>
- Date: Fri, 04 Jul 2008 08:30:16 +0800
What about doing
save -> if error check to see if existing record exists and if so
throw up a duplicate error ?
On Jul 4, 2008, at 7:52 AM, Q wrote:
On 04/07/2008, at 2:58 AM, Florijan Stamenkovic wrote:
Hi all,
While reading older discussions on dealing with DB uniqueness
restraints I've found out that the EOGeneralAdaptorException thrown
differs among databases. Is there some generic code that deals with
this in absolute terms ( don't you just *love* the word absolute
being used in conjunction with software :) ? If there is in WOnder,
could someone please be so kind to point me in the right direction
(which part of WOnder) so I can look at it?
Or should I write some pure EOF code like: Fetch -> Check
uniqueness -> Create new record -> Save -> Fetch -> Check, or
something along those lines?
I don't know about you but this just screams race condition to me.
However unlikely it may be to happen trying to do uniqueness without
using an atomic operation is extremely painful to get right, and
difficult to test properly.
This would assume that I know which attributes should be unique in
code, which can be done. I'd rather not deal with this like this,
it seems a nuisance.
Thanks,
Flor
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden
--
Seeya...Q
Quinton Dolan - email@hidden
Gold Coast, QLD, Australia (GMT+10)
Ph: +61 419 729 806
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden