1 year ago
#382715
Ernxe
deleting Blob from SQLiteCipher db
I am storing images in SQLiteCipher as a blob (byte[] form):
public void insertNewImageBlob (byte[] image, String password) {
System.out.println(image);
SQLiteDatabase db = instance.getWritableDatabase(password);
ContentValues values = new ContentValues();
values.put(COLUMN_IMAGE, image);
db.insert(TABLE_NAME,null,values);
db.close();
}
The table has nothing just a list of byte array, no ids or anything. Insertion is good, RecyclerView shows all the images from the database, now then the user clicks on the image, i want the one to be deleted. So, user clicks an image and I send the image to deleteImage method to delete it from the database.
Here is the code trying me to Delete a single image:
public void deleteImage (String password, byte[] image) {
SQLiteDatabase db = instance.getWritableDatabase(password);
ContentValues values = new ContentValues();
values.put(COLUMN_IMAGE,image);
db.delete(TABLE_NAME,COLUMN_IMAGE+"='"+ image +"'",null);
db.close();
}
But it does not delete the image from the database.
java
android
sqlite
android-sqlite
0 Answers
Your Answer