Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Core Data and auto increment



Hi list !


I have a customer entity that contains a "customer number" attribute. I want this attribute to be automatically generated when a customer is inserted into the database (SQLite). In other words, I want the customer number attribute to auto-increment.


What's the best way to deal with this ? I'm currently fetching every customers of the database sorted by descending "customer number" and then I use the first customer of the array to compute the new customer number. But I'm wondering if there is not a best solution.

I've tried to use "customerNumber = max(customberNumber)" to retrieve the customer with the greatest customer number, but it doesn't work.

Any advice ?


Thanks,

Eric.
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/email@hidden

This email sent to email@hidden


Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.