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.dfp.jaxws.v201705.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.dfp.jaxws.v201705.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.dfp.jaxws.v201705.Value value)
Adds a bind variable value to the statement.
|
public static final int SUGGESTED_PAGE_LIMIT
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 valuepublic StatementBuilder withBindVariableValue(String key, com.google.api.ads.dfp.jaxws.v201705.Value value)
key
- the value keyvalue
- the bind variable valuepublic com.google.api.ads.dfp.jaxws.v201705.Statement toStatement()
Statement
representing the state of this statement
builder.Statement
public StatementBuilder select(String columns)
public StatementBuilder from(String table)
public StatementBuilder where(String conditions)
public StatementBuilder limit(Integer count)
public StatementBuilder offset(Integer count)
public StatementBuilder increaseOffsetBy(Integer amount)
public Integer getOffset()
public StatementBuilder removeLimitAndOffset()
public StatementBuilder orderBy(String orderBy)
public Map<String,com.google.api.ads.dfp.jaxws.v201705.Value> getBindVariableMap()
public String buildQuery()
Copyright © 2018. All Rights Reserved.