mirror of
https://github.com/openflocon/Flocon.git
synced 2026-05-19 19:59:39 +00:00
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:
parent
c63a4b7c65
commit
36373b7d56
1 changed files with 6 additions and 8 deletions
|
|
@ -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
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue