mirror of
https://github.com/geometer/FBReaderJ.git
synced 2025-10-04 18:29:23 +02:00
possible fix of sqlite constraint exception
This commit is contained in:
parent
27ec0da8e3
commit
fe97b64abc
1 changed files with 2 additions and 2 deletions
|
@ -294,7 +294,7 @@ public final class SQLiteBooksDatabase extends BooksDatabase {
|
||||||
protected void updateBookInfo(long bookId, long fileId, String encoding, String language, String title) {
|
protected void updateBookInfo(long bookId, long fileId, String encoding, String language, String title) {
|
||||||
if (myUpdateBookInfoStatement == null) {
|
if (myUpdateBookInfoStatement == null) {
|
||||||
myUpdateBookInfoStatement = myDatabase.compileStatement(
|
myUpdateBookInfoStatement = myDatabase.compileStatement(
|
||||||
"UPDATE Books SET file_id = ?, encoding = ?, language = ?, title = ? WHERE book_id = ?"
|
"UPDATE OR IGNORE Books SET file_id = ?, encoding = ?, language = ?, title = ? WHERE book_id = ?"
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
myUpdateBookInfoStatement.bindLong(1, fileId);
|
myUpdateBookInfoStatement.bindLong(1, fileId);
|
||||||
|
@ -1117,7 +1117,7 @@ public final class SQLiteBooksDatabase extends BooksDatabase {
|
||||||
"SELECT book_id,file_name FROM Books", null
|
"SELECT book_id,file_name FROM Books", null
|
||||||
);
|
);
|
||||||
final SQLiteStatement deleteStatement = myDatabase.compileStatement("DELETE FROM Books WHERE book_id = ?");
|
final SQLiteStatement deleteStatement = myDatabase.compileStatement("DELETE FROM Books WHERE book_id = ?");
|
||||||
final SQLiteStatement updateStatement = myDatabase.compileStatement("UPDATE Books SET file_id = ? WHERE book_id = ?");
|
final SQLiteStatement updateStatement = myDatabase.compileStatement("UPDATE OR IGNORE Books SET file_id = ? WHERE book_id = ?");
|
||||||
while (cursor.moveToNext()) {
|
while (cursor.moveToNext()) {
|
||||||
final long bookId = cursor.getLong(0);
|
final long bookId = cursor.getLong(0);
|
||||||
final long fileId = infoSet.getId(ZLFile.createFileByPath(cursor.getString(1)));
|
final long fileId = infoSet.getId(ZLFile.createFileByPath(cursor.getString(1)));
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue