@Test public void testBuildQuery() { StatementBuilder statementBuilder = new StatementBuilder() .select("id, name") .from("line_item") .where("name like :prefix") .orderBy("id ASC") .limit(100) .offset(0) .withBindVariableValue("prefix", "debug-%"); String expected = "SELECT id, name FROM line_item WHERE name like :prefix ORDER BY id ASC " + "LIMIT 100 OFFSET 0"; assertEquals(expected, statementBuilder.buildQuery()); }
public String buildQuery() { return queryBuilder.buildQuery(); }
StatementBuilder { public String buildQuery() { return queryBuilder.buildQuery(); } }
StatementBuilder { public String buildQuery() { return queryBuilder.buildQuery(); } StatementBuilder(); @VisibleForTesting  StatementBuilder(QueryBuilderInterface<Value> queryBuilder); }
StatementBuilder { public String buildQuery() { return queryBuilder.buildQuery(); } StatementBuilder(); @VisibleForTesting  StatementBuilder(QueryBuilderInterface<Value> queryBuilder); StatementBuilder withBindVariableValue(String key, Object value); StatementBuilder withBindVariableValue(String key, Value value); Statement toStatement(); StatementBuilder select(String columns); StatementBuilder from(String table); StatementBuilder where(String conditions); StatementBuilder limit(Integer count); StatementBuilder offset(Integer count); StatementBuilder increaseOffsetBy(Integer amount); Integer getOffset(); StatementBuilder removeLimitAndOffset(); StatementBuilder orderBy(String orderBy); Map<String, Value> getBindVariableMap(); String buildQuery(); }
StatementBuilder { public String buildQuery() { return queryBuilder.buildQuery(); } StatementBuilder(); @VisibleForTesting  StatementBuilder(QueryBuilderInterface<Value> queryBuilder); StatementBuilder withBindVariableValue(String key, Object value); StatementBuilder withBindVariableValue(String key, Value value); Statement toStatement(); StatementBuilder select(String columns); StatementBuilder from(String table); StatementBuilder where(String conditions); StatementBuilder limit(Integer count); StatementBuilder offset(Integer count); StatementBuilder increaseOffsetBy(Integer amount); Integer getOffset(); StatementBuilder removeLimitAndOffset(); StatementBuilder orderBy(String orderBy); Map<String, Value> getBindVariableMap(); String buildQuery(); static final int SUGGESTED_PAGE_LIMIT; }