Is there a way to get SQLDelight to work with <Sql...
# squarelibraries
c
Is there a way to get SQLDelight to work with Sqlite's JSON support? I'm looking specifically for mobile platforms (Android and iOS). I'm guessing that the first step would probably be to bundle an Sqlite along with the app (because I don't think the version of Sqlite on the mobile platforms supports the JSON features yet). But assuming that is done, can SQLDelight be taught to understand queries specific to JSON?
d
When you configure your database in Gradle, you can add
module("app.cash.sqldelight:sqlite-json-module:{version}")
to enable json support
👍 1
👍🏻 1
Unfortunately this wasn't documented anywhere (yet)
c
I'll search in the SqlDelight source for that string. Maybe I'll find some tests to understand usage.
c
TIL sqlite has json support
1
c
@Colton Idle It is only in a very recent version of Sqlite that this support was added. IIRC, only Android API 34 ships with a compatible version.
🤔 1
v
@Colton Idle you can use Requery's Android SQL to bundle a newer version of SQLite within your application, so you get a standardised SQLite version across all devices that your app will run on. Or, alternatively, SQLCipher, which works like Requery's, with extra encryption. These will provide you with a SQLDriver, which you can pass to SQLDelight when creating the database, and life goes as normal.
c
@Vitor Hugo Schwaab do you have any idea if something similar exists for iOS?
m
Latest version of SQLite3MultipleCiphers compiled for Android/Jvm/DarwinMobile targets. Don't even need to utilize encryption if you do not want, but can have the same (relatively) build of latest SQLite3 (with encryption layer on top) for all platforms. https://github.com/toxicity-io/sqlite-mc
❤️ 2