Status Update
Comments
da...@google.com <da...@google.com> #2
Hey - Can you share more about your use-case? Is it because you don't know the schema and are pragmatically retrieving data out of the database? Usually applications know the schemas in their database and in general SQLite is very 'loose' on types, i.e. even if an integer is in the column one can read it as a text, see
da...@google.com <da...@google.com> #3
The workaround is to call getText() always, but I can't then format numbers using user locale, another problem are binary data.
The implementation is there in native driver, it is just private. What I ask for is make it public (add it to interface) and maybe expose sqlite type constants, but it is not required and easy to workaround.
Here is screenshot from another database viewer (written in PHP) to have better idea about the use case:
Edit: the getColumnType() is used in isNull() method.
da...@google.com <da...@google.com> #4
Makes sense, thank you for your input, I think we can formalize the getColumnType()
API and make it public.
ap...@google.com <ap...@google.com> #5
Project: platform/frameworks/support
Branch: androidx-main
Author: Daniel Santiago Rivera <
Link:
Add API to SQLiteStatement to get a column's data type
Expand for full commit details
Add API to SQLiteStatement to get a column's data type
Bug: 369636251
Relnote: "Add SQLiteStatement.getColumnType() along with the various SQLITE_DATA_* result constants to enable retrieving the data type of a column."
Test: ./sqlite/scripts/runConformanceTest.sh
Change-Id: I1985c7b267ba4d6342cb487cbe6e889bed3ff26d
Files:
- M
room/room-runtime/src/androidMain/kotlin/androidx/room/driver/SupportSQLiteStatement.android.kt
- M
room/room-runtime/src/androidUnitTest/kotlin/androidx/room/InvalidationTrackerTest.kt
- M
room/room-runtime/src/commonMain/kotlin/androidx/room/RoomRawQuery.kt
- M
room/room-runtime/src/commonMain/kotlin/androidx/room/coroutines/ConnectionPoolImpl.kt
- M
sqlite/integration-tests/driver-conformance-test/src/commonTest/kotlin/androidx/sqlite/driver/test/BaseConformanceTest.kt
- M
sqlite/sqlite-bundled/src/jvmAndroidMain/kotlin/androidx/sqlite/driver/bundled/BundledSQLiteStatement.jvmAndroid.kt
- M
sqlite/sqlite-framework/bcv/native/current.txt
- M
sqlite/sqlite-framework/src/androidMain/kotlin/androidx/sqlite/driver/AndroidSQLiteStatement.android.kt
- M
sqlite/sqlite-framework/src/nativeMain/kotlin/androidx/sqlite/driver/NativeSQLiteStatement.kt
- M
sqlite/sqlite/api/current.txt
- M
sqlite/sqlite/api/restricted_current.txt
- M
sqlite/sqlite/bcv/native/current.txt
- M
sqlite/sqlite/src/commonMain/kotlin/androidx/sqlite/SQLite.kt
- M
sqlite/sqlite/src/commonMain/kotlin/androidx/sqlite/SQLiteStatement.kt
Hash: 3001a3332b004f92b2df33ec16f312368e3b2570
Date: Thu Sep 26 21:29:43 2024
ap...@google.com <ap...@google.com> #6
da...@google.com <da...@google.com>
na...@google.com <na...@google.com> #7
The following release(s) address this bug.It is possible this bug has only been partially addressed:
androidx.room:room-runtime:2.7.0-alpha10
androidx.room:room-runtime-android:2.7.0-alpha10
androidx.room:room-runtime-macosx64:2.7.0-alpha10
androidx.sqlite:sqlite-bundled-iossimulatorarm64:2.5.0-alpha10
androidx.sqlite:sqlite-bundled-iosx64:2.5.0-alpha10
androidx.sqlite:sqlite-bundled-jvm:2.5.0-alpha10
androidx.sqlite:sqlite-bundled-linuxarm64:2.5.0-alpha10
androidx.sqlite:sqlite-bundled-linuxx64:2.5.0-alpha10
androidx.sqlite:sqlite-bundled-macosarm64:2.5.0-alpha10
androidx.sqlite:sqlite-bundled-macosx64:2.5.0-alpha10
androidx.sqlite:sqlite-framework:2.5.0-alpha10
androidx.sqlite:sqlite-framework-android:2.5.0-alpha10
androidx.sqlite:sqlite-framework-iosarm64:2.5.0-alpha10
androidx.sqlite:sqlite-framework-iossimulatorarm64:2.5.0-alpha10
androidx.sqlite:sqlite-framework-iosx64:2.5.0-alpha10
androidx.sqlite:sqlite-framework-linuxarm64:2.5.0-alpha10
androidx.sqlite:sqlite-framework-linuxx64:2.5.0-alpha10
androidx.sqlite:sqlite-framework-macosarm64:2.5.0-alpha10
androidx.sqlite:sqlite-framework-macosx64:2.5.0-alpha10
androidx.sqlite:sqlite-iosarm64:2.5.0-alpha10
androidx.sqlite:sqlite-iossimulatorarm64:2.5.0-alpha10
androidx.sqlite:sqlite-iosx64:2.5.0-alpha10
androidx.sqlite:sqlite-jvm:2.5.0-alpha10
androidx.sqlite:sqlite-linuxarm64:2.5.0-alpha10
androidx.sqlite:sqlite-linuxx64:2.5.0-alpha10
androidx.sqlite:sqlite-macosarm64:2.5.0-alpha10
androidx.sqlite:sqlite-macosx64:2.5.0-alpha10
Description
API checks and Java ecosystem recommends SQLiteConnection and SQLiteStatement to implement Closeable / AutoCloseable but there is no KMP common Closeable interface. Other art work has defined a expect Closeable in commonMain and have actual typealias to Java's interface and implemented utility function in native.
It would be also nice if we can add finalizers to close things and warn about leaks. JVM and Android has finalizer APIs (https://docs.oracle.com/javase/9/docs/api/java/lang/ref/Cleaner.html ) along with the soon-to-be-deprecated https://kotlinlang.org/docs/java-interop.html#finalize ) and in iOS there is https://kotlinlang.org/docs/native-ios-integration.html#deinitializers ). But I don't think there is anything available for native...
finalize()
(deinit
(