diff --git a/gradle.properties b/gradle.properties index a0c5cb1e..eb3e679a 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,7 +1,7 @@ kotlin.code.style=official GROUP=co.touchlab -VERSION_NAME=1.2.0 +VERSION_NAME=1.2.1 KOTLIN_VERSION=1.6.20 kotlin.native.ignoreDisabledTargets=true diff --git a/sqliter-driver/src/nativeCommonMain/kotlin/co/touchlab/sqliter/interop/ActualSqliteStatement.kt b/sqliter-driver/src/nativeCommonMain/kotlin/co/touchlab/sqliter/interop/ActualSqliteStatement.kt index 45bd2c13..bdbaa9de 100644 --- a/sqliter-driver/src/nativeCommonMain/kotlin/co/touchlab/sqliter/interop/ActualSqliteStatement.kt +++ b/sqliter-driver/src/nativeCommonMain/kotlin/co/touchlab/sqliter/interop/ActualSqliteStatement.kt @@ -129,7 +129,8 @@ internal class ActualSqliteStatement(private val db: SqliteDatabase, private val private inline fun opResult(db: SqliteDatabase, block: () -> Int) { val err = block() if (err != SQLITE_OK) { - throw sqlException(db.logger, db.config, "Sqlite operation failure", err) + val error = sqlite3_errmsg(db.dbPointer)?.toKString() + throw sqlException(db.logger, db.config, "Sqlite operation failure ${error?:""}", err) } } diff --git a/sqliter-driver/src/nativeCommonMain/kotlin/co/touchlab/sqliter/interop/SqliteDatabase.kt b/sqliter-driver/src/nativeCommonMain/kotlin/co/touchlab/sqliter/interop/SqliteDatabase.kt index 61907b6e..b7ad6966 100644 --- a/sqliter-driver/src/nativeCommonMain/kotlin/co/touchlab/sqliter/interop/SqliteDatabase.kt +++ b/sqliter-driver/src/nativeCommonMain/kotlin/co/touchlab/sqliter/interop/SqliteDatabase.kt @@ -40,7 +40,8 @@ internal class SqliteDatabase(path: String, label: String, val logger: Logger, p fun rawExecSql(sqlString: String){ val err = sqlite3_exec(dbPointer, sqlString, null, null, null) if (err != SQLITE_OK) { - throw sqlException(logger, config, "error rawExecSql: $sqlString", err) + val error = sqlite3_errmsg(dbPointer)?.toKString() + throw sqlException(logger, config, "error rawExecSql: $sqlString, ${error?:""}", err) } } @@ -97,8 +98,9 @@ internal fun dbOpen( if (lookasideSlotSize >= 0 && lookasideSlotCount >= 0) { val err = sqlite3_db_config(db, SQLITE_DBCONFIG_LOOKASIDE, null, lookasideSlotSize, lookasideSlotCount); if (err != SQLITE_OK) { + val error = sqlite3_errmsg(db)?.toKString() sqlite3_close(db) - throw sqlException(logging, SqliteDatabaseConfig(path, label), "Cannot set lookaside : sqlite3_db_config(..., ${lookasideSlotSize}, %${lookasideSlotCount}) failed", err) + throw sqlException(logging, SqliteDatabaseConfig(path, label), "Cannot set lookaside : sqlite3_db_config(..., ${lookasideSlotSize}, %${lookasideSlotCount}) failed, ${error?:""}", err) } }