Here is a simple mySQL request :
UPDATE myTable SET X=X-1 WHERE (X>100)
Now my question goes like this.
How would I write a similar request in Core Data ?
I am starting to find out my way in Core Data; but the last part of the above SQL order gives me problems in Core Data.
In other word : how do I handle the WHERE (X>100) part.
If the mySQL request concerned one record only, I would use some thing like this :
[matchItem setValue:VALUE forKey:@"X"];
But how do I do if is a range of records, like here, where I want to perform some actions for all records where X>100.
Use an
NSPredicateand add it to yourNSFetchRequest.Iterate through your results array and set the value as appropriate.