# SupportSQLiteStatement

added in[version 1.1.0](https://developer.android.com/topic/libraries/support-library/revisions)  
belongs to Maven artifact android.arch.persistence:db:1.1.0-beta2  
Summary:[Methods](https://developer.android.com/reference/android/arch/persistence/db/SupportSQLiteStatement#pubmethods)\|[Inherited Methods](https://developer.android.com/reference/android/arch/persistence/db/SupportSQLiteStatement#inhmethods)  

# SupportSQLiteStatement

| The`android.arch`Architecture Components packages are no longer maintained. They have been superseded by the corresponding[androidx.\*](https://developer.android.com/jetpack/androidx/migrate)packages. See[androidx.sqlite.db.SupportSQLiteStatement](https://developer.android.com/reference/androidx/sqlite/db/SupportSQLiteStatement)instead.

`
public


interface
SupportSQLiteStatement
`  
`


implements

`[SupportSQLiteProgram](https://developer.android.com/reference/android/arch/persistence/db/SupportSQLiteProgram)`


`

|----------------------------------------------------|
| android.arch.persistence.db.SupportSQLiteStatement |

<br />

*** ** * ** ***

An interface to map the behavior of[SQLiteStatement](https://developer.android.com/reference/android/database/sqlite/SQLiteStatement.html).

## Summary

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

| ### Inherited methods |
|-----------------------|---|
| From interface` `[android.arch.persistence.db.SupportSQLiteProgram](https://developer.android.com/reference/android/arch/persistence/db/SupportSQLiteProgram)` ` |------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | ` abstract void` | ` `[bindBlob](https://developer.android.com/reference/android/arch/persistence/db/SupportSQLiteProgram#bindBlob(int, byte[]))`(int index, byte[] value) ` Bind a byte array value to this statement.           | | ` abstract void` | ` `[bindDouble](https://developer.android.com/reference/android/arch/persistence/db/SupportSQLiteProgram#bindDouble(int, double))`(int index, double value) ` Bind a double value to this statement.           | | ` abstract void` | ` `[bindLong](https://developer.android.com/reference/android/arch/persistence/db/SupportSQLiteProgram#bindLong(int, long))`(int index, long value) ` Bind a long value to this statement.                     | | ` abstract void` | ` `[bindNull](https://developer.android.com/reference/android/arch/persistence/db/SupportSQLiteProgram#bindNull(int))`(int index) ` Bind a NULL value to this statement.                                       | | ` abstract void` | ` `[bindString](https://developer.android.com/reference/android/arch/persistence/db/SupportSQLiteProgram#bindString(int, java.lang.String))`(int index, String value) ` Bind a String value to this statement. | | ` abstract void` | ` `[clearBindings](https://developer.android.com/reference/android/arch/persistence/db/SupportSQLiteProgram#clearBindings())`() ` Clears all existing bindings.                                                | ||
| From interface` java.io.Closeable ` |------------------|-------------| | ` abstract void` | ` close() ` | ||
| From interface` java.lang.AutoCloseable ` |------------------|-------------| | ` abstract void` | ` close() ` | ||

## Public methods

### execute

added in[version 1.1.0](https://developer.android.com/topic/libraries/support-library/revisions)  

```
void execute ()
```

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

<br />

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

### executeInsert

added in[version 1.1.0](https://developer.android.com/topic/libraries/support-library/revisions)  

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

<br />

|                                             Returns                                             ||
|--------|-----------------------------------------------------------------------------------------|
| `long` | the row ID of the last row inserted, if this insert is successful. -1 otherwise. <br /> |

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

### executeUpdateDelete

added in[version 1.1.0](https://developer.android.com/topic/libraries/support-library/revisions)  

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

<br />

|                                  Returns                                   ||
|-------|---------------------------------------------------------------------|
| `int` | the number of rows affected by this SQL statement execution. <br /> |

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

### simpleQueryForLong

added in[version 1.1.0](https://developer.android.com/topic/libraries/support-library/revisions)  

```
long simpleQueryForLong ()
```

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

<br />

|                 Returns                 ||
|--------|---------------------------------|
| `long` | The result of the query. <br /> |

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

### simpleQueryForString

added in[version 1.1.0](https://developer.android.com/topic/libraries/support-library/revisions)  

```
String simpleQueryForString ()
```

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

<br />

|                  Returns                  ||
|----------|---------------------------------|
| `String` | The result of the query. <br /> |

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

-

  ## Interfaces

  - [SupportSQLiteDatabase](https://developer.android.com/reference/android/arch/persistence/db/SupportSQLiteDatabase)
  - [SupportSQLiteOpenHelper](https://developer.android.com/reference/android/arch/persistence/db/SupportSQLiteOpenHelper)
  - [SupportSQLiteOpenHelper.Factory](https://developer.android.com/reference/android/arch/persistence/db/SupportSQLiteOpenHelper.Factory)
  - [SupportSQLiteProgram](https://developer.android.com/reference/android/arch/persistence/db/SupportSQLiteProgram)
  - [SupportSQLiteQuery](https://developer.android.com/reference/android/arch/persistence/db/SupportSQLiteQuery)
  - [SupportSQLiteStatement](https://developer.android.com/reference/android/arch/persistence/db/SupportSQLiteStatement)
-

  ## Classes

  - [SimpleSQLiteQuery](https://developer.android.com/reference/android/arch/persistence/db/SimpleSQLiteQuery)
  - [SupportSQLiteOpenHelper.Callback](https://developer.android.com/reference/android/arch/persistence/db/SupportSQLiteOpenHelper.Callback)
  - [SupportSQLiteOpenHelper.Configuration](https://developer.android.com/reference/android/arch/persistence/db/SupportSQLiteOpenHelper.Configuration)
  - [SupportSQLiteOpenHelper.Configuration.Builder](https://developer.android.com/reference/android/arch/persistence/db/SupportSQLiteOpenHelper.Configuration.Builder)
  - [SupportSQLiteQueryBuilder](https://developer.android.com/reference/android/arch/persistence/db/SupportSQLiteQueryBuilder)