In my Android application I am using compiled statements to be able to insert rows quickly:
insert = db.compileStatement(
"INSERT INTO foo (id, aaa, bbb, ccc) " +
"VALUES (?,?,?,?)");
This works correctly and quite fast. However when there is already foo
with id
, I am receiving following exception:
column id is not unique (code 19)
What would be a correct way for overwriting existing row?
What would be a correct way for overwriting existing row?
Specify a conflict resolution strategy , such as
INSERT OR REPLACE INTO foo ...
If the insert would result in a conflict, the conflicting row(s) are first deleted and then the new row is inserted.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.