# SupportSQLiteStatement

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

*** ** * ** ***

<br />

```
interface SupportSQLiteStatement : SupportSQLiteProgram
```

<br />

*** ** * ** ***

An interface to map the behavior of `https://developer.android.com/reference/android/database/sqlite/SQLiteStatement.html`.

## Summary

| ### Public functions |
|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `https://developer.android.com/reference/kotlin/androidx/sqlite/db/SupportSQLiteStatement#execute()()` Execute this SQL statement, if it is not a SELECT / INSERT / DELETE / UPDATE, for example CREATE / DROP table, view, trigger, index etc. |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-long/index.html` | `https://developer.android.com/reference/kotlin/androidx/sqlite/db/SupportSQLiteStatement#executeInsert()()` Execute this SQL statement and return the ID of the row inserted due to this call. |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | `https://developer.android.com/reference/kotlin/androidx/sqlite/db/SupportSQLiteStatement#executeUpdateDelete()()` Execute this SQL statement, if the the number of rows affected by execution of this SQL statement is of any importance to the caller - for example, UPDATE / DELETE SQL statements. |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-long/index.html` | `https://developer.android.com/reference/kotlin/androidx/sqlite/db/SupportSQLiteStatement#simpleQueryForLong()()` Execute a statement that returns a 1 by 1 table with a numeric value. |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html?` | `https://developer.android.com/reference/kotlin/androidx/sqlite/db/SupportSQLiteStatement#simpleQueryForString()()` Execute a statement that returns a 1 by 1 table with a text value. |

### 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()()` From [androidx.sqlite.db.SupportSQLiteProgram](https://developer.android.com/reference/kotlin/androidx/sqlite/db/SupportSQLiteProgram) `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` `https://developer.android.com/reference/kotlin/androidx/sqlite/db/SupportSQLiteProgram#bindBlob(kotlin.Int,kotlin.ByteArray)(index: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html, value: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-byte-array/index.html)`

Bind a byte array value to this statement.
`https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` `https://developer.android.com/reference/kotlin/androidx/sqlite/db/SupportSQLiteProgram#bindDouble(kotlin.Int,kotlin.Double)(index: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html, value: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-double/index.html)`

Bind a double value to this statement.
`https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` `https://developer.android.com/reference/kotlin/androidx/sqlite/db/SupportSQLiteProgram#bindLong(kotlin.Int,kotlin.Long)(index: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html, value: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-long/index.html)`

Bind a long value to this statement.
`https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` `https://developer.android.com/reference/kotlin/androidx/sqlite/db/SupportSQLiteProgram#bindNull(kotlin.Int)(index: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)`

Bind a NULL value to this statement.
`https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` `https://developer.android.com/reference/kotlin/androidx/sqlite/db/SupportSQLiteProgram#bindString(kotlin.Int,kotlin.String)(index: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html, value: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html)`

Bind a String value to this statement.
`https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` `https://developer.android.com/reference/kotlin/androidx/sqlite/db/SupportSQLiteProgram#clearBindings()()`

Clears all existing bindings.

## Public functions

### execute

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

```
fun execute(): Unit
```

Execute this SQL statement, if it is not a SELECT / INSERT / DELETE / UPDATE, for example CREATE / DROP table, view, trigger, index etc.

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

### executeInsert

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

```
fun executeInsert(): Long
```

Execute this SQL statement and return the ID of the row inserted due to this call. The SQL statement should be an INSERT for this to be a useful call.

| Returns |
|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-long/index.html` | the row ID of the last row inserted, if this insert is successful. -1 otherwise. |

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

### executeUpdateDelete

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

```
fun executeUpdateDelete(): Int
```

Execute this SQL statement, if the the number of rows affected by execution of this SQL statement is of any importance to the caller - for example, UPDATE / DELETE SQL statements.

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

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

### simpleQueryForLong

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

```
fun simpleQueryForLong(): Long
```

Execute a statement that returns a 1 by 1 table with a numeric value. For example, SELECT COUNT(\*) FROM table;

| Returns |
|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-long/index.html` | The result of the query. |

| Throws |
|---|---|
| `https://developer.android.com/reference/android/database/sqlite/SQLiteDoneException.html` | if the query returns zero rows |

### simpleQueryForString

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

```
fun simpleQueryForString(): String?
```

Execute a statement that returns a 1 by 1 table with a text value. For example, SELECT COUNT(\*) FROM table;

| Returns |
|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html?` | The result of the query. |

| Throws |
|---|---|
| `https://developer.android.com/reference/android/database/sqlite/SQLiteDoneException.html` | if the query returns zero rows |