Questions tagged [sqldelight]

SQLDelight generates Java models from your SQL statements. These models give you a typesafe API to read & write the rows of your tables. It helps you to keep your SQL statements together, organized, and easy to access from Java.

SQLDelight generates typesafe APIs from your SQL statements. It compile-time verifies your schema, statements, and migrations and provides IDE features like autocomplete and refactoring which make writing and maintaining SQL simple. SQLDelight currently supports the SQLite dialect and there are supported SQLite drivers on Android, JVM and iOS.

The premise of SQLDelight is unchanged: Write SQLite and let the Gradle plugin generate APIs to run your queries for you. SQLDelight files use the .sq extensions and are contained in your src/main/sqldelight folder in a Gradle module.

122 questions
0
votes
1 answer

How to provide SqlDelight database in Compose Multiplatform using KodeIn

So far i've managed to declare expect class for DriverFactory expect class DriverFactory { fun createDriver(): SqlDriver } actual class DriverFactory(private val context: Context) { actual fun createDriver(): SqlDriver { return…
0
votes
1 answer

Database on Jetpack compose desktop

I'm developing with Jetpack Compose Desktop and having a hard time finding any up to date information on what libraries are available for database storage. Room is obviously not an option. I have heard sqldelight is an option but not able to find…
Jaz
  • 371
  • 1
  • 6
  • 20
0
votes
0 answers

sqldelight database setup for Compose Desktop, generated code is in wrong package

So I'm trying to set up sqldelight for my Compose Desktop project I created using IntelliJ's wizard. The generated project has its source code in ./src/JvmMain. As it is a Desktop only project, there is no expected/actual setup with…
michpohl
  • 852
  • 8
  • 30
0
votes
1 answer

How to prevent SQLDelight RC-2.0 potential memory leak on mapToList() with coroutineContext?

I am working on a KMM project to understand the usage of Apollo GraphQL and SQLDelight more deeply. I am using layer-by-layer multi modularization and in my domain module, I am trying to map entities I have collected from SQLDelight to my domain…
Subfly
  • 492
  • 2
  • 13
0
votes
1 answer

Pre populate database in KMM on iOS side using SQLDelight

I want to pre-populate the database in my KMM project. I’m using SQLDelight. I have this implementation for the Android side. actual fun Scope.createDriver(): SqlDriver { val context = androidContext() val fileName = "dbFileName" val…
0
votes
0 answers

Database schema and table classes are not getting generated using sqldelight for Multiplatform project

I have been trying to learn Kotlin multiplatform using the tutorial video https://www.youtube.com/watch?v=1w-LTUm_iDE from Phillip where he is explaining creating a Note app using Sqldelight. I have been doing exactly the same but i am getting weird…
anshul
  • 982
  • 1
  • 11
  • 33
0
votes
1 answer

Changes in database are not being collected when using Flow, but when using App Inspector it does collect

I have an SQL query that selects all items where two of the fields are NULL. My repository looks like this: override suspend fun flowTeamsWithNoGroupByGameId(gameId: Int): Flow> { return transactionQueries …
MS2099
  • 369
  • 2
  • 11
0
votes
0 answers

problem with WITH RECURSIVE in Sqldelight

SQLDelight Version 2.0.0-alpha05 Hi guys When I use WITH RECURSIVE in the sq file in sqldelight, it gives me the following error. please help me. SQL Code: WITH RECURSIVE `name_tree` AS ( SELECT `id`, `parent_id` FROM `tbl_accounts` WHERE `id` =…
0
votes
0 answers

Error when using SqlDelight's JdbcSqliteDriver in the Android Studio Composable Preview

Android Studio can not render the following preview: @Preview @Composable private fun MyPreview() { JdbcSqliteDriver(JdbcSqliteDriver.IN_MEMORY) } Instead, the following warning is displayed: And the cause of the error is…
0
votes
1 answer

Android: Save variable across all user profiles

I have an application that can have multiple users on the device. I have a counter that needs to be read and updated across all users. Is there a way that this variable can persist across all user profiles? We want to avoid using Settings.Global…
user3826764
  • 198
  • 1
  • 9
0
votes
1 answer

Using SqlDelight with Flow and also mapping Entities to a wrapper object

I am using SqlDelight and Kotlin Multiplatform and am wondering if there is a way to map the returned record entities to a helper class before returning the Flow. Here is normal usage: val players: Flow> = …
ineedhelp
  • 17
  • 1
  • 4
0
votes
0 answers

Attempting to alter something that is not a table, when do a migration with SqlDelight

I'm blocking on this issue, i have a file .sqm to migrate my database from version 1 to version 2 as follow: ALTER TABLE MyTable ADD COLUMN name TEXT DEFAULT ""; ALTER TABLE MyTable ADD COLUMN phoneNumber TEXT DEFAULT ""; This file is in the same…
0
votes
0 answers

Initialize object lateinit property for test

I am using kotlin multiplatform for my project. SQLDelight is used to build the database. While writing a test for one of the classes using DataBaseCache I encountered the error lateinit property appContext has not been initialized. How can I…
Sunbey13
  • 339
  • 4
  • 12
0
votes
1 answer

kotlin flow call list item details async

let us say I have //roomdb @Query("SELECT * FROM Dog") fun getAllDogs(): Flow> // getDogDetails suspend fun getDogDetils(id:Int) :DogDetails I want to hit endpoint to get dog details, however room,sqldelight return Flow as Oneshot,…
العبد
  • 359
  • 5
  • 15
0
votes
1 answer

SQLiteException unknown error (code 0 SQLITE_OK): Native could not read blob slot

I see the following error when retrieving data from sqldelight database, and it only happens if the retrieved data is relatively big. android.database.sqlite.SQLiteException · unknown error (code 0 SQLITE_OK): Native could not read blob slot…
Levon Petrosyan
  • 8,815
  • 8
  • 54
  • 65
1 2 3
8 9