• 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: Two simple questions regarding Core-Data
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Two simple questions regarding Core-Data


  • Subject: Re: Two simple questions regarding Core-Data
  • From: "Marcus S. Zarra" <email@hidden>
  • Date: Fri, 4 May 2007 10:45:28 -0600

On 5/4/07, Hell's KItchen Hell's KItchen <email@hidden> wrote:

a) is possible to set the value of an attribute with a predicate? For
example I would to set the 'label' attribute to 1 for all entities
into the managed objects. Is the only way to get the complete array of
these entities and then apply the attribute to each manually"?

No, but you can retrieve them into an array and then call

- (void)makeObjectsPerformSelector:(SEL)aSelector withObject:(id)anObject

on the array.  This avoids having to loop over the array and call the
method on each object individually.

b) is possible to get the number of items given from a predicate
results instead of using [resultsArray count]? (a sort of count(*) for
sql, I don't need of the list). Or there is not any issue on general
performances? This action will be repeated lots of time in my app.

Again no. Fortunately when the array is retrieved all of the objects are "faults" which means they are not loaded into memory yet and your call to count will not cause them to load. Therefore the memory and performance hits are negligible.

Marcus S. Zarra
Zarra Studios LLC
Simply Elegant Software for OS X
www.zarrastudios.com
_______________________________________________

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: Two simple questions regarding Core-Data
      • From: Robert Walker <email@hidden>
References: 
 >Two simple questions regarding Core-Data (From: "Hell's KItchen Hell's KItchen" <email@hidden>)

  • Prev by Date: Re: best way to compare selectors?
  • Next by Date: Re: Two simple questions regarding Core-Data
  • Previous by thread: Two simple questions regarding Core-Data
  • Next by thread: Re: Two simple questions regarding Core-Data
  • Index(es):
    • Date
    • Thread