@Test public void testInsertWithColumnListBySelect() throws SQLException { SqlBuilder builder = SqlBuilder.insertInto(p, p.Name, p.CountryID); builder.append(SqlBuilder.select(p.Name).from(p).where().allOf(p.Name.eq(1), p.CountryID.gt(2))); ConditionList cl = builder.buildUpdateConditions(); assertTrue(cl.isIntersected()); assertEquals(2, cl.size()); }
public ConditionList buildUpdateConditions(List<Segment> filtered) { if(filtered.contains(SegmentConstants.INSERT)) { if(filtered.contains(SegmentConstants.SELECT) || filtered.contains(SegmentConstants.SET)) { filtered = filterColumnList(filtered); return buildQueryConditions(filtered); } return buildByParameters(filtered); } if(filtered.contains(SegmentConstants.DELETE)) { return buildQueryConditions(filtered); } if(filtered.contains(SegmentConstants.UPDATE)) { return buildQueryConditions(filtered); } return buildByParameters(filtered); }
ConditionBuilder { public ConditionList buildUpdateConditions(List<Segment> filtered) { if(filtered.contains(SegmentConstants.INSERT)) { if(filtered.contains(SegmentConstants.SELECT) || filtered.contains(SegmentConstants.SET)) { filtered = filterColumnList(filtered); return buildQueryConditions(filtered); } return buildByParameters(filtered); } if(filtered.contains(SegmentConstants.DELETE)) { return buildQueryConditions(filtered); } if(filtered.contains(SegmentConstants.UPDATE)) { return buildQueryConditions(filtered); } return buildByParameters(filtered); } }
ConditionBuilder { public ConditionList buildUpdateConditions(List<Segment> filtered) { if(filtered.contains(SegmentConstants.INSERT)) { if(filtered.contains(SegmentConstants.SELECT) || filtered.contains(SegmentConstants.SET)) { filtered = filterColumnList(filtered); return buildQueryConditions(filtered); } return buildByParameters(filtered); } if(filtered.contains(SegmentConstants.DELETE)) { return buildQueryConditions(filtered); } if(filtered.contains(SegmentConstants.UPDATE)) { return buildQueryConditions(filtered); } return buildByParameters(filtered); }  }
ConditionBuilder { public ConditionList buildUpdateConditions(List<Segment> filtered) { if(filtered.contains(SegmentConstants.INSERT)) { if(filtered.contains(SegmentConstants.SELECT) || filtered.contains(SegmentConstants.SET)) { filtered = filterColumnList(filtered); return buildQueryConditions(filtered); } return buildByParameters(filtered); } if(filtered.contains(SegmentConstants.DELETE)) { return buildQueryConditions(filtered); } if(filtered.contains(SegmentConstants.UPDATE)) { return buildQueryConditions(filtered); } return buildByParameters(filtered); }  ConditionList buildQueryConditions(List<Segment> filtered); ConditionList buildUpdateConditions(List<Segment> filtered); }
ConditionBuilder { public ConditionList buildUpdateConditions(List<Segment> filtered) { if(filtered.contains(SegmentConstants.INSERT)) { if(filtered.contains(SegmentConstants.SELECT) || filtered.contains(SegmentConstants.SET)) { filtered = filterColumnList(filtered); return buildQueryConditions(filtered); } return buildByParameters(filtered); } if(filtered.contains(SegmentConstants.DELETE)) { return buildQueryConditions(filtered); } if(filtered.contains(SegmentConstants.UPDATE)) { return buildQueryConditions(filtered); } return buildByParameters(filtered); }  ConditionList buildQueryConditions(List<Segment> filtered); ConditionList buildUpdateConditions(List<Segment> filtered);  }