Hi, Can some one please help me with this problem.I am using SQLite database in my iphone app to save the values. I have many duplicate values in my database. So, to eliminate that I am planning to write some unique constraint on the table. My constraint should be such a way that a contact whose firstname,lastname and email are same, I want to ignore that.
When I tried to implement the unique constraint in my table definition it's giving me an error. I tried this by checking the syntax in sqlite.org. Please see my table creation method and please help me. If you have any better solution please let me know. I will be glad to provide you any info if needed.
I have 36 fields in my database where field3 is firstname,field4 is lastname and field31 is email. Also, please let me know if we should use this constraint while inserting or selecting the rows. I will be waiting for your replies..Thank you!!!
The error in this method is: Expected : before ( token I tried in many ways but it didn't work.
Why do you think you can put the unique clause in your method definition? It would need to be part of the SQL.
However the way I deliver databases with my apps is to not create them in code - but to create them as part of the app bundle and copy them to the apps document directory on the first launch - I think most people do it that way. Then you can use something like the firefox sqlite manager to create the database.
Thanks for the reply..but I can't change the code now as the database is totally integrated across the classes. Can you please give me an example how to use the constraints with the code I have..
nope..I am not changing any column names during runtime..thought of writing methods to the class. Its my mistake..when I tried to include inside SQLite statement it says that the declaration of the method doesm't match with the statement you wrote..I know my code is messy but I can't change now..thanks for the reply and please help me regardin this