SupportSQLiteQueryBuilder


public final class SupportSQLiteQueryBuilder


A simple query builder to create SQL SELECT queries.

Summary

Public methods

static final @NonNull SupportSQLiteQueryBuilder
builder(@NonNull String tableName)

Creates a query for the given table name.

final @NonNull SupportSQLiteQueryBuilder
columns(String[] columns)

Sets the given list of columns as the columns that will be returned.

final @NonNull SupportSQLiteQuery

Creates the SupportSQLiteQuery that can be passed into SupportSQLiteDatabase.query.

final @NonNull SupportSQLiteQueryBuilder

Adds DISTINCT keyword to the query.

final @NonNull SupportSQLiteQueryBuilder
groupBy(String groupBy)

Adds a GROUP BY statement.

final @NonNull SupportSQLiteQueryBuilder
having(String having)

Adds a HAVING statement.

final @NonNull SupportSQLiteQueryBuilder

Adds a LIMIT statement.

final @NonNull SupportSQLiteQueryBuilder
orderBy(String orderBy)

Adds an ORDER BY statement.

final @NonNull SupportSQLiteQueryBuilder
selection(String selection, Object[] bindArgs)

Sets the arguments for the WHERE clause.

Public methods

builder

Added in 2.3.0
public static final @NonNull SupportSQLiteQueryBuilder builder(@NonNull String tableName)

Creates a query for the given table name.

Parameters
@NonNull String tableName

The table name(s) to query.

Returns
@NonNull SupportSQLiteQueryBuilder

A builder to create a query.

columns

Added in 2.0.0
public final @NonNull SupportSQLiteQueryBuilder columns(String[] columns)

Sets the given list of columns as the columns that will be returned.

Parameters
String[] columns

The list of column names that should be returned.

create

Added in 2.0.0
public final @NonNull SupportSQLiteQuery create()

Creates the SupportSQLiteQuery that can be passed into SupportSQLiteDatabase.query.

Returns
@NonNull SupportSQLiteQuery

a new query

distinct

Added in 2.0.0
public final @NonNull SupportSQLiteQueryBuilder distinct()

Adds DISTINCT keyword to the query.

groupBy

Added in 2.0.0
public final @NonNull SupportSQLiteQueryBuilder groupBy(String groupBy)

Adds a GROUP BY statement.

Parameters
String groupBy

The value of the GROUP BY statement.

having

Added in 2.0.0
public final @NonNull SupportSQLiteQueryBuilder having(String having)

Adds a HAVING statement. You must also provide groupBy for this to work.

Parameters
String having

The having clause.

limit

Added in 2.0.0
public final @NonNull SupportSQLiteQueryBuilder limit(@NonNull String limit)

Adds a LIMIT statement.

Parameters
@NonNull String limit

The limit value.

orderBy

Added in 2.0.0
public final @NonNull SupportSQLiteQueryBuilder orderBy(String orderBy)

Adds an ORDER BY statement.

Parameters
String orderBy

The order clause.

selection

Added in 2.0.0
public final @NonNull SupportSQLiteQueryBuilder selection(String selection, Object[] bindArgs)

Sets the arguments for the WHERE clause.

Parameters
String selection

The list of selection columns

Object[] bindArgs

The list of bind arguments to match against these columns