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
2
votes
1 answer

How to read the db file located in assets using sqldelight - Android

I've got massive DB that I only need to create once the app is being installed and that's the reason why I've placed DB file in the assets folder, but I'm not sure how to read from it using SQLDELIGHT, any thoughts?
Taboo
  • 41
  • 6
1
vote
3 answers

SQLDelight Destructive migration

Hi I'm new to Kotlin multiplatform, I'm using SQLDelight for my KMM project. is there a way to completely delete all old contents of old schema from db and point to new schema. i red it supports migration with versions…
Tabz
  • 162
  • 1
  • 1
  • 12
1
vote
1 answer

SQLDelight multiple table creation

I am experimenting with KMM but I have an issue with SQLDelight. Here is the code sample of the AppDatabase.sq file. CREATE TABLE Data ( id INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT, content TEXT NOT NULL ); -- ====>> Add this new table <<====…
LiTTle
  • 1,811
  • 1
  • 20
  • 37
1
vote
1 answer

SQLDelight: [SQLITE_ERROR] SQL error or missing database (table already exists)

I am trying to build a small POC with JetpackCompose Desktop and SQLDelight. I want that the data is persisted even after the application is restarted (not only in memory as all the tutorial examples I encountered show), so I tried this: //…
VCODE
  • 535
  • 5
  • 19
1
vote
0 answers

SELECT query in sqlDelight doesn't return nothing although insert operation works fine

I was developing an Kotlin Multiplatform app, where I'm using SQLDelight as localDatabase, and I get into a trubble when I try to recover all the data keep in it. So, my insert operation works fine, in order I hace the following implementation of my…
Manuel Lucas
  • 636
  • 6
  • 17
1
vote
1 answer

SQLDelight select query with when clause where argument is List of Strings

I have a sql query which selects data based on some filter values getFiltered: SELECT * FROM TaskEntity WHERE CASE WHEN :searchWord IS NOT NULL THEN name LIKE '%' || :searchWord || '%' OR code LIKE '%' || :searchWord || '%' ELSE 1 END AND…
Jemo Mgebrishvili
  • 5,187
  • 7
  • 38
  • 63
1
vote
0 answers

SQLDelight android/ios . Case insensitive select

I use SQLDelight in my kotlin multiplatform app. It works fine. But i see a problem with case insensitive select requests. It doesn't work on iOS. I used the tutorial to integrate SQLDelight in my app…
1
vote
2 answers

SQLDelight convert query return type when using flows

I want to use SQLDelight as a caching layer in my App with the coroutines extension to return a flow from my SQL queries and get notified when the entry in the local Database changes. But because SQLDelight generates it's own class for the stored…
JonasLevin
  • 1,592
  • 1
  • 20
  • 50
1
vote
2 answers

Android Studio - Database inspector is not showing any process

I have an android project with SQLDelight database but i'm facing an issue that the process is not showing under the Database Inspector after i run the app on any device or emulator (i.e emulator Pixel 4, API 28). Note that in the logcat, the…
1
vote
1 answer

Why long packageName results in a line break just before the import as quantifier?

In my Android multimodule project I have: Module A: sqldelight { SomeExampleDb { packageName = "com.example.exampleapp.feature.currency.datasource.example.localstorage" } } Module B: sqldelight { SomeExampleDb { …
dees91
  • 1,211
  • 13
  • 21
1
vote
1 answer

Should I use my package name for KMM SqlDelight config?

I am following this guide and in the first section of this step I have to do the following: sqldelight { database("AppDatabase") { packageName = "com.jetbrains.handson.kmm.shared.cache" } } Question is, should I use .handson. or…
1
vote
0 answers

Front-end Internal error: Failed to analyze declaration for SQLDelight Table

I was trying to run ./gradlew build on my kotlin multiplatform project, however the build failed with this error. It seems like the SQLDelight Event database could not be generated. e: Compilation failed: Front-end Internal error: Failed to analyze…
1
vote
1 answer

SQLDelight: how to create table dynamically?

I saw examples where we can create a table with fixed name using sq file like that CREATE TABLE hockeyPlayer ( player_number INTEGER NOT NULL, full_name TEXT NOT NULL ); I need to create tables with arbitrary names at runtime, how could I…
schmidt9
  • 4,436
  • 1
  • 26
  • 32
1
vote
1 answer

Gradle build for sqldelight Generation failed with line 17:10 - '{' expected, got ':' Android Studio version 4.1.2

I am converting a working Android Studio app to the KMM Environment. At this point I have a very simple KMM framework. Once I added SQLDelight to the common packages I started getting the following error on my build. I have checked every example I…
BroPage
  • 129
  • 10
1
vote
0 answers

Possible to override toString for SQLDelight generated class?

I'm using SQLDelight to generate models for an app I'm working on. Is there a way to specify a custom toString method for the generated data classes? I realize I could create a subclass and override it but I'd prefer not to do that.
Vijay
  • 65
  • 7
1 2 3
8 9