提交 973875f3 authored 作者: Thomas Mueller's avatar Thomas Mueller

--no commit message

--no commit message
上级 b8e58461
......@@ -23,6 +23,7 @@ public class CreateLinkedTable extends SchemaCommand {
private String driver, url, user, password, originalTable;
private boolean ifNotExists;
private String comment;
private boolean emitUpdates;
public CreateLinkedTable(Session session, Schema schema) {
super(session, schema);
......@@ -68,11 +69,15 @@ public class CreateLinkedTable extends SchemaCommand {
tableName);
}
int id = getObjectId(false, true);
TableLink table = new TableLink(getSchema(), id, tableName, driver, url, user, password, originalTable);
TableLink table = new TableLink(getSchema(), id, tableName, driver, url, user, password, originalTable, emitUpdates);
table.setComment(comment);
db.addSchemaObject(session, table);
return 0;
}
public void setEmitUpdates(boolean emitUpdates) {
this.emitUpdates = emitUpdates;
}
public void setComment(String comment) {
this.comment = comment;
......
......@@ -26,11 +26,11 @@ import org.h2.util.FileUtils;
import org.h2.util.IOUtils;
import org.h2.util.ObjectArray;
public class Backup extends Prepared {
public class BackupCommand extends Prepared {
private String fileName;
public Backup(Session session) {
public BackupCommand(Session session) {
super(session);
}
......
......@@ -66,7 +66,7 @@ public class Delete extends Prepared {
checkCancelled();
Row row = (Row) rows.get(i);
table.removeRow(session, row);
session.log(new UndoLogRecord(table, UndoLogRecord.DELETE, row));
session.log(table, UndoLogRecord.DELETE, row);
}
if(table.fireRow()) {
for (int i = 0; i < rows.size(); i++) {
......
......@@ -86,7 +86,7 @@ public class Insert extends Prepared {
table.fireBeforeRow(session, null, newRow);
table.lock(session, true);
table.addRow(session, newRow);
session.log(new UndoLogRecord(table, UndoLogRecord.INSERT, newRow));
session.log(table, UndoLogRecord.INSERT, newRow);
table.fireAfter(session);
table.fireAfterRow(session, null, newRow);
count++;
......@@ -111,7 +111,7 @@ public class Insert extends Prepared {
table.validateConvertUpdateSequence(session, newRow);
table.fireBeforeRow(session, null, newRow);
table.addRow(session, newRow);
session.log(new UndoLogRecord(table, UndoLogRecord.INSERT, newRow));
session.log(table, UndoLogRecord.INSERT, newRow);
table.fireAfterRow(session, null, newRow);
}
rows.close();
......
......@@ -166,7 +166,7 @@ public class Merge extends Prepared {
table.fireBeforeRow(session, null, row);
table.lock(session, true);
table.addRow(session, row);
session.log(new UndoLogRecord(table, UndoLogRecord.INSERT, row));
session.log(table, UndoLogRecord.INSERT, row);
table.fireAfter(session);
table.fireAfterRow(session, null, row);
} else if(count != 1) {
......
......@@ -15,11 +15,11 @@ import org.h2.message.Message;
import org.h2.util.ScriptReader;
import org.h2.util.StringUtils;
public class RunScript extends ScriptBase {
public class RunScriptCommand extends ScriptBase {
private String charset = StringUtils.getDefaultCharset();
public RunScript(Session session) {
public RunScriptCommand(Session session) {
super(session);
}
......
......@@ -53,7 +53,7 @@ import org.h2.value.Value;
import org.h2.value.ValueLob;
import org.h2.value.ValueString;
public class Script extends ScriptBase {
public class ScriptCommand extends ScriptBase {
private boolean passwords;
private boolean data;
......@@ -67,7 +67,7 @@ public class Script extends ScriptBase {
private int lobBlockSize = Integer.MAX_VALUE;
private static final String TEMP_LOB_FILENAME = "system_temp_lob.db";
public Script(Session session) {
public ScriptCommand(Session session) {
super(session);
}
......
......@@ -12,7 +12,6 @@ import org.h2.engine.Session;
import org.h2.expression.Expression;
import org.h2.message.Message;
import org.h2.result.Row;
import org.h2.store.UndoLogRecord;
import org.h2.table.Column;
import org.h2.table.PlanItem;
import org.h2.table.Table;
......@@ -72,7 +71,6 @@ public class Update extends Prepared {
setCurrentRowNumber(oldRows.size()+1);
if (condition == null || Boolean.TRUE.equals(condition.getBooleanValue(session))) {
Row oldRow = tableFilter.get();
oldRows.add(oldRow);
Row newRow = table.getTemplateRow();
for (int i = 0; i < columnCount; i++) {
Expression newExpr = expressions[i];
......@@ -86,6 +84,7 @@ public class Update extends Prepared {
newRow.setValue(i, newValue);
}
table.validateConvertUpdateSequence(session, newRow);
oldRows.add(oldRow);
newRows.add(newRow);
}
}
......@@ -101,20 +100,7 @@ public class Update extends Prepared {
table.fireBeforeRow(session, o, n);
}
}
// remove the old rows
for (int i = 0; i < oldRows.size(); i++) {
checkCancelled();
Row o = (Row) oldRows.get(i);
table.removeRow(session, o);
session.log(new UndoLogRecord(table, UndoLogRecord.DELETE, o));
}
// add the new rows
for (int i=0; i < newRows.size(); i++) {
checkCancelled();
Row n = (Row) newRows.get(i);
table.addRow(session, n);
session.log(new UndoLogRecord(table, UndoLogRecord.INSERT, n));
}
table.updateRows(this, session, oldRows, newRows);
if(table.fireRow()) {
for (int i=0; i < newRows.size(); i++) {
checkCancelled();
......@@ -126,7 +112,7 @@ public class Update extends Prepared {
table.fireAfter(session);
return newRows.size();
}
public String getPlan() {
StringBuffer buff = new StringBuffer();
buff.append("UPDATE ");
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论