https://kotlinlang.org logo
#multiplatform
Title
# multiplatform
m

mben

05/20/2019, 2:54 PM
Hello does anyone have a sample code for sqldelight used in kotlin multiplatform using expect and actual for driver implementation pleaz?
m

mben

05/21/2019, 7:43 AM
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

Simon Schubert

05/21/2019, 8:17 AM
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

mben

05/21/2019, 10:47 AM
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
2 Views