lundi 22 juin 2015

Android SQLite: Fast insert/update

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?

Aucun commentaire:

Enregistrer un commentaire