public final class StatementBuilder extends Object
StatementBuilder allows for statements to be constructed in parts.
Typical usage is:
StatementBuilder statementBuilder = new StatementBuilder()
.where("lastModifiedDateTime > :yesterday AND type = :type")
.orderBy("name DESC")
.limit(200)
.offset(20)
.withBindVariableValue("yesterday",
DateTimes.fromDate(new org.joda.time.DateTime().minusDays(1).toDate()))
.withBindVariableValue("type", "Type")
Statement statement = statementBuilder.toStatement();
//...
statementBuilder.increaseOffsetBy(20);
statement = statementBuilder.toStatement();
| Modifier and Type | Field and Description |
|---|---|
static int |
SUGGESTED_PAGE_LIMIT |
| Constructor and Description |
|---|
StatementBuilder()
Constructs a statement builder.
|
| Modifier and Type | Method and Description |
|---|---|
String |
buildQuery() |
StatementBuilder |
from(String table) |
Map<String,com.google.api.ads.admanager.axis.v202208.Value> |
getBindVariableMap() |
Integer |
getOffset() |
StatementBuilder |
increaseOffsetBy(Integer amount) |
StatementBuilder |
limit(Integer count) |
StatementBuilder |
offset(Integer count) |
StatementBuilder |
orderBy(String orderBy) |
StatementBuilder |
removeLimitAndOffset() |
StatementBuilder |
select(String columns) |
com.google.api.ads.admanager.axis.v202208.Statement |
toStatement()
Gets the
Statement representing the state of this statement builder. |
StatementBuilder |
where(String conditions) |
StatementBuilder |
withBindVariableValue(String key,
Object value)
Adds a bind variable value to the statement.
|
StatementBuilder |
withBindVariableValue(String key,
com.google.api.ads.admanager.axis.v202208.Value value)
Adds a bind variable value to the statement.
|
public static final int SUGGESTED_PAGE_LIMIT
@CanIgnoreReturnValue public StatementBuilder withBindVariableValue(String key, Object value)
Pql.createValue(Object). If the value is of type Value, no conversion will be done.key - the value keyvalue - the bind variable value@CanIgnoreReturnValue public StatementBuilder withBindVariableValue(String key, com.google.api.ads.admanager.axis.v202208.Value value)
key - the value keyvalue - the bind variable valuepublic com.google.api.ads.admanager.axis.v202208.Statement toStatement()
Statement representing the state of this statement builder.Statement@CanIgnoreReturnValue public StatementBuilder select(String columns)
@CanIgnoreReturnValue public StatementBuilder from(String table)
@CanIgnoreReturnValue public StatementBuilder where(String conditions)
@CanIgnoreReturnValue public StatementBuilder limit(Integer count)
@CanIgnoreReturnValue public StatementBuilder offset(Integer count)
@CanIgnoreReturnValue public StatementBuilder increaseOffsetBy(Integer amount)
public Integer getOffset()
@CanIgnoreReturnValue public StatementBuilder removeLimitAndOffset()
@CanIgnoreReturnValue public StatementBuilder orderBy(String orderBy)
public Map<String,com.google.api.ads.admanager.axis.v202208.Value> getBindVariableMap()
public String buildQuery()
Copyright © 2022. All Rights Reserved.