# SimpleSQLiteQuery

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

*** ** * ** ***


```
public final class SimpleSQLiteQuery implements SupportSQLiteQuery
```

<br />

*** ** * ** ***

A basic implementation of `https://developer.android.com/reference/androidx/sqlite/db/SupportSQLiteQuery` which receives a query and its args and binds args based on the passed in Object type.

## Summary

| ### Public constructors |
|---|
| `https://developer.android.com/reference/androidx/sqlite/db/SimpleSQLiteQuery#SimpleSQLiteQuery(kotlin.String)(@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/lang/String.html query)` Creates an SQL query without any bind arguments. |
| `https://developer.android.com/reference/androidx/sqlite/db/SimpleSQLiteQuery#SimpleSQLiteQuery(kotlin.String,kotlin.Array)(@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/lang/String.html query, Object[] bindArgs)` Creates an SQL query with the sql string and the bind arguments. |

| ### Public methods |
|---|---|
| `static final void` | `https://developer.android.com/reference/androidx/sqlite/db/SimpleSQLiteQuery#bind(androidx.sqlite.db.SupportSQLiteProgram,kotlin.Array)(@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/sqlite/db/SupportSQLiteProgram statement, Object[] bindArgs)` Binds the given arguments into the given sqlite statement. |
| `void` | `https://developer.android.com/reference/androidx/sqlite/db/SimpleSQLiteQuery#bindTo(androidx.sqlite.db.SupportSQLiteProgram)(@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/sqlite/db/SupportSQLiteProgram statement)` Creates an SQL query without any bind arguments. |
| `int` | `https://developer.android.com/reference/androidx/sqlite/db/SimpleSQLiteQuery#getArgCount()()` Is the number of arguments in this query. |
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/lang/String.html` | `https://developer.android.com/reference/androidx/sqlite/db/SimpleSQLiteQuery#getSql()()` The SQL query. |

## Public constructors

### SimpleSQLiteQuery

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

```
public SimpleSQLiteQuery(@NonNull String query)
```

Creates an SQL query without any bind arguments.

| Parameters |
|---|---|
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/lang/String.html query` | The SQL query to execute. Cannot include bind parameters. |

### SimpleSQLiteQuery

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

```
public SimpleSQLiteQuery(@NonNull String query, Object[] bindArgs)
```

Creates an SQL query with the sql string and the bind arguments.

| Parameters |
|---|---|
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/lang/String.html query` | The query string, can include bind arguments (.e.g ?). |
| `Object[] bindArgs` | The bind argument value that will replace the placeholders in the query. |

## Public methods

### bind

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

```
public static final void bind(@NonNull SupportSQLiteProgram statement, Object[] bindArgs)
```

Binds the given arguments into the given sqlite statement.

| Parameters |
|---|---|
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/sqlite/db/SupportSQLiteProgram statement` | The sqlite statement |
| `Object[] bindArgs` | The list of bind arguments |

### bindTo

```
public void bindTo(@NonNull SupportSQLiteProgram statement)
```

Creates an SQL query without any bind arguments.

| Parameters |
|---|---|
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/sqlite/db/SupportSQLiteProgram statement` | The SQL query to execute. Cannot include bind parameters. |

### getArgCount

```
public int getArgCount()
```

Is the number of arguments in this query. This is equal to the number of placeholders in the query string. See: https://www.sqlite.org/c3ref/bind_blob.html for details.

### getSql

```
public @NonNull String getSql()
```

The SQL query. This query can have placeholders(?) for bind arguments.