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

--no commit message

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