use of com.google.api.ads.admanager.jaxws.v202205.Statement in project googleads-java-lib by googleads.
the class StatementBuilderTest method testSelect.
@Test
public void testSelect() {
StatementBuilder statementBuilder = new StatementBuilder();
Statement statement = statementBuilder.select("id, name").toStatement();
assertEquals("SELECT id, name", statement.getQuery());
}
use of com.google.api.ads.admanager.jaxws.v202205.Statement in project googleads-java-lib by googleads.
the class StatementBuilderTest method testLimit.
@Test
public void testLimit() {
StatementBuilder statementBuilder = new StatementBuilder();
Statement statement = statementBuilder.limit(500).toStatement();
assertEquals("LIMIT 500", statement.getQuery());
}
use of com.google.api.ads.admanager.jaxws.v202205.Statement in project googleads-java-lib by googleads.
the class StatementBuilderTest method testBindVariables_text.
@Test
public void testBindVariables_text() {
StatementBuilder statementBuilder = new StatementBuilder();
Statement statement = statementBuilder.where("text = :text").withBindVariableValue("text", "foo").toStatement();
String_ValueMapEntry entry = statement.getValues(0);
assertEquals("text", entry.getKey());
assertEquals(TextValue.class, entry.getValue().getClass());
assertEquals("foo", ((TextValue) entry.getValue()).getValue());
}
use of com.google.api.ads.admanager.jaxws.v202205.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.setValues(Maps.toList(queryBuilder.getBindVariableMap(), String_ValueMapEntry.class).toArray(new String_ValueMapEntry[] {}));
return statement;
}
use of com.google.api.ads.admanager.jaxws.v202205.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;
}
Aggregations