KQLiteDriver

interface KQLiteDriver

A driver for creating and managing connections to a KQLiteDatabase.

  • This interface defines the contract for platform-specific implementations that handle the low-level details of opening an SQLite database file and providing a connection object.

  • Implementations are responsible for translating the given file and flags into a valid database connection.

  • It is recommended to use multiplatform driver SQLite KMP

Example

import androidx.sqlite.driver.bundled.BundledSQLiteDriver

class BundleDriverImpl(
override val dbFile: String,
override val version: Int,
) : KQLiteDriver {
private val driver = BundledSQLiteDriver()

override fun open(flags: Int?): SQLiteConnection =
flags?.let {
driver.open(dbFile, it)
} ?: driver.open(dbFile)
}

Author

MOHAMMAD AZIM ANSARI

See also

Properties

Link copied to clipboard
abstract val dbFile: String

The path to the SQLite database file to be opened.

Link copied to clipboard
abstract val version: Int

The version of the database schema. This value is used to determine if the database needs to be upgraded or downgraded.

Functions

Link copied to clipboard
abstract fun open(flags: Int?): SQLiteConnection

Opens a database connection and returns SQLiteConnection.