I use insertOrThrow in my android code to insert rows in to sqlite database. I use try catch to trap SQLiteException. In case of errors i get exception message like
"column word is not unique (code 19)"
I was searching for a property which would have the error code but could not. I think in this case i need to parse the error message to get the error code.
The reason to have an error code is to identify duplicates. If the entry is a duplicate then i will display 'Data already exists' message else i will display a generic error info like 'Unable to save information'.
Is there any other way to find the error code other than parsing? Will the error code be consistent?
Aucun commentaire:
Enregistrer un commentaire