added in version 2.0.0
belongs to Maven artifact androidx.sqlite:sqlite:2.0.0-beta01

SimpleSQLiteQuery

public final class SimpleSQLiteQuery
extends Object implements SupportSQLiteQuery

java.lang.Object
   ↳ androidx.sqlite.db.SimpleSQLiteQuery


A basic implementation of SupportSQLiteQuery which receives a query and its args and binds args based on the passed in Object type.

Summary

Public constructors

SimpleSQLiteQuery(String query, Object[] bindArgs)

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

SimpleSQLiteQuery(String query)

Creates an SQL query without any bind arguments.

Public methods

static void bind(SupportSQLiteProgram statement, Object[] bindArgs)

Binds the given arguments into the given sqlite statement.

void bindTo(SupportSQLiteProgram statement)

Callback to bind the query parameters to the compiled statement.

int getArgCount()

Returns the number of arguments in this query.

String getSql()

The SQL query.

Inherited methods

Public constructors

SimpleSQLiteQuery

added in version 2.0.0
public SimpleSQLiteQuery (String query, 
                Object[] bindArgs)

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

Parameters
query String: The query string, can include bind arguments (.e.g ?).

bindArgs Object: The bind argument value that will replace the placeholders in the query.

SimpleSQLiteQuery

added in version 2.0.0
public SimpleSQLiteQuery (String query)

Creates an SQL query without any bind arguments.

Parameters
query String: The SQL query to execute. Cannot include bind parameters.

Public methods

bind

added in version 2.0.0
public static void bind (SupportSQLiteProgram statement, 
                Object[] bindArgs)

Binds the given arguments into the given sqlite statement.

Parameters
statement SupportSQLiteProgram: The sqlite statement

bindArgs Object: The list of bind arguments

bindTo

added in version 2.0.0
public void bindTo (SupportSQLiteProgram statement)

Callback to bind the query parameters to the compiled statement.

Parameters
statement SupportSQLiteProgram: The compiled statement

getArgCount

added in version 2.0.0
public int getArgCount ()

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

Returns
int The number of arguments in the query.

getSql

added in version 2.0.0
public String getSql ()

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

Returns
String The SQL query to compile