/** * Build the actual set clause converting logical property names to db columns etc. */ public String buildSetClause(DeployParser deployParser) { int setCount = 0; StringBuilder sb = new StringBuilder(); for (Map.Entry<String, Value> entry : values.entrySet()) { String property = entry.getKey(); if (setCount++ > 0) { sb.append(", "); } // translate to db columns and remove table alias placeholders sb.append(deployParser.parse(property).replace("${}", "")); sb.append(entry.getValue().bindClause()); } return sb.toString(); }
/** * Build the hash for the query plan caching. */ void buildQueryPlanHash(HashQueryPlanBuilder builder) { builder.add(OrmUpdateProperties.class); Set<Map.Entry<String, Value>> entries = values.entrySet(); for (Map.Entry<String, Value> entry : entries) { builder.add(entry.getKey()); builder.bind(entry.getValue().getBindCount()); } }
/** * Return a logical set clause to use for isSameByPlan() use. */ private String logicalSetClause() { StringBuilder sb = new StringBuilder(); for (Map.Entry<String, Value> entry : values.entrySet()) { sb.append(", "); sb.append(entry.getKey()).append(entry.getValue().bindClause()); } return sb.toString(); }
/** * Bind all the bind values for the update set clause. */ public void bind(Binder binder, DataBind dataBind) throws SQLException { for (Value bindValue : values.values()) { bindValue.bind(binder, dataBind); } }