Rows are not removed if integer setted as param [3.5.3]

I’m using SQLCipher for Android.
I have a table which contains such columns
itemId TEXT UNIQUE,
userId INTEGER
When I request deleting via:
mDB.delete(currentTable, “itemId = ? AND userId = ?”, new String[]{“someID”, “1”});
database removes nothing, but If I query data with same params, database returns data.

It looks like database unable to delete row if I put integer value as selectionArg.

Update:
I’ve checked:
mDB.delete(currentTable, “itemId = ? AND userId = 1”, new String[]{“someID”});
and it works fine.

Hi @Yuriy_Korol

The helper function delete requires all of your parameters to be of type String. You can use the execSQL function to use variable type parameters instead:

mDB.execSQL("DELETE FROM YOUR_TABLE WHERE itemId = ? AND userId = ?;", new Object[]{"someID", 1});

The main problem that this feature worked until 3.5.1 update, same as in regular SQLite. I’m using ContentProvider for comunication with database, so I’m unable to use your workaround.
I’m using this code rigth now:
mDB.delete(currentTable, "itemId = ? AND userId = 1", new String[]{"someID"});

What version of SQLCipher were you using prior to 3.5.1? This function has not changed.

What is preventing you from using execSQL? Are you referring to receiving the arguments in the delete function of a ContentProvider as a String[]? If so, you could always utilize Integer.valueOf(…) on a specific parameter if it’s current type is being represented as a String.

I used 3.2.0 before. After I’ve updated to 3.5.x it becomes broken

Hello @Yuriy_Korol

Thank you for for the additional information. I was able to verify that it did work within SQLCipher for Android 3.2.0. After several internal builds, we have found that it was a behavioral change in upstream SQLite between versions 3.8.10.2 and 3.11.0.

Our recommendation moving forward is to use the execSQL function which will allow more control over binding your parameters.