From 12d013be2bcf4f6c12ee3f11f6612dfcf30eddbb Mon Sep 17 00:00:00 2001 From: Florent Champigny Date: Wed, 19 Nov 2025 11:55:40 +0100 Subject: [PATCH] closes helper instead of close db --- .../database/FloconDatabasePlugin.android.kt | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/FloconAndroid/flocon/src/androidMain/kotlin/io/github/openflocon/flocon/plugins/database/FloconDatabasePlugin.android.kt b/FloconAndroid/flocon/src/androidMain/kotlin/io/github/openflocon/flocon/plugins/database/FloconDatabasePlugin.android.kt index b0f6187d..daaeb5eb 100644 --- a/FloconAndroid/flocon/src/androidMain/kotlin/io/github/openflocon/flocon/plugins/database/FloconDatabasePlugin.android.kt +++ b/FloconAndroid/flocon/src/androidMain/kotlin/io/github/openflocon/flocon/plugins/database/FloconDatabasePlugin.android.kt @@ -60,16 +60,16 @@ internal class FloconDatabaseDataSourceAndroid(private val context: Context) : databaseName: String, query: String ): DatabaseExecuteSqlResponse { - var database: SupportSQLiteDatabase? = null + var helper: SupportSQLiteOpenHelper? = null return try { - val path = if (File(databaseName).isAbsolute) File(databaseName) else context.getDatabasePath(databaseName) + val path = context.getDatabasePath(databaseName) val version = getDatabaseVersion(path = path.absolutePath) - val helper = FrameworkSQLiteOpenHelperFactory().create( + helper = FrameworkSQLiteOpenHelperFactory().create( SupportSQLiteOpenHelper.Configuration.builder(context) .name(path.absolutePath) .callback(object : SupportSQLiteOpenHelper.Callback(version) { override fun onCreate(db: SupportSQLiteDatabase) { - // Rien + // no op } override fun onUpgrade( @@ -77,12 +77,12 @@ internal class FloconDatabaseDataSourceAndroid(private val context: Context) : oldVersion: Int, newVersion: Int ) { - // Rien + // no op } }) .build() ) - database = helper.writableDatabase + val database = helper.writableDatabase executeSQL( database = database, @@ -94,7 +94,7 @@ internal class FloconDatabaseDataSourceAndroid(private val context: Context) : originalSql = query, ) } finally { - database?.close() + helper?.close() } }