> Documentation index: https://developer.android.com/reference/llms.txt

Summary: [Methods](https://developer.android.com/reference/android/database/sqlite/SQLiteStatement.md.txt#pubmethods) \| [Inherited Methods](https://developer.android.com/reference/android/database/sqlite/SQLiteStatement.md.txt#inhmethods)

# SQLiteStatement

*** ** * ** ***


`
public

final

class
SQLiteStatement
`


`


`

`


`

`

extends SQLiteProgram


`

`


`

|---|---|---|---|
| [java.lang.Object](https://developer.android.com/reference/java/lang/Object.md.txt) ||||
| ↳ | [android.database.sqlite.SQLiteClosable](https://developer.android.com/reference/android/database/sqlite/SQLiteClosable.md.txt) |||
|   | ↳ | [android.database.sqlite.SQLiteProgram](https://developer.android.com/reference/android/database/sqlite/SQLiteProgram.md.txt) ||
|   |   | ↳ | android.database.sqlite.SQLiteStatement |

<br />

*** ** * ** ***

Represents a statement that can be executed against a database. The statement
cannot return multiple rows or columns, but single value (1 x 1) result sets
are supported.


This class is not thread-safe.

<br />

## Summary

| ### Public methods ||
|---|---|
| ` void` | ` execute() ` Execute this SQL statement, if it is not a SELECT / INSERT / DELETE / UPDATE, for example CREATE / DROP table, view, trigger, index etc. |
| ` long` | ` executeInsert() ` Execute this SQL statement and return the ID of the row inserted due to this call. |
| ` int` | ` executeUpdateDelete() ` Execute this SQL statement, if the number of rows affected by execution of this SQL statement is of any importance to the caller - for example, UPDATE / DELETE SQL statements. |
| ` ParcelFileDescriptor` | ` simpleQueryForBlobFileDescriptor() ` Executes a statement that returns a 1 by 1 table with a blob value. |
| ` long` | ` simpleQueryForLong() ` Execute a statement that returns a 1 by 1 table with a numeric value. |
| ` String` | ` simpleQueryForString() ` Execute a statement that returns a 1 by 1 table with a text value. |
| ` String` | ` toString() ` Returns a string representation of the object. |

### Inherited methods

From class `

android.database.sqlite.SQLiteProgram

` `


void` `
bindAllArgsAsStrings(String[] bindArgs)
`

Given an array of String bindArgs, this method binds all of them in one single call.


`


void` `
bindBlob(int index, byte[] value)
`

Bind a byte array value to this statement.


`


void` `
bindDouble(int index, double value)
`

Bind a double value to this statement.


`


void` `
bindLong(int index, long value)
`

Bind a long value to this statement.


`


void` `
bindNull(int index)
`

Bind a NULL value to this statement.


`


void` `
bindString(int index, String value)
`

Bind a String value to this statement.


`


void` `
clearBindings()
`

Clears all existing bindings.


`


final

int` `
getUniqueId()
`

*This method was deprecated
in API level 14.
This method is deprecated and must not be used.*


`


void` `
onAllReferencesReleased()
`

Called when the last reference to the object was released by
a call to `releaseReference()` or `close()`.


From class `

android.database.sqlite.SQLiteClosable

` `


void` `
acquireReference()
`

Acquires a reference to the object.


`


void` `
close()
`

Releases a reference to the object, closing the object if the last reference
was released.


`
abstract


void` `
onAllReferencesReleased()
`

Called when the last reference to the object was released by
a call to `releaseReference()` or `close()`.


`


void` `
onAllReferencesReleasedFromContainer()
`

*This method was deprecated
in API level 16.
Do not use.*


`


void` `
releaseReference()
`

Releases a reference to the object, closing the object if the last reference
was released.


`


void` `
releaseReferenceFromContainer()
`

*This method was deprecated
in API level 16.
Do not use.*


From class `

java.lang.Object

` `


Object` `
clone()
`

Creates and returns a copy of this object.


`


boolean` `
equals(Object obj)
`

Indicates whether some other object is "equal to" this one.


`


void` `
finalize()
`

Called by the garbage collector on an object when garbage collection
determines that there are no more references to the object.


`


final

Class<?>` `
getClass()
`

Returns the runtime class of this `Object`.


`


int` `
hashCode()
`

Returns a hash code value for the object.


`


final

void` `
notify()
`

Wakes up a single thread that is waiting on this object's
monitor.


`


final

void` `
notifyAll()
`

Wakes up all threads that are waiting on this object's monitor.


`


String` `
toString()
`

Returns a string representation of the object.


`


final

void` `
wait(long timeoutMillis, int nanos)
`

Causes the current thread to wait until it is awakened, typically
by being *notified* or *interrupted*, or until a
certain amount of real time has elapsed.


`


final

void` `
wait(long timeoutMillis)
`

Causes the current thread to wait until it is awakened, typically
by being *notified* or *interrupted*, or until a
certain amount of real time has elapsed.


`


final

void` `
wait()
`

Causes the current thread to wait until it is awakened, typically
by being *notified* or *interrupted*.


From interface `

java.io.Closeable

` `
abstract


void` `
close()
`

Closes this stream and releases any system resources associated
with it.


From interface `

java.lang.AutoCloseable

` `
abstract


void` `
close()
`

Closes this resource, relinquishing any underlying resources.


## Public methods

### execute

```
public 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` | If the SQL string is invalid for some reason |

### executeInsert

```
public 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` | If the SQL string is invalid for some reason |

### executeUpdateDelete

```
public int executeUpdateDelete ()
```

Execute this SQL statement, if 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` | If the SQL string is invalid for some reason |

### simpleQueryForBlobFileDescriptor

```
public ParcelFileDescriptor simpleQueryForBlobFileDescriptor ()
```

Executes a statement that returns a 1 by 1 table with a blob value.

<br />

| Returns ||
|---|---|
| `ParcelFileDescriptor` | A read-only file descriptor for a copy of the blob value, or `null` if the value is null or could not be read for some reason. <br /> |

| Throws ||
|---|---|
| `SQLiteDoneException` | if the query returns zero rows |

### simpleQueryForLong

```
public 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` | if the query returns zero rows |

### simpleQueryForString

```
public 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` | if the query returns zero rows |

### toString

```
public String toString ()
```

Returns a string representation of the object.

<br />

| Returns ||
|---|---|
| `String` | a string representation of the object. <br /> |