diff --git a/src/org/geometerplus/android/fbreader/library/SQLiteBooksDatabase.java b/src/org/geometerplus/android/fbreader/library/SQLiteBooksDatabase.java index 9f4aaec5f..fd461864d 100644 --- a/src/org/geometerplus/android/fbreader/library/SQLiteBooksDatabase.java +++ b/src/org/geometerplus/android/fbreader/library/SQLiteBooksDatabase.java @@ -71,7 +71,7 @@ public final class SQLiteBooksDatabase extends BooksDatabase { private void migrate(Context context) { final int version = myDatabase.getVersion(); - final int currentVersion = 19; + final int currentVersion = 20; if (version >= currentVersion) { return; } @@ -118,6 +118,8 @@ public final class SQLiteBooksDatabase extends BooksDatabase { updateTables17(); case 18: updateTables18(); + case 19: + updateTables19(); } myDatabase.setTransactionSuccessful(); myDatabase.setVersion(currentVersion); @@ -861,42 +863,6 @@ public final class SQLiteBooksDatabase extends BooksDatabase { myStorePositionStatement.execute(); } - private SQLiteStatement myInsertIntoBookListStatement; - protected boolean insertIntoBookList(long bookId) { - if (myInsertIntoBookListStatement == null) { - myInsertIntoBookListStatement = myDatabase.compileStatement( - "INSERT OR IGNORE INTO BookList(book_id) VALUES (?)" - ); - } - myInsertIntoBookListStatement.bindLong(1, bookId); - myInsertIntoBookListStatement.execute(); - return true; - } - - private SQLiteStatement myDeleteFromBookListStatement; - protected boolean deleteFromBookList(long bookId) { - if (myDeleteFromBookListStatement == null) { - myDeleteFromBookListStatement = myDatabase.compileStatement( - "DELETE FROM BookList WHERE book_id = ?" - ); - } - myDeleteFromBookListStatement.bindLong(1, bookId); - myDeleteFromBookListStatement.execute(); - deleteVisitedHyperlinks(bookId); - return true; - } - - private SQLiteStatement myCheckBookListStatement; - protected boolean checkBookList(long bookId) { - if (myCheckBookListStatement == null) { - myCheckBookListStatement = myDatabase.compileStatement( - "SELECT COUNT(*) FROM BookList WHERE book_id = ?" - ); - } - myCheckBookListStatement.bindLong(1, bookId); - return myCheckBookListStatement.simpleQueryForLong() > 0; - } - private SQLiteStatement myDeleteVisitedHyperlinksStatement; private void deleteVisitedHyperlinks(long bookId) { if (myDeleteVisitedHyperlinksStatement == null) { @@ -1276,4 +1242,8 @@ public final class SQLiteBooksDatabase extends BooksDatabase { cursor.close(); myDatabase.execSQL("DROP TABLE BookSeries_Obsolete"); } + + private void updateTables19() { + myDatabase.execSQL("DROP TABLE BookList"); + } } diff --git a/src/org/geometerplus/fbreader/book/Book.java b/src/org/geometerplus/fbreader/book/Book.java index 6b547cc61..6da1f929a 100644 --- a/src/org/geometerplus/fbreader/book/Book.java +++ b/src/org/geometerplus/fbreader/book/Book.java @@ -407,12 +407,6 @@ public class Book { } } - public void insertIntoBookList() { - if (myId != -1) { - BooksDatabase.Instance().insertIntoBookList(myId); - } - } - public String getContentHashCode() { InputStream stream = null; diff --git a/src/org/geometerplus/fbreader/book/BookCollection.java b/src/org/geometerplus/fbreader/book/BookCollection.java index b471a02db..fb40efcda 100644 --- a/src/org/geometerplus/fbreader/book/BookCollection.java +++ b/src/org/geometerplus/fbreader/book/BookCollection.java @@ -179,7 +179,6 @@ public class BookCollection implements IBookCollection { if (ids.remove(book.getId())) { myDatabase.saveRecentBookIds(ids); } - myDatabase.deleteFromBookList(book.getId()); if (deleteFromDisk) { book.File.getPhysicalFile().delete(); } @@ -311,7 +310,6 @@ public class BookCollection implements IBookCollection { physicalFiles.add(file); } if (file != book.File && file != null && file.getPath().endsWith(".epub")) { - myDatabase.deleteFromBookList(book.getId()); continue; } if (book.File.exists()) { diff --git a/src/org/geometerplus/fbreader/book/BooksDatabase.java b/src/org/geometerplus/fbreader/book/BooksDatabase.java index 9fdf79986..0aac21fba 100644 --- a/src/org/geometerplus/fbreader/book/BooksDatabase.java +++ b/src/org/geometerplus/fbreader/book/BooksDatabase.java @@ -102,10 +102,6 @@ public abstract class BooksDatabase { protected abstract ZLTextPosition getStoredPosition(long bookId); protected abstract void storePosition(long bookId, ZLTextPosition position); - protected abstract boolean insertIntoBookList(long bookId); - protected abstract boolean deleteFromBookList(long bookId); - protected abstract boolean checkBookList(long bookId); - protected abstract Collection loadVisitedHyperlinks(long bookId); protected abstract void addVisitedHyperlink(long bookId, String hyperlinkId); } diff --git a/src/org/geometerplus/fbreader/fbreader/FBReaderApp.java b/src/org/geometerplus/fbreader/fbreader/FBReaderApp.java index 88967cc49..b77709fb7 100644 --- a/src/org/geometerplus/fbreader/fbreader/FBReaderApp.java +++ b/src/org/geometerplus/fbreader/fbreader/FBReaderApp.java @@ -342,14 +342,12 @@ public final class FBReaderApp extends ZLApplication { } Book book = Collection.getBookByFile(file); if (book != null) { - book.insertIntoBookList(); return book; } if (file.isArchive()) { for (ZLFile child : file.children()) { book = Collection.getBookByFile(child); if (book != null) { - book.insertIntoBookList(); return book; } }