Update FloconAndroid/flocon/src/androidMain/kotlin/io/github/openflocon/flocon/plugins/database/FloconDatabasePlugin.android.kt

Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
This commit is contained in:
Florent CHAMPIGNY 2025-11-19 11:08:31 +01:00 committed by GitHub
parent c63a4b7c65
commit 36373b7d56
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -278,15 +278,13 @@ private fun getObjectFromColumnIndex(cursor: Cursor, column: Int): String? {
private fun getDatabaseVersion(
path: String,
): Int {
val db = android.database.sqlite.SQLiteDatabase.openDatabase(
return android.database.sqlite.SQLiteDatabase.openDatabase(
path,
null,
android.database.sqlite.SQLiteDatabase.OPEN_READONLY
)
val cursor = db.rawQuery("PRAGMA user_version", null)
var version = 0
if (cursor.moveToFirst()) version = cursor.getInt(0)
cursor.close()
db.close()
return version
).use { db ->
db.rawQuery("PRAGMA user_version", null).use { cursor ->
if (cursor.moveToFirst()) cursor.getInt(0) else 0
}
}
}