Append the string containing the SQL insert string for the given table.
SQLCall call = new SQLCall();
call.returnNothing();
Writer writer = new CharArrayWriter(100);
try {
writer.write("UPDATE ");
writer.write(getTable().getQualifiedName());
writer.write(" SET ");
Vector fieldsForTable = new Vector();
for (Enumeration fieldsEnum = getModifyRow().keys(); fieldsEnum.hasMoreElements();) {
DatabaseField field = (DatabaseField)fieldsEnum.nextElement();
if (field.getTable().equals(getTable()) || (!field.hasTableName())) {
fieldsForTable.addElement(field);
}
}
if (fieldsForTable.isEmpty()) {
return null;
}
for (int i = 0; i < fieldsForTable.size(); i++) {
DatabaseField field = (DatabaseField)fieldsForTable.elementAt(i);
writer.write(field.getName());
writer.write(" = ");
call.appendModify(writer, field);
if ((i + 1) < fieldsForTable.size()) {
writer.write(", ");
}
}
if (!(getWhereClause() == null)) {
writer.write(" WHERE ");
ExpressionSQLPrinter printer = new ExpressionSQLPrinter(session, getTranslationRow(), call, false);
printer.setWriter(writer);
printer.printExpression(getWhereClause());
}
call.setSQLString(writer.toString());
return call;
} catch (IOException exception) {
throw ValidationException.fileError(exception);
}