How to check if there was conflict in SQLite Data Base in Android upon inserting? I am using unique keys on 3 rows (id, isbn, google_id) and I simply always add and ignore conflict. What are the ways to get conflicts upon inserting in entry already exists. Should I query before or I can get like "some kind of trace back" so that I will be able to notify user that entry already exists?
SQLiteDatabase db = this.getWritableDatabase();
ContentValues values = new ContentValues();
values.put(KEY_TITLE, book.getTitle());
values.put ...
long id = db.insertWithOnConflict(TABLE_BOOKS,
null,
values,
SQLiteDatabase.CONFLICT_IGNORE);
db.close();
return (int) id;
