You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When using a not in-memory DB on Android, a single table fails to be created while multiple others are successfully created.
Creation of tables can be verified by removing any usage of the failing Table, allowing for testing of other successfully created tables in the DB.
The database and all tables are successfully created on Desktop, which only uses in-memory. Link
Exact codebase and commit provided to showcase failing and successful case.
Simplest version of the failing Table:
CREATETABLEDatabaseNews (
id INTEGERPRIMARY KEYNOT NULL,
title TEXTNOT NULL
);
Android failing setup:
actualclassDriverFactory(privatevalcontext:Context) {
actualfuncreateDriver(): SqlDriver {
returnAndroidSqliteDriver(
schema =Database.Schema,
context = context,
name ="Domain.db"// <-- Omitting this field will lead to creating in-memory DB and successful DB creation.
)
}
}
SQLite logcat output does not show any specific failure:
30293-30293 SQLiteStatements pm.bam.mbc V /data/user/0/pm.bam.mbc/databases/Domain.db: "PRAGMA page_size"
30293-30293 SQLiteStatements pm.bam.mbc V /data/user/0/pm.bam.mbc/databases/Domain.db: "PRAGMA foreign_keys"
30293-30293 SQLiteStatements pm.bam.mbc V /data/user/0/pm.bam.mbc/databases/Domain.db: "PRAGMA journal_mode"
30293-30293 SQLiteStatements pm.bam.mbc V /data/user/0/pm.bam.mbc/databases/Domain.db: "PRAGMA journal_mode=TRUNCATE"
30293-30293 SQLiteStatements pm.bam.mbc V /data/user/0/pm.bam.mbc/databases/Domain.db: "PRAGMA synchronous"
30293-30293 SQLiteStatements pm.bam.mbc V /data/user/0/pm.bam.mbc/databases/Domain.db: "PRAGMA journal_size_limit"
30293-30293 SQLiteStatements pm.bam.mbc V /data/user/0/pm.bam.mbc/databases/Domain.db: "PRAGMA journal_size_limit=524288"
30293-30293 SQLiteStatements pm.bam.mbc V /data/user/0/pm.bam.mbc/databases/Domain.db: "PRAGMA wal_autocheckpoint"
30293-30293 SQLiteStatements pm.bam.mbc V /data/user/0/pm.bam.mbc/databases/Domain.db: "PRAGMA wal_autocheckpoint=100"
30293-30293 SQLiteStatements pm.bam.mbc V /data/user/0/pm.bam.mbc/databases/Domain.db: "CREATE TABLE IF NOT EXISTS android_metadata (locale TEXT)"
30293-30293 SQLiteStatements pm.bam.mbc V /data/user/0/pm.bam.mbc/databases/Domain.db: "SELECT locale FROM android_metadata UNION SELECT NULL ORDER BY locale DESC LIMIT 1"
30293-30293 SQLiteStatements pm.bam.mbc V /data/user/0/pm.bam.mbc/databases/Domain.db: "PRAGMA user_version;"
30293-30293 SQLiteStatements pm.bam.mbc V /data/user/0/pm.bam.mbc/databases/Domain.db: "PRAGMA user_version;"
30293-30293 SQLiteStatements pm.bam.mbc V /data/user/0/pm.bam.mbc/databases/Domain.db: "BEGIN IMMEDIATE;"
30293-30293 SQLiteLog pm.bam.mbc E (1) no such table: DatabaseNews in "DELETE FROM DatabaseNews"
30293-30293 SQLiteStatements pm.bam.mbc V /data/user/0/pm.bam.mbc/databases/Domain.db: "ROLLBACK;"
30293-30293 AndroidRuntime pm.bam.mbc E FATAL EXCEPTION: main
Process: pm.bam.mbc, PID: 30293
android.database.sqlite.SQLiteException: no such table: DatabaseNews (code 1 SQLITE_ERROR): , while compiling: DELETE FROM DatabaseNews
Stacktrace
FATAL EXCEPTION: main
Process: pm.bam.mbc, PID: 29947
android.database.sqlite.SQLiteException: no such table: DatabaseNews (code 1 SQLITE_ERROR): , while compiling: DELETE FROM DatabaseNews
at android.database.sqlite.SQLiteConnection.nativePrepareStatement(Native Method)
at android.database.sqlite.SQLiteConnection.acquirePreparedStatement(SQLiteConnection.java:1069)
at android.database.sqlite.SQLiteConnection.prepare(SQLiteConnection.java:673)
at android.database.sqlite.SQLiteSession.prepare(SQLiteSession.java:590)
at android.database.sqlite.SQLiteProgram.<init>(SQLiteProgram.java:62)
at android.database.sqlite.SQLiteStatement.<init>(SQLiteStatement.java:34)
at android.database.sqlite.SQLiteDatabase.compileStatement(SQLiteDatabase.java:1392)
at androidx.sqlite.db.framework.FrameworkSQLiteDatabase.compileStatement(FrameworkSQLiteDatabase.kt:51)
at app.cash.sqldelight.driver.android.AndroidSqliteDriver$execute$1.invoke(AndroidSqliteDriver.kt:184)
at app.cash.sqldelight.driver.android.AndroidSqliteDriver$execute$1.invoke(AndroidSqliteDriver.kt:184)
at app.cash.sqldelight.driver.android.AndroidSqliteDriver.execute-zeHU3Mk(AndroidSqliteDriver.kt:163)
at app.cash.sqldelight.driver.android.AndroidSqliteDriver.execute(AndroidSqliteDriver.kt:184)
at app.cash.sqldelight.db.SqlDriver$DefaultImpls.execute$default(SqlDriver.kt:63)
at pmbammbcdomain.DatabaseNewsQueries.deleteAll(DatabaseNewsQueries.kt:170)
...
...
...
The text was updated successfully, but these errors were encountered:
SQLDelight Version
2.0.2
Application Operating System
Android, iOS, Native
Describe the Bug
When using a not in-memory DB on Android, a single table fails to be created while multiple others are successfully created.
Creation of tables can be verified by removing any usage of the failing Table, allowing for testing of other successfully created tables in the DB.
The database and all tables are successfully created on Desktop, which only uses in-memory. Link
Exact codebase and commit provided to showcase failing and successful case.
Simplest version of the failing Table:
Android failing setup:
This commit showcases the fail vs success in openly available repo, allowing for reproducing issue:
https://github.com/Mithrandir21/monkey_barrel_comedy_app/commit/5d9c0f4f865ca7448f0d1ec64641430458349d9e
SQLite logcat output does not show any specific failure:
Stacktrace
The text was updated successfully, but these errors were encountered: