• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Unique Fields in Database
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Unique Fields in Database


  • Subject: Re: Unique Fields in Database
  • From: Andrew Lindesay <email@hidden>
  • Date: Tue, 22 Jan 2008 08:21:54 +1300

Hello Neil;

What I tend to do is to have a lock in the database and then the thread adding the new code has to acquire the lock and write the record before being able to unlock the the lock. Addition of a unique index will also ensure that the column values are not duplicated.

cheers.

I think that your second idea of checking for the value before insert is prone to a 0.00001% chance of another instance inserting the same random number in between you checking the DB and inserting into the DB. I don't think that WO supports SQL transaction-based mode of operation (although am happy to be educated on this point if it does). I'm not even sure if RawRow based operations can be coerced into using transactions? Using your first idea though, means that I don't need to go down this route. I'd still be interested, in general, in how to avoid these 'millisecond' windows of potential disaster between a read and a write request.

___ Andrew Lindesay technology : www.lindesay.co.nz business : www.silvereye.co.nz



_______________________________________________
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


References: 
 >Unique Fields in Database (From: Neil MacLennan <email@hidden>)
 >Re: Unique Fields in Database (From: Neil MacLennan <email@hidden>)

  • Prev by Date: Re: [Announcement] WOJC databinding library released
  • Next by Date: Re: [Announcement] WOJC databinding library released
  • Previous by thread: Re: Unique Fields in Database
  • Next by thread: Re: Writing a beginners tutorial
  • Index(es):
    • Date
    • Thread