# SupportSQLiteConnection

# SupportSQLiteConnection

Artifact:[androidx.sqlite:sqlite-framework](https://developer.android.com/jetpack/androidx/releases/sqlite)  
[View Source](https://cs.android.com/search?q=file:androidx/sqlite/driver/SupportSQLiteConnection.android.kt+class:androidx.sqlite.driver.SupportSQLiteConnection)  
Added in[2.6.2](https://developer.android.com/jetpack/androidx/releases/sqlite#2.6.2)

*** ** * ** ***

Kotlin\|[Java](https://developer.android.com/reference/androidx/sqlite/driver/SupportSQLiteConnection "View this page in Java")
Android/JVMNative/C/iOS
  - android  

  ```
  class SupportSQLiteConnection : SQLiteConnection
  ```

*** ** * ** ***

A[SQLiteConnection](https://developer.android.com/reference/kotlin/androidx/sqlite/SQLiteConnection)implemented by[androidx.sqlite.db.SupportSQLiteDatabase](https://developer.android.com/reference/kotlin/androidx/sqlite/db/SupportSQLiteDatabase)and that uses the Android's SQLite through the`SupportSQLite`APIs.

## Summary

|                                                                                                                                               ### Public constructors                                                                                                                                                |
|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|---------|
| [SupportSQLiteConnection](https://developer.android.com/reference/kotlin/androidx/sqlite/driver/SupportSQLiteConnection#SupportSQLiteConnection(androidx.sqlite.db.SupportSQLiteDatabase))`(db: `[SupportSQLiteDatabase](https://developer.android.com/reference/kotlin/androidx/sqlite/db/SupportSQLiteDatabase)`)` | android |

|                                           ### Public functions                                           |
|----------------------------------------------------------------------------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|---------|
| `open `[Unit](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html)                     | [close](https://developer.android.com/reference/kotlin/androidx/sqlite/driver/SupportSQLiteConnection#close())`()` Closes the database connection.                                                                                                        | android |
| `open `[Boolean](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html)               | [inTransaction](https://developer.android.com/reference/kotlin/androidx/sqlite/driver/SupportSQLiteConnection#inTransaction())`()` Returns true if the connection has an active transaction, false otherwise.                                             | android |
| `open `[SQLiteStatement](https://developer.android.com/reference/kotlin/androidx/sqlite/SQLiteStatement) | [prepare](https://developer.android.com/reference/kotlin/androidx/sqlite/driver/SupportSQLiteConnection#prepare(kotlin.String))`(sql: `[String](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html)`)` Prepares a new SQL statement. | android |

|                                              ### Public properties                                               |
|------------------------------------------------------------------------------------------------------------------|----------------------------------------------------------------------------------------------------------|---------|
| [SupportSQLiteDatabase](https://developer.android.com/reference/kotlin/androidx/sqlite/db/SupportSQLiteDatabase) | [db](https://developer.android.com/reference/kotlin/androidx/sqlite/driver/SupportSQLiteConnection#db()) | android |

## Public constructors

### SupportSQLiteConnection

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

```
SupportSQLiteConnection(db: SupportSQLiteDatabase)
```

## Public functions

### close

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

```
open 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

android  

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

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

### prepare

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

```
open fun prepare(sql: String): SQLiteStatement
```

Prepares a new SQL statement.

See also[Compiling a SQL statement](https://www.sqlite.org/c3ref/prepare.html)  

|                                        Parameters                                        |
|------------------------------------------------------------------------------------------|------------------------------|
| `sql: `[String](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html) | the SQL statement to prepare |

|                                              Returns                                              |
|---------------------------------------------------------------------------------------------------|-------------------------|
| [SQLiteStatement](https://developer.android.com/reference/kotlin/androidx/sqlite/SQLiteStatement) | the prepared statement. |

## Public properties

### db

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

```
val db: SupportSQLiteDatabase
```