Skip navigation.
 
mlRe: Two simple questions regarding Core-Data
FROM : Marcus S. Zarra
DATE : Fri May 04 18:45:28 2007

On 5/4/07, Hell's KItchen Hell's KItchen <<email_removed>> 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

Related mailsAuthorDate
mlTwo simple questions regarding Core-Data Hell's KItchen Hel… May 4, 13:25
mlRe: Two simple questions regarding Core-Data Marcus S. Zarra May 4, 18:45
mlRe: Two simple questions regarding Core-Data Robert Walker May 4, 18:47
mlRe: Two simple questions regarding Core-Data Robert Walker May 4, 18:59
mlRe: Two simple questions regarding Core-Data Marcus S. Zarra May 4, 19:03
mlRe: Two simple questions regarding Core-Data Robert Walker May 4, 22:04
mlRe: Two simple questions regarding Core-Data Marcus S. Zarra May 4, 23:08
mlRe: Two simple questions regarding Core-Data Robert Walker May 4, 23:48
mlRe: Two simple questions regarding Core-Data Steve Israelson May 5, 00:33