# 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 />

```
public interface SupportSQLiteStatement extends SupportSQLiteProgram
```

<br />

*** ** * ** ***

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

## Summary

| ### Public methods |
|---|---|
| `abstract void` | `https://developer.android.com/reference/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. |
| `abstract long` | `https://developer.android.com/reference/androidx/sqlite/db/SupportSQLiteStatement#executeInsert()()` Execute this SQL statement and return the ID of the row inserted due to this call. |
| `abstract int` | `https://developer.android.com/reference/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. |
| `abstract long` | `https://developer.android.com/reference/androidx/sqlite/db/SupportSQLiteStatement#simpleQueryForLong()()` Execute a statement that returns a 1 by 1 table with a numeric value. |
| `abstract https://developer.android.com/reference/java/lang/String.html` | `https://developer.android.com/reference/androidx/sqlite/db/SupportSQLiteStatement#simpleQueryForString()()` Execute a statement that returns a 1 by 1 table with a text value. |

### Inherited methods

From [java.io.Closeable](https://developer.android.com/reference/java/io/Closeable.html) `abstract void` `https://developer.android.com/reference/java/io/Closeable.html#close()()` From [androidx.sqlite.db.SupportSQLiteProgram](https://developer.android.com/reference/androidx/sqlite/db/SupportSQLiteProgram) `abstract void` `https://developer.android.com/reference/androidx/sqlite/db/SupportSQLiteProgram#bindBlob(kotlin.Int,kotlin.ByteArray)(int index, @https://developer.android.com/reference/androidx/annotation/NonNull byte[] value)`

Bind a byte array value to this statement.
`abstract void` `https://developer.android.com/reference/androidx/sqlite/db/SupportSQLiteProgram#bindDouble(kotlin.Int,kotlin.Double)(int index, double value)`

Bind a double value to this statement.
`abstract void` `https://developer.android.com/reference/androidx/sqlite/db/SupportSQLiteProgram#bindLong(kotlin.Int,kotlin.Long)(int index, long value)`

Bind a long value to this statement.
`abstract void` `https://developer.android.com/reference/androidx/sqlite/db/SupportSQLiteProgram#bindNull(kotlin.Int)(int index)`

Bind a NULL value to this statement.
`abstract void` `https://developer.android.com/reference/androidx/sqlite/db/SupportSQLiteProgram#bindString(kotlin.Int,kotlin.String)(int index, @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/lang/String.html value)`

Bind a String value to this statement.
`abstract void` `https://developer.android.com/reference/androidx/sqlite/db/SupportSQLiteProgram#clearBindings()()`

Clears all existing bindings.

## Public methods

### execute

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

```
abstract void execute()
```

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)

```
abstract long executeInsert()
```

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 |
|---|---|
| `long` | 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)

```
abstract int 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.

| Returns |
|---|---|
| `int` | 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)

```
abstract long simpleQueryForLong()
```

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

| Returns |
|---|---|
| `long` | 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)

```
abstract String simpleQueryForString()
```

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

| Returns |
|---|---|
| `https://developer.android.com/reference/java/lang/String.html` | The result of the query. |

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