Problem with DBMS (how to have a unique column)
| Tue, 2006-03-28 20:47 | |
|
Hello,
I need a database in my app which will hold several data such as string, date, etc and inserting and deleting date takes place frequently. I have to identify each field uniquely. Note that I can have same data in several rows. For instance, 1. abcd 2. efgh 3. ijkl 4. abcd 5. abcd if “abcd” is selected, I have to know exactly from which field it came. So I thought it will be good idea to keep one extra column that will have unique value. I tried as follows: TDbCol keyCol(_L("Column_4"), EDbColUint32); keyCol.iAttributes = TDbCol::EAutoIncrement; This is incrementing value like 0,1,2,3,4,5,6,7….. But the problem is that when I delete a date, it does not short the value and keeps on incrementing from the height value. For example I delete row containing 1,2,3,4 and add two new data. My key column will have value like 0,5,6,7,8,9. So it is incrementing and in some day it will reach to the maximum value that TUint32 can hold (4294967295). So there must be some other way to meet such criteria? So could any of you suggest me how to solve this? Note that comparing data won’t help at all as long as I would have similar data in several rows. |
|






Forum posts: 214
If you really think this will be a problem then add some maintenace cycle to yuor app - create new temporary table, move your existing data to it, drop current table and recreate it. Then move data back to it and drop temporary table. I recommend to pack the database also afterward.
"I only know that I know nothing." (Socrates)