added in version 1.1.0
belongs to Maven artifact android.arch.persistence:db:1.1.0-beta2

SimpleSQLiteQuery

public final class SimpleSQLiteQuery
extends Object implements SupportSQLiteQuery

java.lang.Object
   ↳ android.arch.persistence.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 1.1.0
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 1.1.0
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 1.1.0
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 1.1.0
void bindTo (SupportSQLiteProgram statement)

Callback to bind the query parameters to the compiled statement.

Parameters
statement SupportSQLiteProgram: The compiled statement

getArgCount

added in version 1.1.0
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 1.1.0
String getSql ()

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

Returns
String The SQL query to compile