Core Data and auto increment
Core Data and auto increment
- Subject: Core Data and auto increment
- From: Eric Morand <email@hidden>
- Date: Sat, 29 Jul 2006 15:38:20 +0200
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:
This email sent to email@hidden