Symbian
Symbian OS Library

FAQ-0639 Are contact IDs and field IDs unique?

[Index][spacer] [Previous] [Next]



 

Classification: C++ Category: Application Engines
Created: 04/14/99 Modified: 05/24/2005
Number: FAQ-0639
Platform: Not Applicable

Question:
Contacts in the contacts db are identified by ID. If I delete a contact with a given ID, will that ID ever be reused?
Likewise for the IDs of fields within a contact.


Answer:
Contact IDs are never re-used. Once an ID has been allocated and deleted it is gone forever. This means there is a finite limit to the number of contacts that could ever be supported in a db, but as the ID is a 32 bit number this limit isn't an issue in the real world.

Field IDs, however, are recycled. If you have fields 1-5 in a given contact card and delete field 3, the next field added to that card will re-use ID 3. If you wish to retain a link to a particular field in a particular card, one approach is to record the type of the field you are linking to. Having done this, when accessing your field you can first check the type to gain assurance that the data you are about to access is of the right type, if not necessarily the actual data you were expecting. This falls down if someone deletes your field and it is then replaced by one of the same type, and this may or may not be a problem to you.