Repository navigation
SQLCipherStatement.getColumnType: report SQLITE_DATA_* values (NULL was 0) - #94
Merged
developernotes merged 2 commits intoSep 29, 2026
Conversation
… values SQLCipherStatement implements androidx.sqlite.SQLiteStatement, whose getColumnType contract is androidx.sqlite's SQLITE_DATA_* constants. A NULL column is currently reported as Cursor.FIELD_TYPE_NULL (0) rather than SQLITE_DATA_NULL (5), so room3-sqlite-wrapper's toCursor() throws IllegalStateException: Unknown column type: 0 on any NULL value.
…mnType getColumnType returned Cursor.getType() unchanged. Cursor.FIELD_TYPE_NULL is 0 while androidx.sqlite's SQLITE_DATA_NULL is 5, so every NULL column violated the SQLiteStatement contract. Each Cursor field type is now mapped explicitly, and an unknown value throws instead of passing through.
Member
|
Hi @ZoeyJones, Thanks for submitting this, we are including this in the 4.19.1 release. |
Contributor
Author
|
Thank you for the trust and support. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
SQLCipherStatementimplementsandroidx.sqlite.SQLiteStatement, sogetColumnType(int)should return androidx.sqlite'sSQLITE_DATA_*constants. It currently returnsandroid.database.Cursor.getType(index)unchanged. The two sets agree for INTEGER, FLOAT, TEXT and BLOB (1–4), but a NULL column reportsCursor.FIELD_TYPE_NULL(0) instead ofSQLITE_DATA_NULL(5). With Room 3'sroom3-sqlite-wrapper, this makesgetSupportWrapper().query(...)throwIllegalStateException: Unknown column type: 0on the first NULL value.Change
getColumnTypenow maps eachCursor.FIELD_TYPE_*to itsSQLite.SQLITE_DATA_*value explicitly, and throws on an unknown value instead of passing it through.SQLCipherConnectionTests:getColumnTypereportsSQLITE_DATA_*for NULL, INTEGER, FLOAT, TEXT and BLOB.SupportAPIRoomTest: agetSupportWrapper().query(...)over a NULL column succeeds.Verification
master(bc71616) the tests fail:expected:<5> but was:<0>, andUnknown column type: 0.net.zetetic.database.sqlcipher.driverpackage passes: 37/37 on an API 36 arm64 emulator.Contributor agreement
Individual Contributor Agreement signed via DocuSign and completed by Zetetic on 2026-09-27, as requested in #93.
Fixes #93