1
0
Fork 0
mirror of https://github.com/geometer/FBReaderJ.git synced 2025-10-03 17:59:33 +02:00

Book UID (in progress)

This commit is contained in:
Nikolay Pultsin 2013-03-17 02:32:41 +04:00
parent 201e5bf1b4
commit 41663bd942
6 changed files with 122 additions and 41 deletions

View file

@ -458,7 +458,7 @@ final class SQLiteBooksDatabase extends BooksDatabase {
cursor.close();
return null;
}
ArrayList<Tag> list = new ArrayList<Tag>();
final ArrayList<Tag> list = new ArrayList<Tag>();
do {
list.add(getTagById(cursor.getLong(0)));
} while (cursor.moveToNext());
@ -466,6 +466,32 @@ final class SQLiteBooksDatabase extends BooksDatabase {
return list;
}
private SQLiteStatement myInsertBookUidStatement;
protected void saveBookUid(long bookId, UID uid) {
if (myInsertBookUidStatement == null) {
myInsertBookUidStatement = myDatabase.compileStatement(
"INSERT OR REPLACE INTO BookUid (book_id,type,uid) VALUES (?,?,?)"
);
}
synchronized (myInsertBookUidStatement) {
myInsertBookUidStatement.bindLong(1, bookId);
myInsertBookUidStatement.bindString(2, uid.Type);
myInsertBookUidStatement.bindString(2, uid.Id);
myInsertBookAuthorStatement.execute();
}
}
protected List<UID> listUids(long bookId) {
final ArrayList<UID> list = new ArrayList<UID>();
final Cursor cursor = myDatabase.rawQuery("SELECT type,uid FROM BookUid WHERE book_id = ?", new String[] { "" + bookId });
if (cursor.moveToNext()) {
list.add(new UID(cursor.getString(0), cursor.getString(1)));
}
cursor.close();
return list;
}
private SQLiteStatement myGetSeriesIdStatement;
private SQLiteStatement myInsertSeriesStatement;
private SQLiteStatement myInsertBookSeriesStatement;