onConfigure

protected open fun onConfigure(pragma: KQLitePragma)

Called when the database is opened, after the connection is established but before the schema is upgraded or downgraded. It is invoked every time a database connection is opened except when KQLiteDatabase version is 0.

Common uses include enabling Write-Ahead Logging (WAL), setting the synchronous mode, or adjusting other performance-related settings.

Example:

override fun onConfigure(pragma: KQLitePragma) {
// Enable Write-Ahead Logging
pragma.journalMode.set(JournalMode.WAL)

// Update synchronous mode
pragma.synchronous.set(Synchronous.NORMAL)

// Enable foreign key constraints
pragma.foreignKeys.set(true)
}

Author

MOHAMMAD AZIM ANSARI

Parameters

pragma

A KQLitePragma instance that can be used to execute PRAGMA statements on the database connection.

See also