}
return result;
}
public UpdateStatement getUpdateStatement() {
UpdateStatement result = getSchema().getSQLFactory().newUpdateStatement();
result.setTable(this);
TableReference ref = result.getTableReference();
boolean hasPrimaryKey = false;
for (Iterator iter = getColumns(); iter.hasNext(); ) {
Column column = (Column) iter.next();
if (column.isPrimaryKeyPart()) {
hasPrimaryKey = true;
} else {
result.addSet(column);
}
}
if (hasPrimaryKey) {
result.getWhere().addColumnSetQuery(getPrimaryKey(), ref);
} else {
throw new IllegalStateException("Cannot create a default update statement without a primary key.");
}
return result;
}