use of com.google.api.ads.admanager.axis.v202105.Statement in project googleads-java-lib by googleads.
the class StatementBuilderTest method testRemoveLimitAndOffset.
@Test
public void testRemoveLimitAndOffset() {
StatementBuilder statementBuilder = new StatementBuilder();
Statement initialOffset = statementBuilder.where("id = 1").limit(100).offset(100).toStatement();
assertEquals("WHERE id = 1 LIMIT 100 OFFSET 100", initialOffset.getQuery());
Statement removed = statementBuilder.removeLimitAndOffset().toStatement();
assertEquals("WHERE id = 1", removed.getQuery());
}
use of com.google.api.ads.admanager.axis.v202105.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.axis.v202105.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.axis.v202105.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.axis.v202105.Statement in project eol-globi-data by jhpoelen.
the class CypherQueryExecutorIT method executeBoltQuery.
@Test
public void executeBoltQuery() {
Driver driver = GraphDatabase.driver("bolt://preston:7687", AuthTokens.none());
Session session = driver.session(AccessMode.READ);
try (Transaction transaction = session.beginTransaction()) {
String s = "CYPHER 2.3 START dataset = node:datasets({namespace}) RETURN dataset.namespace LIMIT 1";
Statement statement = new Statement(s, new TreeMap<String, Object>() {
{
put("namespace", "namespace:\"globalbioticinteractions/template-dataset\"");
}
});
StatementResult run = transaction.run(statement);
run.stream().map(r -> r.asMap()).forEach(System.out::println);
transaction.success();
}
}
Aggregations