• 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 items in Core Data models
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Unique items in Core Data models


  • Subject: Re: Unique items in Core Data models
  • From: mmalc crawford <email@hidden>
  • Date: Tue, 15 May 2007 14:59:11 -0700


On May 15, 2007, at 2:52 PM, mmalc crawford wrote:

But that still leaves the issue of determining uniqueness of a Title :-)

Sorry, I pressed Deliver by accident...

As noted in a previous post, the naive technique for determining the uniqueness of a given attribute (for example, a Title's title) is to simply execute a fetch with a predicate for <uniquedAttributeName> = <value> and check that the returned array has a count of 0. This is, however, potentially very expensive.

If you're creating several unique values at the same time, the first thing to do would be to combine all the values into a single fetch.

Better still, though, maintain an application-global dictionary of existing unique values. The key can be the uniqued value, the corresponding value in the dictionary is the objectID of the corresponding managed object (you can use the objectID in any managed object context...). Thus rather than executing a fetch, you check the local cache.

Chris may have more to say about this pattern...

mmalc

_______________________________________________

Cocoa-dev mailing list (email@hidden)

Do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


  • Follow-Ups:
    • Re: Unique items in Core Data models
      • From: "Paulo F. Andrade" <email@hidden>
References: 
 >Unique items in Core Data models (From: Keith Penrod <email@hidden>)
 >Re: Unique items in Core Data models (From: Chris Hanson <email@hidden>)
 >Re: Unique items in Core Data models (From: mmalc crawford <email@hidden>)

  • Prev by Date: Re: Unique items in Core Data models
  • Next by Date: Re: Status Item problems
  • Previous by thread: Re: Unique items in Core Data models
  • Next by thread: Re: Unique items in Core Data models
  • Index(es):
    • Date
    • Thread