提交 26b991b4 authored 作者: Niklas Mehner's avatar Niklas Mehner

Remove unused variable "resolvedTable"

上级 bb06b10c
......@@ -55,9 +55,8 @@ public class Delete extends Prepared {
tableFilter.reset();
Table table = tableFilter.getTable();
session.getUser().checkRight(table, Right.DELETE);
Table resolvedTable = table;
resolvedTable.fire(session, Trigger.DELETE, true);
resolvedTable.lock(session, true, false);
table.fire(session, Trigger.DELETE, true);
table.lock(session, true, false);
RowList rows = new RowList(session);
int limitRows = -1;
if (limitExpr != null) {
......@@ -75,8 +74,8 @@ public class Delete extends Prepared {
condition.getBooleanValue(session))) {
Row row = tableFilter.get();
boolean done = false;
if (resolvedTable.fireRow()) {
done = resolvedTable.fireBeforeRow(session, row, null);
if (table.fireRow()) {
done = table.fireBeforeRow(session, row, null);
}
if (!done) {
rows.add(row);
......@@ -93,16 +92,16 @@ public class Delete extends Prepared {
checkCanceled();
}
Row row = rows.next();
resolvedTable.removeRow(session, row);
table.removeRow(session, row);
session.log(table, UndoLogRecord.DELETE, row);
}
if (resolvedTable.fireRow()) {
if (table.fireRow()) {
for (rows.reset(); rows.hasNext();) {
Row row = rows.next();
resolvedTable.fireAfterRow(session, row, null, false);
table.fireAfterRow(session, row, null, false);
}
}
resolvedTable.fire(session, Trigger.DELETE, false);
table.fire(session, Trigger.DELETE, false);
return count;
} finally {
rows.close();
......
......@@ -82,13 +82,12 @@ public class Replace extends Prepared {
session.getUser().checkRight(table, Right.INSERT);
session.getUser().checkRight(table, Right.UPDATE);
setCurrentRowNumber(0);
Table resolvedTable = table;
if (list.size() > 0) {
count = 0;
for (int x = 0, size = list.size(); x < size; x++) {
setCurrentRowNumber(x + 1);
Expression[] expr = list.get(x);
Row newRow = resolvedTable.getTemplateRow();
Row newRow = table.getTemplateRow();
for (int i = 0, len = columns.length; i < len; i++) {
Column c = columns[i];
int index = c.getColumnId();
......@@ -109,12 +108,12 @@ public class Replace extends Prepared {
} else {
ResultInterface rows = query.query(0);
count = 0;
resolvedTable.fire(session, Trigger.UPDATE | Trigger.INSERT, true);
resolvedTable.lock(session, true, false);
table.fire(session, Trigger.UPDATE | Trigger.INSERT, true);
table.lock(session, true, false);
while (rows.next()) {
count++;
Value[] r = rows.currentRow();
Row newRow = resolvedTable.getTemplateRow();
Row newRow = table.getTemplateRow();
setCurrentRowNumber(count);
for (int j = 0; j < columns.length; j++) {
Column c = columns[j];
......@@ -129,7 +128,7 @@ public class Replace extends Prepared {
replace(newRow);
}
rows.close();
resolvedTable.fire(session, Trigger.UPDATE | Trigger.INSERT, false);
table.fire(session, Trigger.UPDATE | Trigger.INSERT, false);
}
return count;
}
......
......@@ -85,14 +85,13 @@ public class Update extends Prepared {
try {
Table table = tableFilter.getTable();
session.getUser().checkRight(table, Right.UPDATE);
Table resolvedTable = table;
resolvedTable.fire(session, Trigger.UPDATE, true);
resolvedTable.lock(session, true, false);
int columnCount = resolvedTable.getColumns().length;
table.fire(session, Trigger.UPDATE, true);
table.lock(session, true, false);
int columnCount = table.getColumns().length;
// get the old rows, compute the new rows
setCurrentRowNumber(0);
int count = 0;
Column[] columns = resolvedTable.getColumns();
Column[] columns = table.getColumns();
int limitRows = -1;
if (limitExpr != null) {
Value v = limitExpr.getValue(session);
......@@ -108,25 +107,25 @@ public class Update extends Prepared {
if (condition == null ||
Boolean.TRUE.equals(condition.getBooleanValue(session))) {
Row oldRow = tableFilter.get();
Row newRow = resolvedTable.getTemplateRow();
Row newRow = table.getTemplateRow();
for (int i = 0; i < columnCount; i++) {
Expression newExpr = expressionMap.get(columns[i]);
Value newValue;
if (newExpr == null) {
newValue = oldRow.getValue(i);
} else if (newExpr == ValueExpression.getDefault()) {
Column column = resolvedTable.getColumn(i);
newValue = resolvedTable.getDefaultValue(session, column);
Column column = table.getColumn(i);
newValue = table.getDefaultValue(session, column);
} else {
Column column = resolvedTable.getColumn(i);
Column column = table.getColumn(i);
newValue = column.convert(newExpr.getValue(session));
}
newRow.setValue(i, newValue);
}
resolvedTable.validateConvertUpdateSequence(session, newRow);
table.validateConvertUpdateSequence(session, newRow);
boolean done = false;
if (resolvedTable.fireRow()) {
done = resolvedTable.fireBeforeRow(session, oldRow, newRow);
if (table.fireRow()) {
done = table.fireBeforeRow(session, oldRow, newRow);
}
if (!done) {
rows.add(oldRow);
......@@ -143,16 +142,16 @@ public class Update extends Prepared {
// we need to update all indexes) before row triggers
// the cached row is already updated - we need the old values
resolvedTable.updateRows(this, session, rows);
if (resolvedTable.fireRow()) {
table.updateRows(this, session, rows);
if (table.fireRow()) {
rows.invalidateCache();
for (rows.reset(); rows.hasNext();) {
Row o = rows.next();
Row n = rows.next();
resolvedTable.fireAfterRow(session, o, n, false);
table.fireAfterRow(session, o, n, false);
}
}
resolvedTable.fire(session, Trigger.UPDATE, false);
table.fire(session, Trigger.UPDATE, false);
return count;
} finally {
rows.close();
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论