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

Remove unused variable "resolvedTable"

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