# SupportSQLiteDatabase

Artifact: [androidx.sqlite:sqlite](https://developer.android.com/jetpack/androidx/releases/sqlite) [View Source](https://cs.android.com/search?q=file:androidx/sqlite/db/SupportSQLiteDatabase.android.kt+class:androidx.sqlite.db.SupportSQLiteDatabase) Added in [2.0.0](https://developer.android.com/jetpack/androidx/releases/sqlite#2.0.0)

*** ** * ** ***

<br />

```
interface SupportSQLiteDatabase : Closeable
```

<br />

*** ** * ** ***

A database abstraction which removes the framework dependency and allows swapping underlying sql versions. It mimics the behavior of `https://developer.android.com/reference/android/database/sqlite/SQLiteDatabase.html`

## Summary

| ### Public functions |
|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `https://developer.android.com/reference/kotlin/androidx/sqlite/db/SupportSQLiteDatabase#beginTransaction()()` Begins a transaction in EXCLUSIVE mode. |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `https://developer.android.com/reference/kotlin/androidx/sqlite/db/SupportSQLiteDatabase#beginTransactionNonExclusive()()` Begins a transaction in IMMEDIATE mode. |
| `open https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `https://developer.android.com/reference/kotlin/androidx/sqlite/db/SupportSQLiteDatabase#beginTransactionReadOnly()()` Begins a transaction in DEFERRED mode, with the android-specific constraint that the transaction is read-only. |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `https://developer.android.com/reference/kotlin/androidx/sqlite/db/SupportSQLiteDatabase#beginTransactionWithListener(android.database.sqlite.SQLiteTransactionListener)( transactionListener: https://developer.android.com/reference/android/database/sqlite/SQLiteTransactionListener.html )` Begins a transaction in EXCLUSIVE mode. |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `https://developer.android.com/reference/kotlin/androidx/sqlite/db/SupportSQLiteDatabase#beginTransactionWithListenerNonExclusive(android.database.sqlite.SQLiteTransactionListener)( transactionListener: https://developer.android.com/reference/android/database/sqlite/SQLiteTransactionListener.html )` Begins a transaction in IMMEDIATE mode. |
| `open https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `https://developer.android.com/reference/kotlin/androidx/sqlite/db/SupportSQLiteDatabase#beginTransactionWithListenerReadOnly(android.database.sqlite.SQLiteTransactionListener)( transactionListener: https://developer.android.com/reference/android/database/sqlite/SQLiteTransactionListener.html )` Begins a transaction in read-only mode with a {@link SQLiteTransactionListener} listener. |
| `https://developer.android.com/reference/kotlin/androidx/sqlite/db/SupportSQLiteStatement` | `https://developer.android.com/reference/kotlin/androidx/sqlite/db/SupportSQLiteDatabase#compileStatement(kotlin.String)(sql: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html)` Compiles the given SQL statement. |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | `https://developer.android.com/reference/kotlin/androidx/sqlite/db/SupportSQLiteDatabase#delete(kotlin.String,kotlin.String,kotlin.Array)(table: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html, whereClause: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html?, whereArgs: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-array/index.html<https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-any/index.html?>?)` Convenience method for deleting rows in the database. |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `https://developer.android.com/reference/kotlin/androidx/sqlite/db/SupportSQLiteDatabase#disableWriteAheadLogging()()` This method disables the features enabled by `https://developer.android.com/reference/kotlin/androidx/sqlite/db/SupportSQLiteDatabase#enableWriteAheadLogging()`. |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | `https://developer.android.com/reference/kotlin/androidx/sqlite/db/SupportSQLiteDatabase#enableWriteAheadLogging()()` This method enables parallel execution of queries from multiple threads on the same database. |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `https://developer.android.com/reference/kotlin/androidx/sqlite/db/SupportSQLiteDatabase#endTransaction()()` End a transaction. |
| `open https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `https://developer.android.com/reference/kotlin/androidx/sqlite/db/SupportSQLiteDatabase#execPerConnectionSQL(kotlin.String,kotlin.Array)(sql: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html, bindArgs: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-array/index.html<https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-any/index.html?>?)` Execute the given SQL statement on all connections to this database. |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `https://developer.android.com/reference/kotlin/androidx/sqlite/db/SupportSQLiteDatabase#execSQL(kotlin.String)(sql: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html)` Execute a single SQL statement that does not return any data. |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `https://developer.android.com/reference/kotlin/androidx/sqlite/db/SupportSQLiteDatabase#execSQL(kotlin.String,kotlin.Array)(sql: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html, bindArgs: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-array/index.html<https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-any/index.html?>)` Execute a single SQL statement that does not return any data. |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | `https://developer.android.com/reference/kotlin/androidx/sqlite/db/SupportSQLiteDatabase#inTransaction()()` Returns true if the current thread has a transaction pending. |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-long/index.html` | `https://developer.android.com/reference/kotlin/androidx/sqlite/db/SupportSQLiteDatabase#insert(kotlin.String,kotlin.Int,android.content.ContentValues)(table: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html, conflictAlgorithm: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html, values: https://developer.android.com/reference/android/content/ContentValues.html)` Convenience method for inserting a row into the database. |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | `https://developer.android.com/reference/kotlin/androidx/sqlite/db/SupportSQLiteDatabase#needUpgrade(kotlin.Int)(newVersion: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)` Returns true if the new version code is greater than the current database version. |
| `https://developer.android.com/reference/android/database/Cursor.html` | `https://developer.android.com/reference/kotlin/androidx/sqlite/db/SupportSQLiteDatabase#query(kotlin.String)(query: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html)` Runs the given query on the database. |
| `https://developer.android.com/reference/android/database/Cursor.html` | `https://developer.android.com/reference/kotlin/androidx/sqlite/db/SupportSQLiteDatabase#query(androidx.sqlite.db.SupportSQLiteQuery)(query: https://developer.android.com/reference/kotlin/androidx/sqlite/db/SupportSQLiteQuery)` Runs the given query on the database. |
| `https://developer.android.com/reference/android/database/Cursor.html` | `https://developer.android.com/reference/kotlin/androidx/sqlite/db/SupportSQLiteDatabase#query(kotlin.String,kotlin.Array)(query: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html, bindArgs: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-array/index.html<https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-any/index.html?>)` Runs the given query on the database. |
| `https://developer.android.com/reference/android/database/Cursor.html` | `https://developer.android.com/reference/kotlin/androidx/sqlite/db/SupportSQLiteDatabase#query(androidx.sqlite.db.SupportSQLiteQuery,android.os.CancellationSignal)(query: https://developer.android.com/reference/kotlin/androidx/sqlite/db/SupportSQLiteQuery, cancellationSignal: https://developer.android.com/reference/android/os/CancellationSignal.html?)` Runs the given query on the database. |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `https://developer.android.com/reference/kotlin/androidx/sqlite/db/SupportSQLiteDatabase#setForeignKeyConstraintsEnabled(kotlin.Boolean)(enabled: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html)` Sets whether foreign key constraints are enabled for the database. |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `https://developer.android.com/reference/kotlin/androidx/sqlite/db/SupportSQLiteDatabase#setLocale(java.util.Locale)(locale: https://developer.android.com/reference/java/util/Locale.html)` Sets the locale for this database. |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `https://developer.android.com/reference/kotlin/androidx/sqlite/db/SupportSQLiteDatabase#setMaxSqlCacheSize(kotlin.Int)(cacheSize: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)` Sets the maximum size of the prepared-statement cache for this database. |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-long/index.html` | `https://developer.android.com/reference/kotlin/androidx/sqlite/db/SupportSQLiteDatabase#setMaximumSize(kotlin.Long)(numBytes: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-long/index.html)` Sets the maximum size the database will grow to. |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `https://developer.android.com/reference/kotlin/androidx/sqlite/db/SupportSQLiteDatabase#setTransactionSuccessful()()` Marks the current transaction as successful. |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | `https://developer.android.com/reference/kotlin/androidx/sqlite/db/SupportSQLiteDatabase#update(kotlin.String,kotlin.Int,android.content.ContentValues,kotlin.String,kotlin.Array)( table: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html, conflictAlgorithm: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html, values: https://developer.android.com/reference/android/content/ContentValues.html, whereClause: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html?, whereArgs: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-array/index.html<https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-any/index.html?>? )` Convenience method for updating rows in the database. |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | `https://developer.android.com/reference/kotlin/androidx/sqlite/db/SupportSQLiteDatabase#yieldIfContendedSafely()()` Temporarily end the transaction to let other threads run. |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | `https://developer.android.com/reference/kotlin/androidx/sqlite/db/SupportSQLiteDatabase#yieldIfContendedSafely(kotlin.Long)(sleepAfterYieldDelayMillis: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-long/index.html)` Temporarily end the transaction to let other threads run. |

| ### Public properties |
|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-list/index.html<https://developer.android.com/reference/android/util/Pair.html<https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html, https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html>>?` | `https://developer.android.com/reference/kotlin/androidx/sqlite/db/SupportSQLiteDatabase#attachedDbs()` The list of full path names of all attached databases including the main database by executing 'pragma database_list' on the database. |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | `https://developer.android.com/reference/kotlin/androidx/sqlite/db/SupportSQLiteDatabase#isDatabaseIntegrityOk()` Is true if the given database (and all its attached databases) pass integrity_check, false otherwise. |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | `https://developer.android.com/reference/kotlin/androidx/sqlite/db/SupportSQLiteDatabase#isDbLockedByCurrentThread()` True if the current thread is holding an active connection to the database. |
| `open https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | `https://developer.android.com/reference/kotlin/androidx/sqlite/db/SupportSQLiteDatabase#isExecPerConnectionSQLSupported()` Is true if `https://developer.android.com/reference/kotlin/androidx/sqlite/db/SupportSQLiteDatabase#execPerConnectionSQL(kotlin.String,kotlin.Array)` is supported by the implementation. |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | `https://developer.android.com/reference/kotlin/androidx/sqlite/db/SupportSQLiteDatabase#isOpen()` Is true if the database is currently open. |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | `https://developer.android.com/reference/kotlin/androidx/sqlite/db/SupportSQLiteDatabase#isReadOnly()` Is true if the database is opened as read only. |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | `https://developer.android.com/reference/kotlin/androidx/sqlite/db/SupportSQLiteDatabase#isWriteAheadLoggingEnabled()` Is true if write-ahead logging has been enabled for this database. |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-long/index.html` | `https://developer.android.com/reference/kotlin/androidx/sqlite/db/SupportSQLiteDatabase#maximumSize()` The maximum size the database may grow to. |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-long/index.html` | `https://developer.android.com/reference/kotlin/androidx/sqlite/db/SupportSQLiteDatabase#pageSize()` The current database page size, in bytes. |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html?` | `https://developer.android.com/reference/kotlin/androidx/sqlite/db/SupportSQLiteDatabase#path()` The path to the database file. |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | `https://developer.android.com/reference/kotlin/androidx/sqlite/db/SupportSQLiteDatabase#version()` The database version. |

| ### Extension functions |
|---|---|
| `inline T` | `<T : https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-any/index.html?> https://developer.android.com/reference/kotlin/androidx/sqlite/db/SupportSQLiteDatabase.https://developer.android.com/reference/kotlin/androidx/sqlite/db/SupportSQLiteDatabase#(androidx.sqlite.db.SupportSQLiteDatabase).transaction(kotlin.Boolean,kotlin.Function1)( exclusive: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html, body: https://developer.android.com/reference/kotlin/androidx/sqlite/db/SupportSQLiteDatabase.() -> T )` Run `https://developer.android.com/reference/kotlin/androidx/sqlite/db/package-summary#(androidx.sqlite.db.SupportSQLiteDatabase).transaction(kotlin.Boolean,kotlin.Function1)` in a transaction marking it as successful if it completes without exception. |

### Inherited functions

From [java.io.Closeable](https://developer.android.com/reference/java/io/Closeable.html) `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` `https://developer.android.com/reference/java/io/Closeable.html#close()()`

## Public functions

### beginTransaction

Added in [2.0.0](https://developer.android.com/jetpack/androidx/releases/sqlite#2.0.0)

```
fun beginTransaction(): Unit
```

Begins a transaction in EXCLUSIVE mode.

Transactions can be nested. When the outer transaction is ended all of the work done in that transaction and all of the nested transactions will be committed or rolled back. The changes will be rolled back if any transaction is ended without being marked as clean (by calling setTransactionSuccessful). Otherwise they will be committed.

Here is the standard idiom for transactions:

```kotlin
db.beginTransaction()
try {
    ...
    db.setTransactionSuccessful()
} finally {
    db.endTransaction()
}
```

### beginTransactionNonExclusive

Added in [2.0.0](https://developer.android.com/jetpack/androidx/releases/sqlite#2.0.0)

```
fun beginTransactionNonExclusive(): Unit
```

Begins a transaction in IMMEDIATE mode. Transactions can be nested. When the outer transaction is ended all of the work done in that transaction and all of the nested transactions will be committed or rolled back. The changes will be rolled back if any transaction is ended without being marked as clean (by calling setTransactionSuccessful). Otherwise they will be committed.

Here is the standard idiom for transactions:

```kotlin
db.beginTransactionNonExclusive()
try {
    ...
    db.setTransactionSuccessful()
} finally {
    db.endTransaction()
}
```

### beginTransactionReadOnly

Added in [2.5.0](https://developer.android.com/jetpack/androidx/releases/sqlite#2.5.0)

```
open fun beginTransactionReadOnly(): Unit
```

Begins a transaction in DEFERRED mode, with the android-specific constraint that the transaction is read-only. The database may not be modified inside a read-only transaction otherwise a `https://developer.android.com/reference/android/database/sqlite/SQLiteDatabaseLockedException.html` might be thrown.

Read-only transactions may run concurrently with other read-only transactions, and if they database is in WAL mode, they may also run concurrently with IMMEDIATE or EXCLUSIVE transactions.

Transactions can be nested. However, the behavior of the transaction is not altered by nested transactions. A nested transaction may be any of the three transaction types but if the outermost type is read-only then nested transactions remain read-only, regardless of how they are started.

Here is the standard idiom for read-only transactions:

```kotlin
db.beginTransactionReadOnly();
try {
  ...
} finally {
  db.endTransaction();
}
```

If the implementation does not support read-only transactions then the default implementation delegates to `https://developer.android.com/reference/kotlin/androidx/sqlite/db/SupportSQLiteDatabase#beginTransaction()`.

### beginTransactionWithListener

Added in [2.0.0](https://developer.android.com/jetpack/androidx/releases/sqlite#2.0.0)

```
fun beginTransactionWithListener(
    transactionListener: SQLiteTransactionListener
): Unit
```

Begins a transaction in EXCLUSIVE mode.

Transactions can be nested. When the outer transaction is ended all of the work done in that transaction and all of the nested transactions will be committed or rolled back. The changes will be rolled back if any transaction is ended without being marked as clean (by calling setTransactionSuccessful). Otherwise they will be committed.

Here is the standard idiom for transactions:

```kotlin
db.beginTransactionWithListener(listener)
try {
    ...
    db.setTransactionSuccessful()
} finally {
    db.endTransaction()
}
```

| Parameters |
|---|---|
| `transactionListener: https://developer.android.com/reference/android/database/sqlite/SQLiteTransactionListener.html` | listener that should be notified when the transaction begins, commits, or is rolled back, either explicitly or by a call to `https://developer.android.com/reference/kotlin/androidx/sqlite/db/SupportSQLiteDatabase#yieldIfContendedSafely()`. |

### beginTransactionWithListenerNonExclusive

Added in [2.0.0](https://developer.android.com/jetpack/androidx/releases/sqlite#2.0.0)

```
fun beginTransactionWithListenerNonExclusive(
    transactionListener: SQLiteTransactionListener
): Unit
```

Begins a transaction in IMMEDIATE mode. Transactions can be nested. When the outer transaction is ended all of the work done in that transaction and all of the nested transactions will be committed or rolled back. The changes will be rolled back if any transaction is ended without being marked as clean (by calling setTransactionSuccessful). Otherwise they will be committed.

Here is the standard idiom for transactions:

```kotlin
db.beginTransactionWithListenerNonExclusive(listener)
try {
    ...
    db.setTransactionSuccessful()
} finally {
    db.endTransaction()
}
```

| Parameters |
|---|---|
| `transactionListener: https://developer.android.com/reference/android/database/sqlite/SQLiteTransactionListener.html` | listener that should be notified when the transaction begins, commits, or is rolled back, either explicitly or by a call to `https://developer.android.com/reference/kotlin/androidx/sqlite/db/SupportSQLiteDatabase#yieldIfContendedSafely()`. |

### beginTransactionWithListenerReadOnly

Added in [2.5.0](https://developer.android.com/jetpack/androidx/releases/sqlite#2.5.0)

```
open fun beginTransactionWithListenerReadOnly(
    transactionListener: SQLiteTransactionListener
): Unit
```

Begins a transaction in read-only mode with a {@link SQLiteTransactionListener} listener. The database may not be modified inside a read-only transaction otherwise a `https://developer.android.com/reference/android/database/sqlite/SQLiteDatabaseLockedException.html` might be thrown.

Transactions can be nested. However, the behavior of the transaction is not altered by nested transactions. A nested transaction may be any of the three transaction types but if the outermost type is read-only then nested transactions remain read-only, regardless of how they are started.

Here is the standard idiom for read-only transactions:

```kotlin
db.beginTransactionWightListenerReadOnly(listener);
try {
  ...
} finally {
  db.endTransaction();
}
```

If the implementation does not support read-only transactions then the default implementation delegates to `https://developer.android.com/reference/kotlin/androidx/sqlite/db/SupportSQLiteDatabase#beginTransactionWithListener(android.database.sqlite.SQLiteTransactionListener)`.

### compileStatement

Added in [2.0.0](https://developer.android.com/jetpack/androidx/releases/sqlite#2.0.0)

```
fun compileStatement(sql: String): SupportSQLiteStatement
```

Compiles the given SQL statement.

| Parameters |
|---|---|
| `sql: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html` | The sql query. |

| Returns |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/sqlite/db/SupportSQLiteStatement` | Compiled statement. |

### delete

Added in [2.0.0](https://developer.android.com/jetpack/androidx/releases/sqlite#2.0.0)

```
fun delete(table: String, whereClause: String?, whereArgs: Array<Any?>?): Int
```

Convenience method for deleting rows in the database.

| Parameters |
|---|---|
| `table: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html` | the table to delete from |
| `whereClause: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html?` | the optional WHERE clause to apply when deleting. Passing null will delete all rows. |
| `whereArgs: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-array/index.html<https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-any/index.html?>?` | You may include ?s in the where clause, which will be replaced by the values from whereArgs. The values will be bound as Strings. |

| Returns |
|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | the number of rows affected if a whereClause is passed in, 0 otherwise. To remove all rows and get a count pass "1" as the whereClause. |

### disableWriteAheadLogging

Added in [2.0.0](https://developer.android.com/jetpack/androidx/releases/sqlite#2.0.0)

```
fun disableWriteAheadLogging(): Unit
```

This method disables the features enabled by `https://developer.android.com/reference/kotlin/androidx/sqlite/db/SupportSQLiteDatabase#enableWriteAheadLogging()`.

| Throws |
|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-illegal-state-exception/index.html` | if there are transactions in progress at the time this method is called. WAL mode can only be changed when there are no transactions in progress. |

### enableWriteAheadLogging

Added in [2.0.0](https://developer.android.com/jetpack/androidx/releases/sqlite#2.0.0)

```
fun enableWriteAheadLogging(): Boolean
```

This method enables parallel execution of queries from multiple threads on the same database. It does this by opening multiple connections to the database and using a different database connection for each query. The database journal mode is also changed to enable writes to proceed concurrently with reads.

When write-ahead logging is not enabled (the default), it is not possible for reads and writes to occur on the database at the same time. Before modifying the database, the writer implicitly acquires an exclusive lock on the database which prevents readers from accessing the database until the write is completed.

In contrast, when write-ahead logging is enabled (by calling this method), write operations occur in a separate log file which allows reads to proceed concurrently. While a write is in progress, readers on other threads will perceive the state of the database as it was before the write began. When the write completes, readers on other threads will then perceive the new state of the database.

It is a good idea to enable write-ahead logging whenever a database will be concurrently accessed and modified by multiple threads at the same time. However, write-ahead logging uses significantly more memory than ordinary journaling because there are multiple connections to the same database. So if a database will only be used by a single thread, or if optimizing concurrency is not very important, then write-ahead logging should be disabled.

After calling this method, execution of queries in parallel is enabled as long as the database remains open. To disable execution of queries in parallel, either call `https://developer.android.com/reference/kotlin/androidx/sqlite/db/SupportSQLiteDatabase#disableWriteAheadLogging()` or close the database and reopen it.

The maximum number of connections used to execute queries in parallel is dependent upon the device memory and possibly other properties.

If a query is part of a transaction, then it is executed on the same database handle the transaction was begun.

Writers should use `https://developer.android.com/reference/kotlin/androidx/sqlite/db/SupportSQLiteDatabase#beginTransactionNonExclusive()` or `https://developer.android.com/reference/kotlin/androidx/sqlite/db/SupportSQLiteDatabase#beginTransactionWithListenerNonExclusive(android.database.sqlite.SQLiteTransactionListener)` to start a transaction. Non-exclusive mode allows database file to be in readable by other threads executing queries.

If the database has any attached databases, then execution of queries in parallel is NOT possible. Likewise, write-ahead logging is not supported for read-only databases or memory databases. In such cases, `enableWriteAheadLogging` returns false.

The best way to enable write-ahead logging is to pass the `https://developer.android.com/reference/android/database/sqlite/SQLiteDatabase.html#ENABLE_WRITE_AHEAD_LOGGING` flag to `https://developer.android.com/reference/android/database/sqlite/SQLiteDatabase.html#openDatabase(java.io.File, android.database.sqlite.SQLiteDatabase.OpenParams)`. This is more efficient than calling

SQLiteDatabase db = SQLiteDatabase.openDatabase("db_filename", cursorFactory, SQLiteDatabase.CREATE_IF_NECESSARY \| SQLiteDatabase.ENABLE_WRITE_AHEAD_LOGGING, myDatabaseErrorHandler) db.enableWriteAheadLogging()

Another way to enable write-ahead logging is to call `enableWriteAheadLogging` after opening the database.

SQLiteDatabase db = SQLiteDatabase.openDatabase("db_filename", cursorFactory, SQLiteDatabase.CREATE_IF_NECESSARY, myDatabaseErrorHandler) db.enableWriteAheadLogging()

See also [SQLite Write-Ahead Logging](http://sqlite.org/wal.html) for more details about how write-ahead logging works.

| Returns |
|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | True if write-ahead logging is enabled. |

| Throws |
|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-illegal-state-exception/index.html` | if there are transactions in progress at the time this method is called. WAL mode can only be changed when there are no transactions in progress. |

### endTransaction

Added in [2.0.0](https://developer.android.com/jetpack/androidx/releases/sqlite#2.0.0)

```
fun endTransaction(): Unit
```

End a transaction. See beginTransaction for notes about how to use this and when transactions are committed and rolled back.

### execPerConnectionSQL

Added in [2.2.0](https://developer.android.com/jetpack/androidx/releases/sqlite#2.2.0)

```
open fun execPerConnectionSQL(sql: String, bindArgs: Array<Any?>?): Unit
```

Execute the given SQL statement on all connections to this database.

This statement will be immediately executed on all existing connections, and will be automatically executed on all future connections.

Some example usages are changes like `PRAGMA trusted_schema=OFF` or functions like `SELECT icu_load_collation()`. If you execute these statements using `https://developer.android.com/reference/kotlin/androidx/sqlite/db/SupportSQLiteDatabase#execSQL(kotlin.String)` then they will only apply to a single database connection; using this method will ensure that they are uniformly applied to all current and future connections.

An implementation of `https://developer.android.com/reference/kotlin/androidx/sqlite/db/SupportSQLiteDatabase` might not support this operation. Use `https://developer.android.com/reference/kotlin/androidx/sqlite/db/SupportSQLiteDatabase#isExecPerConnectionSQLSupported()` to check if this operation is supported before calling this method.

| Parameters |
|---|---|
| `sql: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html` | The SQL statement to be executed. Multiple statements separated by semicolons are not supported. |
| `bindArgs: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-array/index.html<https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-any/index.html?>?` | The arguments that should be bound to the SQL statement. |

| Throws |
|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unsupported-operation-exception/index.html` | if this operation is not supported. To check if it supported use `https://developer.android.com/reference/kotlin/androidx/sqlite/db/SupportSQLiteDatabase#isExecPerConnectionSQLSupported()` |

### execSQL

Added in [2.0.0](https://developer.android.com/jetpack/androidx/releases/sqlite#2.0.0)

```
fun execSQL(sql: String): Unit
```

Execute a single SQL statement that does not return any data.

When using `https://developer.android.com/reference/kotlin/androidx/sqlite/db/SupportSQLiteDatabase#enableWriteAheadLogging()`, journal_mode is automatically managed by this class. So, do not set journal_mode using "PRAGMA journal_mode" statement if your app is using `https://developer.android.com/reference/kotlin/androidx/sqlite/db/SupportSQLiteDatabase#enableWriteAheadLogging()`

| Parameters |
|---|---|
| `sql: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html` | the SQL statement to be executed. Multiple statements separated by semicolons are not supported. |

| Throws |
|---|---|
| `https://developer.android.com/reference/android/database/SQLException.html` | if the SQL string is invalid |

### execSQL

Added in [2.0.0](https://developer.android.com/jetpack/androidx/releases/sqlite#2.0.0)

```
fun execSQL(sql: String, bindArgs: Array<Any?>): Unit
```

Execute a single SQL statement that does not return any data.

When using `https://developer.android.com/reference/kotlin/androidx/sqlite/db/SupportSQLiteDatabase#enableWriteAheadLogging()`, journal_mode is automatically managed by this class. So, do not set journal_mode using "PRAGMA journal_mode" statement if your app is using `https://developer.android.com/reference/kotlin/androidx/sqlite/db/SupportSQLiteDatabase#enableWriteAheadLogging()`

| Parameters |
|---|---|
| `sql: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html` | the SQL statement to be executed. Multiple statements separated by semicolons are not supported. |
| `bindArgs: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-array/index.html<https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-any/index.html?>` | only byte\[\], String, Long and Double are supported in selectionArgs. |

| Throws |
|---|---|
| `https://developer.android.com/reference/android/database/SQLException.html` | if the SQL string is invalid |

### inTransaction

Added in [2.0.0](https://developer.android.com/jetpack/androidx/releases/sqlite#2.0.0)

```
fun inTransaction(): Boolean
```

Returns true if the current thread has a transaction pending.

| Returns |
|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | True if the current thread is in a transaction. |

### insert

Added in [2.0.0](https://developer.android.com/jetpack/androidx/releases/sqlite#2.0.0)

```
fun insert(table: String, conflictAlgorithm: Int, values: ContentValues): Long
```

Convenience method for inserting a row into the database.

| Parameters |
|---|---|
| `table: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html` | the table to insert the row into |
| `conflictAlgorithm: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | for insert conflict resolver. One of `https://developer.android.com/reference/android/database/sqlite/SQLiteDatabase.html#CONFLICT_NONE`, `https://developer.android.com/reference/android/database/sqlite/SQLiteDatabase.html#CONFLICT_ROLLBACK`, `https://developer.android.com/reference/android/database/sqlite/SQLiteDatabase.html#CONFLICT_ABORT`, `https://developer.android.com/reference/android/database/sqlite/SQLiteDatabase.html#CONFLICT_FAIL`, `https://developer.android.com/reference/android/database/sqlite/SQLiteDatabase.html#CONFLICT_IGNORE`, `https://developer.android.com/reference/android/database/sqlite/SQLiteDatabase.html#CONFLICT_REPLACE`. |
| `values: https://developer.android.com/reference/android/content/ContentValues.html` | this map contains the initial column values for the row. The keys should be the column names and the values the column values |

| Returns |
|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-long/index.html` | the row ID of the newly inserted row, or -1 if an error occurred |

| Throws |
|---|---|
| `https://developer.android.com/reference/android/database/SQLException.html` | If the insert fails |

### needUpgrade

Added in [2.0.0](https://developer.android.com/jetpack/androidx/releases/sqlite#2.0.0)

```
fun needUpgrade(newVersion: Int): Boolean
```

Returns true if the new version code is greater than the current database version.

| Parameters |
|---|---|
| `newVersion: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | The new version code. |

| Returns |
|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | True if the new version code is greater than the current database version. |

### query

Added in [2.0.0](https://developer.android.com/jetpack/androidx/releases/sqlite#2.0.0)

```
fun query(query: String): Cursor
```

Runs the given query on the database. If you would like to have typed bind arguments, use `https://developer.android.com/reference/kotlin/androidx/sqlite/db/SupportSQLiteDatabase#query(kotlin.String)`.

| Parameters |
|---|---|
| `query: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html` | The SQL query that includes the query and can bind into a given compiled program. |

| Returns |
|---|---|
| `https://developer.android.com/reference/android/database/Cursor.html` | A `https://developer.android.com/reference/android/database/Cursor.html` object, which is positioned before the first entry. Note that `https://developer.android.com/reference/android/database/Cursor.html`s are not synchronized, see the documentation for more details. |

### query

Added in [2.0.0](https://developer.android.com/jetpack/androidx/releases/sqlite#2.0.0)

```
fun query(query: SupportSQLiteQuery): Cursor
```

Runs the given query on the database.

This class allows using type safe sql program bindings while running queries.

| Parameters |
|---|---|
| `query: https://developer.android.com/reference/kotlin/androidx/sqlite/db/SupportSQLiteQuery` | The `https://developer.android.com/reference/kotlin/androidx/sqlite/db/SimpleSQLiteQuery` query that includes the query and can bind into a given compiled program. |

| Returns |
|---|---|
| `https://developer.android.com/reference/android/database/Cursor.html` | A `https://developer.android.com/reference/android/database/Cursor.html` object, which is positioned before the first entry. Note that `https://developer.android.com/reference/android/database/Cursor.html`s are not synchronized, see the documentation for more details. |

### query

Added in [2.0.0](https://developer.android.com/jetpack/androidx/releases/sqlite#2.0.0)

```
fun query(query: String, bindArgs: Array<Any?>): Cursor
```

Runs the given query on the database. If you would like to have bind arguments, use `https://developer.android.com/reference/kotlin/androidx/sqlite/db/SupportSQLiteDatabase#query(kotlin.String,kotlin.Array)`.

| Parameters |
|---|---|
| `query: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html` | The SQL query that includes the query and can bind into a given compiled program. |
| `bindArgs: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-array/index.html<https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-any/index.html?>` | The query arguments to bind. |

| Returns |
|---|---|
| `https://developer.android.com/reference/android/database/Cursor.html` | A `https://developer.android.com/reference/android/database/Cursor.html` object, which is positioned before the first entry. Note that `https://developer.android.com/reference/android/database/Cursor.html`s are not synchronized, see the documentation for more details. |

### query

Added in [2.0.0](https://developer.android.com/jetpack/androidx/releases/sqlite#2.0.0)

```
fun query(query: SupportSQLiteQuery, cancellationSignal: CancellationSignal?): Cursor
```

Runs the given query on the database.

This class allows using type safe sql program bindings while running queries.

| Parameters |
|---|---|
| `query: https://developer.android.com/reference/kotlin/androidx/sqlite/db/SupportSQLiteQuery` | The SQL query that includes the query and can bind into a given compiled program. |
| `cancellationSignal: https://developer.android.com/reference/android/os/CancellationSignal.html?` | A signal to cancel the operation in progress, or null if none. If the operation is canceled, then `https://developer.android.com/reference/kotlin/androidx/core/os/OperationCanceledException` will be thrown when the query is executed. |

| Returns |
|---|---|
| `https://developer.android.com/reference/android/database/Cursor.html` | A `https://developer.android.com/reference/android/database/Cursor.html` object, which is positioned before the first entry. Note that `https://developer.android.com/reference/android/database/Cursor.html`s are not synchronized, see the documentation for more details. |

### setForeignKeyConstraintsEnabled

Added in [2.0.0](https://developer.android.com/jetpack/androidx/releases/sqlite#2.0.0)

```
fun setForeignKeyConstraintsEnabled(enabled: Boolean): Unit
```

Sets whether foreign key constraints are enabled for the database.

By default, foreign key constraints are not enforced by the database. This method allows an application to enable foreign key constraints. It must be called each time the database is opened to ensure that foreign key constraints are enabled for the session.

A good time to call this method is right after calling `#openOrCreateDatabase` or in the `https://developer.android.com/reference/kotlin/androidx/sqlite/db/SupportSQLiteOpenHelper.Callback#onConfigure(androidx.sqlite.db.SupportSQLiteDatabase)` callback.

When foreign key constraints are disabled, the database does not check whether changes to the database will violate foreign key constraints. Likewise, when foreign key constraints are disabled, the database will not execute cascade delete or update triggers. As a result, it is possible for the database state to become inconsistent. To perform a database integrity check, call `https://developer.android.com/reference/kotlin/androidx/sqlite/db/SupportSQLiteDatabase#isDatabaseIntegrityOk()`.

This method must not be called while a transaction is in progress.

See also [SQLite Foreign Key Constraints](http://sqlite.org/foreignkeys.html) for more details about foreign key constraint support.

| Parameters |
|---|---|
| `enabled: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | True to enable foreign key constraints, false to disable them. |

| Throws |
|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-illegal-state-exception/index.html` | if the are transactions is in progress when this method is called. |

### setLocale

Added in [2.0.0](https://developer.android.com/jetpack/androidx/releases/sqlite#2.0.0)

```
fun setLocale(locale: Locale): Unit
```

Sets the locale for this database. Does nothing if this database has the `https://developer.android.com/reference/android/database/sqlite/SQLiteDatabase.html#NO_LOCALIZED_COLLATORS` flag set or was opened read only.

| Parameters |
|---|---|
| `locale: https://developer.android.com/reference/java/util/Locale.html` | The new locale. |

| Throws |
|---|---|
| `https://developer.android.com/reference/android/database/SQLException.html` | if the locale could not be set. The most common reason for this is that there is no collator available for the locale you requested. In this case the database remains unchanged. |

### setMaxSqlCacheSize

Added in [2.0.0](https://developer.android.com/jetpack/androidx/releases/sqlite#2.0.0)

```
fun setMaxSqlCacheSize(cacheSize: Int): Unit
```

Sets the maximum size of the prepared-statement cache for this database. (size of the cache = number of compiled-sql-statements stored in the cache).

Maximum cache size can ONLY be increased from its current size (default = 10). If this method is called with smaller size than the current maximum value, then IllegalStateException is thrown.

This method is thread-safe.

| Parameters |
|---|---|
| `cacheSize: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | the size of the cache. can be (0 to `https://developer.android.com/reference/android/database/sqlite/SQLiteDatabase.html#MAX_SQL_CACHE_SIZE`) |

| Throws |
|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-illegal-state-exception/index.html` | if input cacheSize is over the max. `https://developer.android.com/reference/android/database/sqlite/SQLiteDatabase.html#MAX_SQL_CACHE_SIZE`. |

### setMaximumSize

Added in [2.0.0](https://developer.android.com/jetpack/androidx/releases/sqlite#2.0.0)

```
fun setMaximumSize(numBytes: Long): Long
```

Sets the maximum size the database will grow to. The maximum size cannot be set below the current size.

| Parameters |
|---|---|
| `numBytes: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-long/index.html` | the maximum database size, in bytes |

| Returns |
|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-long/index.html` | the new maximum database size |

### setTransactionSuccessful

Added in [2.0.0](https://developer.android.com/jetpack/androidx/releases/sqlite#2.0.0)

```
fun setTransactionSuccessful(): Unit
```

Marks the current transaction as successful. Do not do any more database work between calling this and calling endTransaction. Do as little non-database work as possible in that situation too. If any errors are encountered between this and endTransaction the transaction will still be committed.

| Throws |
|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-illegal-state-exception/index.html` | if the current thread is not in a transaction or the transaction is already marked as successful. |

### update

Added in [2.0.0](https://developer.android.com/jetpack/androidx/releases/sqlite#2.0.0)

```
fun update(
    table: String,
    conflictAlgorithm: Int,
    values: ContentValues,
    whereClause: String?,
    whereArgs: Array<Any?>?
): Int
```

Convenience method for updating rows in the database.

| Parameters |
|---|---|
| `table: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html` | the table to update in |
| `conflictAlgorithm: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | for update conflict resolver. One of `https://developer.android.com/reference/android/database/sqlite/SQLiteDatabase.html#CONFLICT_NONE`, `https://developer.android.com/reference/android/database/sqlite/SQLiteDatabase.html#CONFLICT_ROLLBACK`, `https://developer.android.com/reference/android/database/sqlite/SQLiteDatabase.html#CONFLICT_ABORT`, `https://developer.android.com/reference/android/database/sqlite/SQLiteDatabase.html#CONFLICT_FAIL`, `https://developer.android.com/reference/android/database/sqlite/SQLiteDatabase.html#CONFLICT_IGNORE`, `https://developer.android.com/reference/android/database/sqlite/SQLiteDatabase.html#CONFLICT_REPLACE`. |
| `values: https://developer.android.com/reference/android/content/ContentValues.html` | a map from column names to new column values. null is a valid value that will be translated to NULL. |
| `whereClause: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html?` | the optional WHERE clause to apply when updating. Passing null will update all rows. |
| `whereArgs: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-array/index.html<https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-any/index.html?>?` | You may include ?s in the where clause, which will be replaced by the values from whereArgs. The values will be bound as Strings. |

| Returns |
|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | the number of rows affected |

### yieldIfContendedSafely

Added in [2.0.0](https://developer.android.com/jetpack/androidx/releases/sqlite#2.0.0)

```
fun yieldIfContendedSafely(): Boolean
```

Temporarily end the transaction to let other threads run. The transaction is assumed to be successful so far. Do not call setTransactionSuccessful before calling this. When this returns a new transaction will have been created but not marked as successful. This assumes that there are no nested transactions (beginTransaction has only been called once) and will throw an exception if that is not the case.

| Returns |
|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | true if the transaction was yielded |

### yieldIfContendedSafely

Added in [2.0.0](https://developer.android.com/jetpack/androidx/releases/sqlite#2.0.0)

```
fun yieldIfContendedSafely(sleepAfterYieldDelayMillis: Long): Boolean
```

Temporarily end the transaction to let other threads run. The transaction is assumed to be successful so far. Do not call setTransactionSuccessful before calling this. When this returns a new transaction will have been created but not marked as successful. This assumes that there are no nested transactions (beginTransaction has only been called once) and will throw an exception if that is not the case.

| Parameters |
|---|---|
| `sleepAfterYieldDelayMillis: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-long/index.html` | if \> 0, sleep this long before starting a new transaction if the lock was actually yielded. This will allow other background threads to make some more progress than they would if we started the transaction immediately. |

| Returns |
|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | true if the transaction was yielded |

## Public properties

### attachedDbs

Added in [2.0.0](https://developer.android.com/jetpack/androidx/releases/sqlite#2.0.0)

```
val attachedDbs: List<Pair<String, String>>?
```

The list of full path names of all attached databases including the main database by executing 'pragma database_list' on the database.

### isDatabaseIntegrityOk

Added in [2.0.0](https://developer.android.com/jetpack/androidx/releases/sqlite#2.0.0)

```
val isDatabaseIntegrityOk: Boolean
```

Is true if the given database (and all its attached databases) pass integrity_check, false otherwise.

### isDbLockedByCurrentThread

Added in [2.0.0](https://developer.android.com/jetpack/androidx/releases/sqlite#2.0.0)

```
val isDbLockedByCurrentThread: Boolean
```

True if the current thread is holding an active connection to the database.

The name of this method comes from a time when having an active connection to the database meant that the thread was holding an actual lock on the database. Nowadays, there is no longer a true "database lock" although threads may block if they cannot acquire a database connection to perform a particular operation.

### isExecPerConnectionSQLSupported

Added in [2.2.0](https://developer.android.com/jetpack/androidx/releases/sqlite#2.2.0)

```
open val isExecPerConnectionSQLSupported: Boolean
```

Is true if `https://developer.android.com/reference/kotlin/androidx/sqlite/db/SupportSQLiteDatabase#execPerConnectionSQL(kotlin.String,kotlin.Array)` is supported by the implementation.

### isOpen

Added in [2.0.0](https://developer.android.com/jetpack/androidx/releases/sqlite#2.0.0)

```
val isOpen: Boolean
```

Is true if the database is currently open.

### isReadOnly

Added in [2.0.0](https://developer.android.com/jetpack/androidx/releases/sqlite#2.0.0)

```
val isReadOnly: Boolean
```

Is true if the database is opened as read only.

### isWriteAheadLoggingEnabled

Added in [2.0.0](https://developer.android.com/jetpack/androidx/releases/sqlite#2.0.0)

```
val isWriteAheadLoggingEnabled: Boolean
```

Is true if write-ahead logging has been enabled for this database.

### maximumSize

Added in [2.0.0](https://developer.android.com/jetpack/androidx/releases/sqlite#2.0.0)

```
val maximumSize: Long
```

The maximum size the database may grow to.

### pageSize

Added in [2.0.0](https://developer.android.com/jetpack/androidx/releases/sqlite#2.0.0)

```
var pageSize: Long
```

The current database page size, in bytes.

The page size must be a power of two. This method does not work if any data has been written to the database file, and must be called right after the database has been created.

### path

Added in [2.0.0](https://developer.android.com/jetpack/androidx/releases/sqlite#2.0.0)

```
val path: String?
```

The path to the database file.

### version

Added in [2.0.0](https://developer.android.com/jetpack/androidx/releases/sqlite#2.0.0)

```
var version: Int
```

The database version.

## Extension functions

### SupportSQLiteDatabase.transaction

Artifact: [androidx.sqlite:sqlite](https://developer.android.com/jetpack/androidx/releases/sqlite) [View Source](https://cs.android.com/search?q=file:androidx/sqlite/db/SupportSQLiteDatabaseExt.android.kt+function:transaction)

```
inline fun <T : Any?> SupportSQLiteDatabase.transaction(
    exclusive: Boolean = true,
    body: SupportSQLiteDatabase.() -> T
): T
```

Run `https://developer.android.com/reference/kotlin/androidx/sqlite/db/package-summary#(androidx.sqlite.db.SupportSQLiteDatabase).transaction(kotlin.Boolean,kotlin.Function1)` in a transaction marking it as successful if it completes without exception.

| Parameters |
|---|---|
| `exclusive: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html = true` | Run in `EXCLUSIVE` mode when true, `IMMEDIATE` mode otherwise. |
| `body: https://developer.android.com/reference/kotlin/androidx/sqlite/db/SupportSQLiteDatabase.() -> T` | Lambda to be run in the transaction. |