SQLiteConnection


Known direct subclasses
SupportSQLiteConnection

A SQLiteConnection implemented by androidx.sqlite.db.SupportSQLiteDatabase and that uses the Android's SQLite through the SupportSQLite APIs.


SQLite connection definition.

A connection to a database is a resource that must be released once it is no longer needed via its close function.

See also Database Connection

Summary

Public functions

Unit

Closes the database connection.

Cmn
open Boolean

Returns true if the connection has an active transaction, false otherwise.

Cmn
SQLiteStatement

Prepares a new SQL statement.

Cmn

Extension functions

Unit

Executes a single SQL statement that returns no values.

Cmn

Public functions

close

fun close(): Unit

Closes the database connection.

Once a connection is closed it should no longer be used. Calling this function on an already closed database connection is a no-op.

inTransaction

open fun inTransaction(): Boolean

Returns true if the connection has an active transaction, false otherwise.

prepare

fun prepare(sql: String): SQLiteStatement

Prepares a new SQL statement.

See also Compiling a SQL statement

Parameters
sql: String

the SQL statement to prepare

Returns
SQLiteStatement

the prepared statement.

Extension functions

execSQL

fun SQLiteConnection.execSQL(sql: String): Unit

Executes a single SQL statement that returns no values.