@Test public void testRemoveKeyword_doesntMatch() { assertEquals("FROM table", QueryBuilder.removeKeyword("FROM table", "SELECT")); assertEquals("table", QueryBuilder.removeKeyword("table", "FROM")); }
static String removeKeyword(String clause, String keyword) { keyword = keyword + " "; if (clause.regionMatches(true, 0, keyword, 0, keyword.length())) { return clause.substring(keyword.length()); } return clause; }
QueryBuilder implements QueryBuilderInterface<V> { static String removeKeyword(String clause, String keyword) { keyword = keyword + " "; if (clause.regionMatches(true, 0, keyword, 0, keyword.length())) { return clause.substring(keyword.length()); } return clause; } }
QueryBuilder implements QueryBuilderInterface<V> { static String removeKeyword(String clause, String keyword) { keyword = keyword + " "; if (clause.regionMatches(true, 0, keyword, 0, keyword.length())) { return clause.substring(keyword.length()); } return clause; } QueryBuilder(); }
QueryBuilder implements QueryBuilderInterface<V> { static String removeKeyword(String clause, String keyword) { keyword = keyword + " "; if (clause.regionMatches(true, 0, keyword, 0, keyword.length())) { return clause.substring(keyword.length()); } return clause; } QueryBuilder(); @Override QueryBuilder<V> select(String columns); @Override QueryBuilder<V> from(String table); @Override QueryBuilder<V> where(String conditions); @Override QueryBuilder<V> limit(Integer count); @Override QueryBuilder<V> offset(Integer count); @Override QueryBuilder<V> increaseOffsetBy(Integer amount); @Override Integer getOffset(); @Override QueryBuilder<V> removeLimitAndOffset(); @Override QueryBuilder<V> orderBy(String orderBy); @Override QueryBuilder<V> withBindVariableValue(String key, V value); QueryBuilder<V> withBindVariableValues(Map<String, V> values); @Override Map<String, V> getBindVariableMap(); @Override String buildQuery(); }
QueryBuilder implements QueryBuilderInterface<V> { static String removeKeyword(String clause, String keyword) { keyword = keyword + " "; if (clause.regionMatches(true, 0, keyword, 0, keyword.length())) { return clause.substring(keyword.length()); } return clause; } QueryBuilder(); @Override QueryBuilder<V> select(String columns); @Override QueryBuilder<V> from(String table); @Override QueryBuilder<V> where(String conditions); @Override QueryBuilder<V> limit(Integer count); @Override QueryBuilder<V> offset(Integer count); @Override QueryBuilder<V> increaseOffsetBy(Integer amount); @Override Integer getOffset(); @Override QueryBuilder<V> removeLimitAndOffset(); @Override QueryBuilder<V> orderBy(String orderBy); @Override QueryBuilder<V> withBindVariableValue(String key, V value); QueryBuilder<V> withBindVariableValues(Map<String, V> values); @Override Map<String, V> getBindVariableMap(); @Override String buildQuery();  }