# androidx.room3

*** ** * ** ***

Common/AllAndroid/JVMNative/C/iOSJavaScript

## Interfaces

|---|---|---|
| `https://developer.android.com/reference/kotlin/androidx/room3/PooledConnection` | A wrapper of `https://developer.android.com/reference/kotlin/androidx/sqlite/SQLiteConnection` that belongs to a connection pool and is safe to use in a coroutine. | Cmn |
| `https://developer.android.com/reference/kotlin/androidx/room3/RoomDatabaseConstructor` | Defines a class that can instantiate the Room generated implementation of an 'abstract' `https://developer.android.com/reference/kotlin/androidx/room3/Database` annotated `https://developer.android.com/reference/kotlin/androidx/room3/RoomDatabase` definition. | Cmn |
| `https://developer.android.com/reference/kotlin/androidx/room3/RoomOpenDelegateMarker` | Marker interface for Room's code generated delegate. | Cmn |
| `https://developer.android.com/reference/kotlin/androidx/room3/TransactionScope` | A `https://developer.android.com/reference/kotlin/androidx/room3/PooledConnection` with an active transaction capable of performing nested transactions. | Cmn |
| `https://developer.android.com/reference/kotlin/androidx/room3/Transactor` | A `https://developer.android.com/reference/kotlin/androidx/room3/PooledConnection` that can perform transactions. | Cmn |

## Classes

|---|---|---|
| `https://developer.android.com/reference/kotlin/androidx/room3/InvalidationTracker` | The invalidation tracker keeps track of tables modified by queries and notifies its created `https://kotlinlang.org/api/kotlinx.coroutines/kotlinx-coroutines-core/kotlinx.coroutines.flow/-flow/index.html`s about such modifications. | Cmn android |
| `https://developer.android.com/reference/kotlin/androidx/room3/MultiInstanceInvalidationService` | A `https://developer.android.com/reference/android/app/Service.html` for remote invalidation among multiple `https://developer.android.com/reference/kotlin/androidx/room3/InvalidationTracker` instances. | android |
| `https://developer.android.com/reference/kotlin/androidx/room3/RoomDatabase` | Base class for all Room databases. | Cmn android |
| `https://developer.android.com/reference/kotlin/androidx/room3/RoomDatabase.Builder` | Builder for `https://developer.android.com/reference/kotlin/androidx/room3/RoomDatabase`. | Cmn android |
| `https://developer.android.com/reference/kotlin/androidx/room3/RoomDatabase.Callback` | Callback for `https://developer.android.com/reference/kotlin/androidx/room3/RoomDatabase` | Cmn android |
| `https://developer.android.com/reference/kotlin/androidx/room3/RoomDatabase.MigrationContainer` | A container to hold migrations. | Cmn android |
| `https://developer.android.com/reference/kotlin/androidx/room3/RoomDatabase.PrepackagedDatabaseCallback` | Callback for `https://developer.android.com/reference/kotlin/androidx/room3/RoomDatabase.Builder#createFromAsset(kotlin.String)`, `https://developer.android.com/reference/kotlin/androidx/room3/RoomDatabase.Builder#createFromFile(java.io.File)` and `https://developer.android.com/reference/kotlin/androidx/room3/RoomDatabase.Builder#createFromInputStream(java.util.concurrent.Callable)` | android |
| `https://developer.android.com/reference/kotlin/androidx/room3/RoomRawQuery` | A query with an argument binding function. | Cmn |

## Objects

|---|---|---|
| `https://developer.android.com/reference/kotlin/androidx/room3/FtsOptions` | Available option values that can be used with `https://developer.android.com/reference/kotlin/androidx/room3/Fts3`, `https://developer.android.com/reference/kotlin/androidx/room3/Fts4`\&`https://developer.android.com/reference/kotlin/androidx/room3/Fts5`. | Cmn |
| `https://developer.android.com/reference/kotlin/androidx/room3/Room` | Entry point for building and initializing a `https://developer.android.com/reference/kotlin/androidx/room3/RoomDatabase`. | Cmn android N JS |
| `https://developer.android.com/reference/kotlin/androidx/room3/RoomWarnings` | The list of warnings that are produced by Room. | Cmn |

## Annotations

|---|---|---|
| `https://developer.android.com/reference/kotlin/androidx/room3/AutoMigration` | Declares an automatic migration on a `https://developer.android.com/reference/kotlin/androidx/room3/Database`. | Cmn |
| `https://developer.android.com/reference/kotlin/androidx/room3/BuiltInColumnTypeConverters` | Control flags for built-in column type converters. | Cmn |
| `https://developer.android.com/reference/kotlin/androidx/room3/ColumnInfo` | Allows specific customization about the column associated with the annotated property. | Cmn |
| `https://developer.android.com/reference/kotlin/androidx/room3/ColumnInfo.Collate` |   | Cmn |
| `https://developer.android.com/reference/kotlin/androidx/room3/ColumnInfo.SQLiteTypeAffinity` | The SQLite column type constants that can be used in `https://developer.android.com/reference/kotlin/androidx/room3/ColumnInfo#typeAffinity()` | Cmn |
| `https://developer.android.com/reference/kotlin/androidx/room3/ColumnTypeConverter` | Marks a function as a column type converter. | Cmn |
| `https://developer.android.com/reference/kotlin/androidx/room3/ColumnTypeConverters` | Registers additional `https://developer.android.com/reference/kotlin/androidx/room3/ColumnTypeConverter` functions for Room. | Cmn |
| `https://developer.android.com/reference/kotlin/androidx/room3/ConstructedBy` | Defines the `https://developer.android.com/reference/kotlin/androidx/room3/RoomDatabaseConstructor` that will instantiate the Room generated implementation of the annotated `https://developer.android.com/reference/kotlin/androidx/room3/Database`. | Cmn android N JS |
| `https://developer.android.com/reference/kotlin/androidx/room3/Dao` | Marks the class as a Data Access Object. | Cmn |
| `https://developer.android.com/reference/kotlin/androidx/room3/DaoReturnTypeConverter` | Marks a function as a DAO function return type converter. | Cmn |
| `https://developer.android.com/reference/kotlin/androidx/room3/DaoReturnTypeConverters` | Specifies the classes that contain **DAO return type converters** that a RoomDatabase can use. | Cmn |
| `https://developer.android.com/reference/kotlin/androidx/room3/Database` | Marks a class as a `https://developer.android.com/reference/kotlin/androidx/room3/RoomDatabase`. | Cmn |
| `https://developer.android.com/reference/kotlin/androidx/room3/DatabaseView` | Marks a class as an SQLite view. | Cmn |
| `https://developer.android.com/reference/kotlin/androidx/room3/Delete` | Marks a function in a `https://developer.android.com/reference/kotlin/androidx/room3/Dao` annotated class as a delete function. | Cmn |
| `https://developer.android.com/reference/kotlin/androidx/room3/DeleteColumn` | Repeatable annotation declaring the deleted columns in the `https://developer.android.com/reference/kotlin/androidx/room3/AutoMigration#to()` version of an auto migration. | Cmn android |
| `https://developer.android.com/reference/kotlin/androidx/room3/DeleteColumn.Entries` | Container annotation for the repeatable annotation `https://developer.android.com/reference/kotlin/androidx/room3/DeleteColumn`. | android |
| `https://developer.android.com/reference/kotlin/androidx/room3/DeleteTable` | Repeatable annotation declaring the deleted tables in the `https://developer.android.com/reference/kotlin/androidx/room3/AutoMigration#to()` version of an auto migration. | Cmn android |
| `https://developer.android.com/reference/kotlin/androidx/room3/DeleteTable.Entries` | Container annotation for the repeatable annotation `https://developer.android.com/reference/kotlin/androidx/room3/DeleteTable`. | android |
| `https://developer.android.com/reference/kotlin/androidx/room3/Embedded` | Marks a property of an `https://developer.android.com/reference/kotlin/androidx/room3/Entity` or data object to allow nested properties (i.e. properties of the annotated property's class) to be referenced directly in the SQL queries. | Cmn |
| `https://developer.android.com/reference/kotlin/androidx/room3/Entity` | Marks a class as an entity. | Cmn |
| `https://developer.android.com/reference/kotlin/androidx/room3/ExperimentalRoomApi` | Marks declarations that are experimental in Room's APIs, which means that the design of the corresponding declarations may (or may not) lead to their changes in the future. | Cmn |
| `https://developer.android.com/reference/kotlin/androidx/room3/ForeignKey` | Declares a foreign key on another `https://developer.android.com/reference/kotlin/androidx/room3/Entity`. | Cmn |
| `https://developer.android.com/reference/kotlin/androidx/room3/ForeignKey.Action` | Constants definition for values that can be used in `https://developer.android.com/reference/kotlin/androidx/room3/ForeignKey#onDelete()` and `https://developer.android.com/reference/kotlin/androidx/room3/ForeignKey#onUpdate()`. | Cmn |
| `https://developer.android.com/reference/kotlin/androidx/room3/Fts3` | Marks an `https://developer.android.com/reference/kotlin/androidx/room3/Entity` annotated class as a FTS3 entity. | Cmn |
| `https://developer.android.com/reference/kotlin/androidx/room3/Fts4` | Marks an `https://developer.android.com/reference/kotlin/androidx/room3/Entity` annotated class as a FTS4 entity. | Cmn |
| `https://developer.android.com/reference/kotlin/androidx/room3/Fts5` | Marks an `https://developer.android.com/reference/kotlin/androidx/room3/Entity` annotated class as a FTS5 entity. | Cmn |
| `https://developer.android.com/reference/kotlin/androidx/room3/Ignore` | Ignores the marked element from Room's processing logic. | Cmn |
| `https://developer.android.com/reference/kotlin/androidx/room3` | Declares an index on an `https://developer.android.com/reference/kotlin/androidx/room3/Entity`. | Cmn |
| `https://developer.android.com/reference/kotlin/androidx/room3/Insert` | Marks a function in a `https://developer.android.com/reference/kotlin/androidx/room3/Dao` annotated class as an insert function. | Cmn |
| `https://developer.android.com/reference/kotlin/androidx/room3/Junction` | Declares a junction to be used for joining a relationship. | Cmn |
| `https://developer.android.com/reference/kotlin/androidx/room3/MapColumn` | Declares which column is used to build a map or multimap return value in a `https://developer.android.com/reference/kotlin/androidx/room3/Dao` query function. | Cmn |
| `https://developer.android.com/reference/kotlin/androidx/room3/OnConflictStrategy` | Set of conflict handling strategies for various `https://developer.android.com/reference/kotlin/androidx/room3/Dao` functions. | Cmn |
| `https://developer.android.com/reference/kotlin/androidx/room3/PrimaryKey` | Marks a property in an `https://developer.android.com/reference/kotlin/androidx/room3/Entity` as the primary key. | Cmn |
| `https://developer.android.com/reference/kotlin/androidx/room3/ProvidedAutoMigrationSpec` | Marks a `https://developer.android.com/reference/kotlin/androidx/room3/migration/AutoMigrationSpec` class that will be provided to Room at runtime. | Cmn |
| `https://developer.android.com/reference/kotlin/androidx/room3/ProvidedColumnTypeConverter` | Marks a class containing `https://developer.android.com/reference/kotlin/androidx/room3/ColumnTypeConverter` functions provided to Room at runtime. | Cmn |
| `https://developer.android.com/reference/kotlin/androidx/room3/ProvidedDaoReturnTypeConverter` | Marks a class containing `https://developer.android.com/reference/kotlin/androidx/room3/DaoReturnTypeConverter` functions that will be provided to Room at runtime. | Cmn |
| `https://developer.android.com/reference/kotlin/androidx/room3/Query` | Marks a function in a `https://developer.android.com/reference/kotlin/androidx/room3/Dao` annotated class as a query function. | Cmn |
| `https://developer.android.com/reference/kotlin/androidx/room3/RawQuery` | Marks a function in a `https://developer.android.com/reference/kotlin/androidx/room3/Dao` annotated class as a raw query function where the query is pass as a parameter of types `https://developer.android.com/reference/kotlin/androidx/room3/RoomRawQuery` or androidx.sqlite.db.SupportSQLiteQuery. | Cmn |
| `https://developer.android.com/reference/kotlin/androidx/room3/Relation` | A convenience annotation which can be used in a data object class to automatically fetch relation entities. | Cmn |
| `https://developer.android.com/reference/kotlin/androidx/room3/RenameColumn` | Repeatable annotation declaring the renamed columns in the `https://developer.android.com/reference/kotlin/androidx/room3/AutoMigration#to()` version of an auto migration. | Cmn android |
| `https://developer.android.com/reference/kotlin/androidx/room3/RenameColumn.Entries` | Container annotation for the repeatable annotation `https://developer.android.com/reference/kotlin/androidx/room3/RenameColumn`. | android |
| `https://developer.android.com/reference/kotlin/androidx/room3/RenameTable` | Repeatable annotation declaring the renamed tables in the new version of an auto migration. | Cmn android |
| `https://developer.android.com/reference/kotlin/androidx/room3/RenameTable.Entries` | Container annotation for the repeatable annotation `https://developer.android.com/reference/kotlin/androidx/room3/RenameTable`. | android |
| `https://developer.android.com/reference/kotlin/androidx/room3/RewriteQueriesToDropUnusedColumns` | When present, `https://developer.android.com/reference/kotlin/androidx/room3/RewriteQueriesToDropUnusedColumns` annotation will cause Room to rewrite your `https://developer.android.com/reference/kotlin/androidx/room3/Query` functions such that only the columns that are used in the return type are queried from the database. | Cmn |
| `https://developer.android.com/reference/kotlin/androidx/room3/SkipQueryVerification` | Skips database verification for the annotated element. | Cmn |
| `https://developer.android.com/reference/kotlin/androidx/room3/Transaction` | Marks a function in a `https://developer.android.com/reference/kotlin/androidx/room3/Dao` class as a transaction function. | Cmn |
| `https://developer.android.com/reference/kotlin/androidx/room3/Update` | Marks a function in a `https://developer.android.com/reference/kotlin/androidx/room3/Dao` annotated class as an update function. | Cmn |
| `https://developer.android.com/reference/kotlin/androidx/room3/Upsert` | Marks a function in a `https://developer.android.com/reference/kotlin/androidx/room3/Dao` annotated class as an upsert (insert or update) function. | Cmn |

## Enums

|---|---|---|
| `https://developer.android.com/reference/kotlin/androidx/room3/BuiltInColumnTypeConverters.State` | Control flags for built-in converters. | Cmn |
| `https://developer.android.com/reference/kotlin/androidx/room3/FtsOptions.Detail` |   | Cmn |
| `https://developer.android.com/reference/kotlin/androidx/room3/FtsOptions.MatchInfo` |   | Cmn |
| `https://developer.android.com/reference/kotlin/androidx/room3/FtsOptions.Order` |   | Cmn |
| `https://developer.android.com/reference/kotlin/androidx/room3/Index.Order` |   | Cmn |
| `https://developer.android.com/reference/kotlin/androidx/room3/OperationType` | Describes the type of database operation a `https://developer.android.com/reference/kotlin/androidx/room3/DaoReturnTypeConverter` function supports. | Cmn |
| `https://developer.android.com/reference/kotlin/androidx/room3/PrimaryKey.Algorithm` | The `https://developer.android.com/reference/kotlin/androidx/room3/PrimaryKey` auto-generate algorithms. | Cmn |
| `https://developer.android.com/reference/kotlin/androidx/room3/RoomDatabase.JournalMode` | Journal modes for SQLite database. | Cmn android |
| `https://developer.android.com/reference/kotlin/androidx/room3/Transactor.SQLiteTransactionType` | Transaction types. | Cmn |

## Extension functions summary

|---|---|---|
| `suspend R` | `<R : https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-any/index.html?> https://developer.android.com/reference/kotlin/androidx/room3/Transactor.https://developer.android.com/reference/kotlin/androidx/room3/package-summary#(androidx.room3.Transactor).deferredTransaction(kotlin.coroutines.SuspendFunction1)(block: suspend https://developer.android.com/reference/kotlin/androidx/room3/TransactionScope<R>.() -> R)` Performs a `https://developer.android.com/reference/kotlin/androidx/room3/Transactor.SQLiteTransactionType#DEFERRED` within the `https://developer.android.com/reference/kotlin/androidx/room3/package-summary#(androidx.room3.Transactor).deferredTransaction(kotlin.coroutines.SuspendFunction1)`. | Cmn |
| `suspend R` | `<R : https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-any/index.html?> https://developer.android.com/reference/kotlin/androidx/room3/Transactor.https://developer.android.com/reference/kotlin/androidx/room3/package-summary#(androidx.room3.Transactor).exclusiveTransaction(kotlin.coroutines.SuspendFunction1)(block: suspend https://developer.android.com/reference/kotlin/androidx/room3/TransactionScope<R>.() -> R)` Performs a `https://developer.android.com/reference/kotlin/androidx/room3/Transactor.SQLiteTransactionType#EXCLUSIVE` within the `https://developer.android.com/reference/kotlin/androidx/room3/package-summary#(androidx.room3.Transactor).exclusiveTransaction(kotlin.coroutines.SuspendFunction1)`. | Cmn |
| `suspend https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `https://developer.android.com/reference/kotlin/androidx/room3/PooledConnection.https://developer.android.com/reference/kotlin/androidx/room3/package-summary#(androidx.room3.PooledConnection).executeSQL(kotlin.String)(sql: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html)` Executes a single SQL statement that returns no values. | Cmn |
| `suspend R` | `<R : https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-any/index.html?> https://developer.android.com/reference/kotlin/androidx/room3/Transactor.https://developer.android.com/reference/kotlin/androidx/room3/package-summary#(androidx.room3.Transactor).immediateTransaction(kotlin.coroutines.SuspendFunction1)(block: suspend https://developer.android.com/reference/kotlin/androidx/room3/TransactionScope<R>.() -> R)` Performs a `https://developer.android.com/reference/kotlin/androidx/room3/Transactor.SQLiteTransactionType#IMMEDIATE` within the `https://developer.android.com/reference/kotlin/androidx/room3/package-summary#(androidx.room3.Transactor).immediateTransaction(kotlin.coroutines.SuspendFunction1)`. | Cmn |
| `suspend R` | `<R : https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-any/index.html?> https://developer.android.com/reference/kotlin/androidx/room3/RoomDatabase.https://developer.android.com/reference/kotlin/androidx/room3/package-summary#(androidx.room3.RoomDatabase).useReaderConnection(kotlin.coroutines.SuspendFunction1)(block: suspend (https://developer.android.com/reference/kotlin/androidx/room3/Transactor) -> R)` Acquires a READ connection, suspending while waiting if none is available and then calling the `https://developer.android.com/reference/kotlin/androidx/room3/package-summary#(androidx.room3.RoomDatabase).useReaderConnection(kotlin.coroutines.SuspendFunction1)` to use the connection once it is acquired. | Cmn |
| `suspend R` | `<R : https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-any/index.html?> https://developer.android.com/reference/kotlin/androidx/room3/RoomDatabase.https://developer.android.com/reference/kotlin/androidx/room3/package-summary#(androidx.room3.RoomDatabase).useWriterConnection(kotlin.coroutines.SuspendFunction1)(block: suspend (https://developer.android.com/reference/kotlin/androidx/room3/Transactor) -> R)` Acquires a WRITE connection, suspending while waiting if none is available and then calling the `https://developer.android.com/reference/kotlin/androidx/room3/package-summary#(androidx.room3.RoomDatabase).useWriterConnection(kotlin.coroutines.SuspendFunction1)` to use the connection once it is acquired. | Cmn |
| `suspend R` | `<R : https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-any/index.html?> https://developer.android.com/reference/kotlin/androidx/room3/RoomDatabase.https://developer.android.com/reference/kotlin/androidx/room3/package-summary#(androidx.room3.RoomDatabase).withReadTransaction(kotlin.coroutines.SuspendFunction1)(block: suspend https://developer.android.com/reference/kotlin/androidx/room3/TransactionScope<R>.() -> R)` Acquire a READ connection and start a `https://developer.android.com/reference/kotlin/androidx/room3/Transactor.SQLiteTransactionType#DEFERRED` transaction to execute the given `https://developer.android.com/reference/kotlin/androidx/room3/package-summary#(androidx.room3.RoomDatabase).withReadTransaction(kotlin.coroutines.SuspendFunction1)` within the transaction. | Cmn |
| `suspend R` | `<R : https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-any/index.html?> https://developer.android.com/reference/kotlin/androidx/room3/RoomDatabase.https://developer.android.com/reference/kotlin/androidx/room3/package-summary#(androidx.room3.RoomDatabase).withWriteTransaction(kotlin.coroutines.SuspendFunction1)(block: suspend https://developer.android.com/reference/kotlin/androidx/room3/TransactionScope<R>.() -> R)` Acquire a WRITE connection and start a `https://developer.android.com/reference/kotlin/androidx/room3/Transactor.SQLiteTransactionType#IMMEDIATE` transaction to execute the given `https://developer.android.com/reference/kotlin/androidx/room3/package-summary#(androidx.room3.RoomDatabase).withWriteTransaction(kotlin.coroutines.SuspendFunction1)` within the transaction. | Cmn |

## Extension functions

### Transactor.deferredTransaction

Cmn Artifact: [androidx.room3:room3-runtime](https://developer.android.com/jetpack/androidx/releases/room3) [View Source](https://cs.android.com/search?q=file:androidx/room3/Transactor.kt+function:deferredTransaction)

```
suspend fun <R : Any?> Transactor.deferredTransaction(block: suspend TransactionScope<R>.() -> R): R
```

Performs a `https://developer.android.com/reference/kotlin/androidx/room3/Transactor.SQLiteTransactionType#DEFERRED` within the `https://developer.android.com/reference/kotlin/androidx/room3/package-summary#(androidx.room3.Transactor).deferredTransaction(kotlin.coroutines.SuspendFunction1)`.

### Transactor.exclusiveTransaction

Cmn Artifact: [androidx.room3:room3-runtime](https://developer.android.com/jetpack/androidx/releases/room3) [View Source](https://cs.android.com/search?q=file:androidx/room3/Transactor.kt+function:exclusiveTransaction)

```
suspend fun <R : Any?> Transactor.exclusiveTransaction(block: suspend TransactionScope<R>.() -> R): R
```

Performs a `https://developer.android.com/reference/kotlin/androidx/room3/Transactor.SQLiteTransactionType#EXCLUSIVE` within the `https://developer.android.com/reference/kotlin/androidx/room3/package-summary#(androidx.room3.Transactor).exclusiveTransaction(kotlin.coroutines.SuspendFunction1)`.

### PooledConnection.executeSQL

Cmn Artifact: [androidx.room3:room3-runtime](https://developer.android.com/jetpack/androidx/releases/room3) [View Source](https://cs.android.com/search?q=file:androidx/room3/Transactor.kt+function:executeSQL) Added in [3.0.0](https://developer.android.com/jetpack/androidx/releases/room3#3.0.0)

```
suspend fun PooledConnection.executeSQL(sql: String): Unit
```

Executes a single SQL statement that returns no values.

### Transactor.immediateTransaction

Cmn Artifact: [androidx.room3:room3-runtime](https://developer.android.com/jetpack/androidx/releases/room3) [View Source](https://cs.android.com/search?q=file:androidx/room3/Transactor.kt+function:immediateTransaction)

```
suspend fun <R : Any?> Transactor.immediateTransaction(block: suspend TransactionScope<R>.() -> R): R
```

Performs a `https://developer.android.com/reference/kotlin/androidx/room3/Transactor.SQLiteTransactionType#IMMEDIATE` within the `https://developer.android.com/reference/kotlin/androidx/room3/package-summary#(androidx.room3.Transactor).immediateTransaction(kotlin.coroutines.SuspendFunction1)`.

### RoomDatabase.useReaderConnection

Cmn Artifact: [androidx.room3:room3-runtime](https://developer.android.com/jetpack/androidx/releases/room3) [View Source](https://cs.android.com/search?q=file:androidx/room3/RoomDatabase.kt+function:useReaderConnection)

```
suspend fun <R : Any?> RoomDatabase.useReaderConnection(block: suspend (Transactor) -> R): R
```

Acquires a READ connection, suspending while waiting if none is available and then calling the `https://developer.android.com/reference/kotlin/androidx/room3/package-summary#(androidx.room3.RoomDatabase).useReaderConnection(kotlin.coroutines.SuspendFunction1)` to use the connection once it is acquired. A `https://developer.android.com/reference/kotlin/androidx/room3/RoomDatabase` will have one or more READ connections. The connection to use in the `https://developer.android.com/reference/kotlin/androidx/room3/package-summary#(androidx.room3.RoomDatabase).useReaderConnection(kotlin.coroutines.SuspendFunction1)` is an instance of `https://developer.android.com/reference/kotlin/androidx/room3/Transactor` that provides the capabilities for performing nested transactions.

Using the connection after `https://developer.android.com/reference/kotlin/androidx/room3/package-summary#(androidx.room3.RoomDatabase).useReaderConnection(kotlin.coroutines.SuspendFunction1)` completes is prohibited.

The connection will be confined to the coroutine on which `https://developer.android.com/reference/kotlin/androidx/room3/package-summary#(androidx.room3.RoomDatabase).useReaderConnection(kotlin.coroutines.SuspendFunction1)` executes, attempting to use the connection from a different coroutine will result in an error.

If the current coroutine calling this function already has a confined connection, then that connection is used.

A connection is a limited resource and should not be held for more than it is needed. The best practice in using connections is to avoid executing long-running computations within the `https://developer.android.com/reference/kotlin/androidx/room3/package-summary#(androidx.room3.RoomDatabase).useReaderConnection(kotlin.coroutines.SuspendFunction1)`. If a caller has to wait too long to acquire a connection a `https://developer.android.com/reference/kotlin/androidx/sqlite/SQLiteException` will be thrown due to a timeout.

| Parameters |
|---|---|
| `block: suspend (https://developer.android.com/reference/kotlin/androidx/room3/Transactor) -> R` | The code to use the connection. |

| Throws |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/sqlite/SQLiteException` | when the database is closed or a thread confined connection needs to be upgraded or there is a timeout acquiring a connection. |

| See also |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/room3/package-summary#(androidx.room3.RoomDatabase).useWriterConnection(kotlin.coroutines.SuspendFunction1)` |   |

### RoomDatabase.useWriterConnection

Cmn Artifact: [androidx.room3:room3-runtime](https://developer.android.com/jetpack/androidx/releases/room3) [View Source](https://cs.android.com/search?q=file:androidx/room3/RoomDatabase.kt+function:useWriterConnection)

```
suspend fun <R : Any?> RoomDatabase.useWriterConnection(block: suspend (Transactor) -> R): R
```

Acquires a WRITE connection, suspending while waiting if none is available and then calling the `https://developer.android.com/reference/kotlin/androidx/room3/package-summary#(androidx.room3.RoomDatabase).useWriterConnection(kotlin.coroutines.SuspendFunction1)` to use the connection once it is acquired. A `https://developer.android.com/reference/kotlin/androidx/room3/RoomDatabase` will have only one WRITE connection. The connection to use in the `https://developer.android.com/reference/kotlin/androidx/room3/package-summary#(androidx.room3.RoomDatabase).useWriterConnection(kotlin.coroutines.SuspendFunction1)` is an instance of `https://developer.android.com/reference/kotlin/androidx/room3/Transactor` that provides the capabilities for performing nested transactions.

Using the connection after `https://developer.android.com/reference/kotlin/androidx/room3/package-summary#(androidx.room3.RoomDatabase).useWriterConnection(kotlin.coroutines.SuspendFunction1)` completes is prohibited.

The connection will be confined to the coroutine on which `https://developer.android.com/reference/kotlin/androidx/room3/package-summary#(androidx.room3.RoomDatabase).useWriterConnection(kotlin.coroutines.SuspendFunction1)` executes, attempting to use the connection from a different coroutine will result in an error.

If the current coroutine calling this function already has a confined connection, then that connection is used as long as it isn't required to be upgraded to a writer. If an upgrade is required then a `https://developer.android.com/reference/kotlin/androidx/sqlite/SQLiteException` is thrown.

A connection is a limited resource and should not be held for more than it is needed. The best practice in using connections is to avoid executing long-running computations within the `https://developer.android.com/reference/kotlin/androidx/room3/package-summary#(androidx.room3.RoomDatabase).useWriterConnection(kotlin.coroutines.SuspendFunction1)`. If a caller has to wait too long to acquire a connection a `https://developer.android.com/reference/kotlin/androidx/sqlite/SQLiteException` will be thrown due to a timeout.

| Parameters |
|---|---|
| `block: suspend (https://developer.android.com/reference/kotlin/androidx/room3/Transactor) -> R` | The code to use the connection. |

| Throws |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/sqlite/SQLiteException` | when the database is closed or a thread confined connection needs to be upgraded or there is a timeout acquiring a connection. |

| See also |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/room3/package-summary#(androidx.room3.RoomDatabase).useReaderConnection(kotlin.coroutines.SuspendFunction1)` |   |

### RoomDatabase.withReadTransaction

Cmn Artifact: [androidx.room3:room3-runtime](https://developer.android.com/jetpack/androidx/releases/room3) [View Source](https://cs.android.com/search?q=file:androidx/room3/RoomDatabase.kt+function:withReadTransaction)

```
suspend fun <R : Any?> RoomDatabase.withReadTransaction(block: suspend TransactionScope<R>.() -> R): R
```

Acquire a READ connection and start a `https://developer.android.com/reference/kotlin/androidx/room3/Transactor.SQLiteTransactionType#DEFERRED` transaction to execute the given `https://developer.android.com/reference/kotlin/androidx/room3/package-summary#(androidx.room3.RoomDatabase).withReadTransaction(kotlin.coroutines.SuspendFunction1)` within the transaction.

This function is a shorthand of:

```kotlin
roomDatabase.useReaderConnection { it.withTransaction(DEFERRED) { block() } }
```

### RoomDatabase.withWriteTransaction

Cmn Artifact: [androidx.room3:room3-runtime](https://developer.android.com/jetpack/androidx/releases/room3) [View Source](https://cs.android.com/search?q=file:androidx/room3/RoomDatabase.kt+function:withWriteTransaction)

```
suspend fun <R : Any?> RoomDatabase.withWriteTransaction(block: suspend TransactionScope<R>.() -> R): R
```

Acquire a WRITE connection and start a `https://developer.android.com/reference/kotlin/androidx/room3/Transactor.SQLiteTransactionType#IMMEDIATE` transaction to execute the given `https://developer.android.com/reference/kotlin/androidx/room3/package-summary#(androidx.room3.RoomDatabase).withWriteTransaction(kotlin.coroutines.SuspendFunction1)` within the transaction.

This function is a shorthand of:

```kotlin
roomDatabase.useWriterConnection { it.withTransaction(IMMEDIATE) { block() } }
```