super(adapter);
}
@Override
public String createSqlString(BatchQuery batch) throws IOException {
UpdateBatchQuery updateBatch = (UpdateBatchQuery) batch;
boolean status;
if(batch.getDbEntity().getDataMap()!=null && batch.getDbEntity().getDataMap().isQuotingSQLIdentifiers()){
status= true;
} else {
status = false;
}
QuotingStrategy strategy = getAdapter().getQuotingStrategy(status);
List<DbAttribute> qualifierAttributes = updateBatch.getQualifierAttributes();
List<DbAttribute> updatedDbAttributes = updateBatch.getUpdatedAttributes();
StringBuffer query = new StringBuffer("UPDATE ");
query.append(strategy.quoteFullyQualifiedName(batch.getDbEntity()));
query.append(" SET ");
int len = updatedDbAttributes.size();
for (int i = 0; i < len; i++) {
if (i > 0) {
query.append(", ");
}
DbAttribute attribute = updatedDbAttributes.get(i);
query.append(strategy.quoteString(attribute.getName()));
query.append(" = ?");
}
query.append(" WHERE ");
Iterator<DbAttribute> i = qualifierAttributes.iterator();
while (i.hasNext()) {
DbAttribute attribute = i.next();
appendDbAttribute(query, attribute);
query.append(updateBatch.isNull(attribute) ? " IS NULL" : " = ?");
if (i.hasNext()) {
query.append(" AND ");
}
}