Hi to all,
which is the best strategy to check if a value within a SQLite table is unique ?
1) Actually I execute a SQL query on the interested table looking for the value that I wish tu add.
If select return a record count = 0 than I assume that the value il unique within my table.
It's possibile to use the unique check of the SQLite db engine ?
You can avoid the rowCount, since this can produce a lot of records in a cursor, by simply using the count(*) statement.
Now, if you create a unique field, you can use an "insert or ignore" statement. If you don't wish to use a unique field, you can use a "where not exists" clause.
You can avoid the rowCount, since this can produce a lot of records in a cursor, by simply using the count(*) statement.
Now, if you create a unique field, you can use an "insert or ignore" statement. If you don't wish to use a unique field, you can use a "where not exists" clause.