public List<Uri> getAllRecentRead() { List<Uri> data = new ArrayList<Uri>(); SQLiteDatabase db = myDBHelper.getReadableDatabase(); Cursor cursor = db.query("myRecentRead_table", null, null, null, null, null, "id desc"); cursor.moveToPosition(-1); while (cursor.moveToNext()) { Uri uri = Uri.parse(cursor.getString(cursor.getColumnIndex("book_path"))); data.add(uri); } return data; }
public Cursor getRecentRead(String book_path) { SQLiteDatabase db = myDBHelper.getReadableDatabase(); Cursor cursor = db.query( "myRecentRead_table", null, "book_path = ?", new String[] {book_path}, null, null, null); return cursor; }
public HashMap<String, String> queryRead(String book_path) { HashMap<String, String> hashMap = new HashMap<String, String>(); Cursor cursor = myDBHelper .getReadableDatabase() .query( "myRead_table", null, "book_path = ?", new String[] {book_path}, null, null, null); cursor.moveToPosition(-1); while (cursor.moveToNext()) { hashMap.put("bookName", cursor.getString(1)); hashMap.put("pageNo", cursor.getString(2)); hashMap.put("title", cursor.getString(3)); } return hashMap; }
public List<Map<String, String>> getAllRead(String book_path) { List<Map<String, String>> data = new ArrayList<Map<String, String>>(); SQLiteDatabase db = myDBHelper.getReadableDatabase(); Cursor cursor = db.query( "myRead_table", null, "book_path = ?", new String[] {book_path}, null, null, "id desc"); cursor.moveToPosition(-1); while (cursor.moveToNext()) { Map<String, String> map = new HashMap<String, String>(); map.put("key", cursor.getString(cursor.getColumnIndex("key"))); map.put("bookName", cursor.getString(cursor.getColumnIndex("book_path"))); map.put("pageNo", cursor.getString(cursor.getColumnIndex("pageNo"))); data.add(map); } return data; }
public void deleteMyRead(String pdfPath) { SQLiteDatabase db = myDBHelper.getReadableDatabase(); db.delete("myRead_table", "book_path=?", new String[] {pdfPath}); }
public void deleteMyRecentRead(int id) { SQLiteDatabase db = myDBHelper.getReadableDatabase(); db.delete("myRecentRead_table", "id=?", new String[] {id + ""}); }