提交 cba7f2c8 authored 作者: Evgenij Ryazanov's avatar Evgenij Ryazanov

Extract row variable

上级 4cd4f38d
......@@ -375,12 +375,13 @@ public class Insert extends Prepared implements ResultTarget {
ArrayList<String> variableNames = new ArrayList<>(
duplicateKeyAssignmentMap.size());
Expression[] row = list.get(getCurrentRowNumber() - 1);
for (int i = 0; i < columns.length; i++) {
String key = table.getSchema().getName() + "." +
table.getName() + "." + columns[i].getName();
variableNames.add(key);
session.setVariable(key,
list.get(getCurrentRowNumber() - 1)[i].getValue(session));
row[i].getValue(session));
}
StatementBuilder buff = new StatementBuilder("UPDATE ");
......@@ -425,6 +426,7 @@ public class Insert extends Prepared implements ResultTarget {
indexedColumns = foundIndex.getColumns();
}
Expression[] row = list.get(getCurrentRowNumber() - 1);
Expression condition = null;
for (Column column : indexedColumns) {
ExpressionColumn expr = new ExpressionColumn(session.getDatabase(),
......@@ -433,13 +435,10 @@ public class Insert extends Prepared implements ResultTarget {
for (int i = 0; i < columns.length; i++) {
if (expr.getColumnName().equals(columns[i].getName())) {
if (condition == null) {
condition = new Comparison(session, Comparison.EQUAL,
expr, list.get(getCurrentRowNumber() - 1)[i++]);
condition = new Comparison(session, Comparison.EQUAL, expr, row[i++]);
} else {
condition = new ConditionAndOr(ConditionAndOr.AND,
condition,
new Comparison(session, Comparison.EQUAL, expr,
list.get(getCurrentRowNumber() - 1)[i++]));
condition = new ConditionAndOr(ConditionAndOr.AND, condition,
new Comparison(session, Comparison.EQUAL, expr, row[i++]));
}
}
}
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论