FROM : Paul Collins
DATE : Wed Jun 21 18:57:45 2006
On Jun 21, 2006, at 8:38 AM, Andrew Kinnie wrote:
> I am curious whether there is a quick and easy way to create unique
> data in a Core Data app.
If you're looking for something like the "unique" flag in MySQL, I'm
not aware of any equivalent in Core Data. But there is a validation
system you can put your own methods in, so you can programmatically
ensure the uniqueness of new entries. Best thing I can think of is to
fetch with the new string and see if it exists. Read the "Validation"
section of Core Data Programming Guide.
FYI, for a serialized attribute (1, 2, 3, ...) I keep a separate, 1-
entry table with integer attributes like "nextID" with the next
serial number to use for that persistence stack.
Paul Collins
DATE : Wed Jun 21 18:57:45 2006
On Jun 21, 2006, at 8:38 AM, Andrew Kinnie wrote:
> I am curious whether there is a quick and easy way to create unique
> data in a Core Data app.
If you're looking for something like the "unique" flag in MySQL, I'm
not aware of any equivalent in Core Data. But there is a validation
system you can put your own methods in, so you can programmatically
ensure the uniqueness of new entries. Best thing I can think of is to
fetch with the new string and see if it exists. Read the "Validation"
section of Core Data Programming Guide.
FYI, for a serialized attribute (1, 2, 3, ...) I keep a separate, 1-
entry table with integer attributes like "nextID" with the next
serial number to use for that persistence stack.
Paul Collins
| Related mails | Author | Date |
|---|---|---|
| Andrew Kinnie | Jun 21, 17:38 | |
| George Orthwein | Jun 21, 18:39 | |
| Paul Collins | Jun 21, 18:57 |






Cocoa mail archive

