Contact _ID and additionnal informations

Put your problem here if it does not fit any of the other categories.

Contact _ID and additionnal informations

Postby Praline » Sun Mar 16, 2008 4:01 pm

Hello all,

I use contact _ID to store specific informations about contacts in my application DB. But I've just test to
- remove a contact "BOB" (_ID=7)
- create a new contact
=> the new contact "John" has the _ID=7, same as deleted "Bob" :(.

The _ID is not an real unique ID and I can't use it.
1 - Do a Intent is broadcasted when a contact is deleted ?
2 - Do a real unique ID exists for a contact ?

Best Regards,
Praline
Praline
Junior Developer
Junior Developer
 
Posts: 11
Joined: Tue Feb 12, 2008 3:53 pm

Top

Postby Praline » Sun Mar 16, 2008 4:11 pm

They notice us about this problem and give the solution but they don't use it ?
In any case, you should include an integer column named _id to define a specific record number. If using the SQLite database, this should be type INTEGER PRIMARY KEY AUTOINCREMENT. The AUTOINCREMENT descriptor is optional, but by default, SQLite autoincrements an ID counter field to the next number above the largest existing number in the table. If you delete the last row, the next row added will have the same ID as the deleted row. To avoid this by having SQLite increment to the next largest value whether deleted or not, then assign your ID column the following type: INTEGER PRIMARY KEY AUTOINCREMENT.
Praline
Junior Developer
Junior Developer
 
Posts: 11
Joined: Tue Feb 12, 2008 3:53 pm

Postby venkat » Wed Mar 26, 2008 5:38 pm

Praline wrote:They notice us about this problem and give the solution but they don't use it ?
In any case, you should include an integer column named _id to define a specific record number. If using the SQLite database, this should be type INTEGER PRIMARY KEY AUTOINCREMENT. The AUTOINCREMENT descriptor is optional, but by default, SQLite autoincrements an ID counter field to the next number above the largest existing number in the table. If you delete the last row, the next row added will have the same ID as the deleted row. To avoid this by having SQLite increment to the next largest value whether deleted or not, then assign your ID column the following type: INTEGER PRIMARY KEY AUTOINCREMENT.



Thanks Praline,
i have been searching for long time. Thanks very much for your help :)
Regards,
Venkat.
venkat
Senior Developer
Senior Developer
 
Posts: 152
Joined: Tue Nov 27, 2007 5:42 am
Location: India

Postby Praline » Thu Mar 27, 2008 9:01 am

You're Wellcome venkat.
Google will probably correct this bug in the next SDK.

--
Praline
Praline
Junior Developer
Junior Developer
 
Posts: 11
Joined: Tue Feb 12, 2008 3:53 pm

Top

Return to Other Coding-Problems

Who is online

Users browsing this forum: No registered users and 18 guests