use of com.google.api.ads.admanager.jaxws.v202108.Statement in project googleads-java-lib by googleads.
the class StatementBuilder method toStatement.
/**
* Gets the {@link Statement} representing the state of this statement builder.
*
* @return the {@link Statement}
*/
public Statement toStatement() {
Statement statement = new Statement();
statement.setQuery(queryBuilder.buildQuery());
statement.getValues().addAll(Maps.toList(queryBuilder.getBindVariableMap(), StringValueMapEntry.class));
return statement;
}
use of com.google.api.ads.admanager.jaxws.v202108.Statement in project googleads-java-lib by googleads.
the class StatementBuilderTest method testWhere.
@Test
public void testWhere() {
StatementBuilder statementBuilder = new StatementBuilder();
Statement statement = statementBuilder.where("id = 12345").toStatement();
assertEquals("WHERE id = 12345", statement.getQuery());
}
use of com.google.api.ads.admanager.jaxws.v202108.Statement in project googleads-java-lib by googleads.
the class StatementBuilderTest method testOrderBy.
@Test
public void testOrderBy() {
StatementBuilder statementBuilder = new StatementBuilder();
Statement statement = statementBuilder.orderBy("id ASC").toStatement();
assertEquals("ORDER BY id ASC", statement.getQuery());
}
use of com.google.api.ads.admanager.jaxws.v202108.Statement in project googleads-java-lib by googleads.
the class StatementBuilderTest method testFrom.
@Test
public void testFrom() {
StatementBuilder statementBuilder = new StatementBuilder();
Statement statement = statementBuilder.from("line_item").toStatement();
assertEquals("FROM line_item", statement.getQuery());
}
use of com.google.api.ads.admanager.jaxws.v202108.Statement in project googleads-java-lib by googleads.
the class StatementBuilderTest method testBindVariables_bool.
@Test
public void testBindVariables_bool() {
StatementBuilder statementBuilder = new StatementBuilder();
Statement statement = statementBuilder.where("bool = :bool").withBindVariableValue("bool", true).toStatement();
String_ValueMapEntry entry = statement.getValues(0);
assertEquals("bool", entry.getKey());
assertEquals(BooleanValue.class, entry.getValue().getClass());
assertEquals(true, ((BooleanValue) entry.getValue()).getValue());
}
Aggregations