@Test public void testSelectWhereNotWellFormated() throws SQLException { SqlBuilder builder = SqlBuilder.selectAllFrom(p).where().not(); try { builder.buildQueryConditions(); fail(); } catch (IllegalArgumentException e) { } builder = SqlBuilder.selectAllFrom(p).where().append(SegmentConstants.TRUE, SegmentConstants.AND); try { builder.buildQueryConditions(); fail(); } catch (IllegalArgumentException e) { } }
public ConditionList buildQueryConditions(List<Segment> filtered) { ConditionList providers = ConditionList.andList(); List<Segment> conditionList = new ArrayList<>(); for(Segment entry: filtered) { if(isConditionCandidate(entry)) { conditionList.add(entry); } else { parseCondition(providers, conditionList); } } parseCondition(providers, conditionList); return providers; }
ConditionBuilder { public ConditionList buildQueryConditions(List<Segment> filtered) { ConditionList providers = ConditionList.andList(); List<Segment> conditionList = new ArrayList<>(); for(Segment entry: filtered) { if(isConditionCandidate(entry)) { conditionList.add(entry); } else { parseCondition(providers, conditionList); } } parseCondition(providers, conditionList); return providers; } }
ConditionBuilder { public ConditionList buildQueryConditions(List<Segment> filtered) { ConditionList providers = ConditionList.andList(); List<Segment> conditionList = new ArrayList<>(); for(Segment entry: filtered) { if(isConditionCandidate(entry)) { conditionList.add(entry); } else { parseCondition(providers, conditionList); } } parseCondition(providers, conditionList); return providers; }  }
ConditionBuilder { public ConditionList buildQueryConditions(List<Segment> filtered) { ConditionList providers = ConditionList.andList(); List<Segment> conditionList = new ArrayList<>(); for(Segment entry: filtered) { if(isConditionCandidate(entry)) { conditionList.add(entry); } else { parseCondition(providers, conditionList); } } parseCondition(providers, conditionList); return providers; }  ConditionList buildQueryConditions(List<Segment> filtered); ConditionList buildUpdateConditions(List<Segment> filtered); }
ConditionBuilder { public ConditionList buildQueryConditions(List<Segment> filtered) { ConditionList providers = ConditionList.andList(); List<Segment> conditionList = new ArrayList<>(); for(Segment entry: filtered) { if(isConditionCandidate(entry)) { conditionList.add(entry); } else { parseCondition(providers, conditionList); } } parseCondition(providers, conditionList); return providers; }  ConditionList buildQueryConditions(List<Segment> filtered); ConditionList buildUpdateConditions(List<Segment> filtered);  }