Hello does anyone have a sample code for sqldeligh...
# multiplatform
m
Hello does anyone have a sample code for sqldelight used in kotlin multiplatform using expect and actual for driver implementation pleaz?
m
I dont see the use of expect and actual here : https://github.com/square/sqldelight/tree/master/sample/common/src
but thank you for the share
s
you are right, i must have found the information in a guthub issue. so basically for ios and android you have "actual var sqlDriver: SqlDriver? = null" as actual
and in andorid on your application onCreate you do for example " sqlDriver = AndroidSqliteDriver(SqlDelightDatabase.Schema, applicationContext, "1.db")"
m
getting this error : android.database.sqlite.SQLiteException: near "to": syntax error (code 1 SQLITE_ERROR): , while compiling: CREATE TABLE history
here : override fun create(driver: SqlDriver) { driver.execute(null, """ |CREATE TABLE history ( | base TEXT NOT NULL, | to TEXT NOT NULL, | value TEXT NOT NULL, | date TEXT NOT NULL |) """.trimMargin(), 0) }
works fine changed "to" to another string
👍 1