SQLiteConnection


public interface 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 methods

abstract void

Closes the database connection.

default boolean

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

abstract @NonNull SQLiteStatement

Prepares a new SQL statement.

Extension functions

default final void

Executes a single SQL statement that returns no values.

Public methods

close

Added in 2.5.0
abstract void close()

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

Added in 2.6.0-alpha01
default boolean inTransaction()

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

prepare

Added in 2.5.0
abstract @NonNull SQLiteStatement prepare(@NonNull String sql)

Prepares a new SQL statement.

See also Compiling a SQL statement

Parameters
@NonNull String sql

the SQL statement to prepare

Returns
@NonNull SQLiteStatement

the prepared statement.

Extension functions

SQLite.execSQL

default final void SQLite.execSQL(@NonNull SQLiteConnection receiver, @NonNull String sql)

Executes a single SQL statement that returns no values.