private static String autoCreateSelectClause(String whereClause) { if (whereClause == null) { return null; } String tmp = whereClause; tmp = StringUtility.removeTag(tmp, "fromPart"); tmp = StringUtility.removeTag(tmp, "wherePart"); tmp = StringUtility.removeTag(tmp, "havingPart"); if (!StringUtility.hasText(tmp)) { return null; } if ((" " + tmp).matches(".*[^a-zA-Z_$]SELECT[^a-zA-Z_$].*")) { return null; } return whereClause; }
if (selectPart != null) { parentContrib.getSelectParts().add(selectPart); entityPart = StringUtility.removeTag(entityPart, "selectPart").trim(); if (fromPart != null) { parentContrib.getFromParts().add(fromPart); entityPart = StringUtility.removeTag(entityPart, "fromPart").trim(); if (wherePart != null) { parentContrib.getWhereParts().add(wherePart); entityPart = StringUtility.removeTag(entityPart, "wherePart").trim(); if (groupByPart != null) { parentContrib.getGroupByParts().add(groupByPart); entityPart = StringUtility.removeTag(entityPart, "groupByPart").trim(); if (havingPart != null) { parentContrib.getHavingParts().add(havingPart); entityPart = StringUtility.removeTag(entityPart, "havingPart").trim();
stm = StringUtility.removeTag(stm, "fromPart").trim(); String wherePart = StringUtility.getTag(stm, "wherePart"); if (wherePart == null) { String tmp = StringUtility.removeTag(stm, "attribute").trim(); if (!tmp.isEmpty()) { wherePart = stm; stm = StringUtility.removeTag(stm, "wherePart").trim(); String attPart = StringUtility.getTag(stm, "attribute"); stm = StringUtility.removeTag(stm, "attribute").trim(); if (!stm.isEmpty()) { LOG.warn("attribute part is not well-formed; contains wherePart tag and also other sql text: {}", stm);