Hello SQLcipher developers/users. I’ve been in Android development for now 13 years and I’ve never seen anything like this.
Yesterday I found out that we need to do the migration from original SQLCipher android lib to the new long-term remplaement. I did just that.
Replaced net.zetetic:android-database-sqlcipher:4.5.4 with net.zetetic:sqlcipher-android:4.7.2@aar
Also I already had androidx.sqlite:sqlite:2.3.1 in the codebase.
Project built correctly. Also, it ran correctly after a modification of passing password to the database unlocking (in SQLiteOpenHelper instead of passing it to in getWritableDatabase or getReadableDatabase).
Now, the only problem I have is with functionality of the app. Everything works fine with the app until you get to a screen needing to show one specific label.
I fetch it like this:
database.rawQuery(sql, arrayOf(testStringId, testIntegerId)).use { cursor →
hasRecords = c.moveToFirst()
hasRecords is always false even though the data is there (I downloaded the database locally, opened it with DB Browser for SQLite, unlocked it with the password and run the same query and it returned the needed results.
Now, the interesting part.
When I fetch it like this:
val sql = “SELECT * FROM TestTable WHERE testStringId = ‘2df6bfd8-9418-4e25-a7ca-29d0a08c6275’ AND testIntegerId = 0”
database.rawQuery(sql, null).use { cursor →
hasRecords = c.moveToFirst()
hasRecords is on true and cursor contains data.
How is that possible? What am I missing? I’ve been on this problem from this morning and I’ve ran out of ideas. Also I’m ready for some mental institution
If anyone experienced something similar I would appreciate the help.