fwd-h2-6995.patch
new/src/main/org/h2/command/Parser.java 2023-01-26 12:19:22 +0000 | ||
---|---|---|
8420 | 8420 |
if (readIf("TRANSACTIONAL")) { |
8421 | 8421 |
command.setTransactional(true); |
8422 | 8422 |
} |
8423 |
if (readIf("NOUNDO")) { |
|
8424 |
command.setNoUndo(true); |
|
8425 |
} |
|
8423 | 8426 |
} else if (!persistIndexes && readIf(NOT)) { |
8424 | 8427 |
read("PERSISTENT"); |
8425 | 8428 |
command.setPersistData(false); |
new/src/main/org/h2/command/ddl/CreateTable.java 2023-01-26 12:19:23 +0000 | ||
---|---|---|
37 | 37 |
private String comment; |
38 | 38 |
private boolean sortedInsertMode; |
39 | 39 |
private boolean withNoData; |
40 |
private boolean isNoUndo = false; |
|
40 | 41 | |
41 | 42 |
public CreateTable(Session session, Schema schema) { |
42 | 43 |
super(session, schema); |
... | ... | |
55 | 56 |
public void setTableName(String tableName) { |
56 | 57 |
data.tableName = tableName; |
57 | 58 |
} |
59 |
|
|
60 |
public void setNoUndo(boolean isNoUndo) { |
|
61 |
data.isNoUndo = isNoUndo; |
|
62 |
} |
|
58 | 63 | |
59 | 64 |
@Override |
60 | 65 |
public void addColumn(Column column) { |
new/src/main/org/h2/command/ddl/CreateTableData.java 2023-01-26 12:19:23 +0000 | ||
---|---|---|
80 | 80 |
* The table is hidden. |
81 | 81 |
*/ |
82 | 82 |
public boolean isHidden; |
83 |
|
|
84 |
/** |
|
85 |
* The table is set to be "no-undo". |
|
86 |
*/ |
|
87 |
public boolean isNoUndo; |
|
83 | 88 |
} |
new/src/main/org/h2/command/dml/Update.java 2023-01-26 12:19:23 +0000 | ||
---|---|---|
16 | 16 |
import org.h2.api.Trigger; |
17 | 17 |
import org.h2.command.CommandInterface; |
18 | 18 |
import org.h2.command.Prepared; |
19 |
import org.h2.engine.DbObject; |
|
20 |
import org.h2.engine.Right; |
|
21 |
import org.h2.engine.Session; |
|
19 |
import org.h2.engine.*; |
|
22 | 20 |
import org.h2.expression.Expression; |
23 | 21 |
import org.h2.expression.ExpressionVisitor; |
24 | 22 |
import org.h2.expression.Parameter; |
... | ... | |
341 | 339 |
// copy the old row to new, as no index is affected |
342 | 340 |
Row o = inMemRows.next(); |
343 | 341 |
Row n = inMemRows.next(); |
342 |
Row oldRowCopy = null; |
|
343 |
oldRowCopy = table.getTemplateRow(); |
|
344 |
oldRowCopy.copy(o); |
|
345 |
oldRowCopy.setKey(o.getKey()); |
|
346 |
|
|
347 |
session.log(table, UndoLogRecord.DELETE, oldRowCopy); |
|
348 |
session.log(table, UndoLogRecord.INSERT, n); |
|
344 | 349 |
o.copy(n); |
350 |
|
|
351 |
table.updateMaxDataModificationId(); |
|
345 | 352 |
} |
346 | 353 |
} |
347 | 354 |
new/src/main/org/h2/engine/Session.java 2023-01-26 12:19:23 +0000 | ||
---|---|---|
1004 | 1004 |
if (table.isMVStore()) { |
1005 | 1005 |
return; |
1006 | 1006 |
} |
1007 |
if (table.isNoUndo()) { |
|
1008 |
return; |
|
1009 |
} |
|
1007 | 1010 |
if (undoLogEnabled) { |
1008 | 1011 |
UndoLogRecord log = new UndoLogRecord(table, operation, row); |
1009 | 1012 |
// called _after_ the row was inserted successfully into the table, |
new/src/main/org/h2/pagestore/db/PageStoreTable.java 2023-01-26 12:19:23 +0000 | ||
---|---|---|
538 | 538 |
public long getMaxDataModificationId() { |
539 | 539 |
return lastModificationId; |
540 | 540 |
} |
541 |
|
|
542 |
@Override |
|
543 |
public void updateMaxDataModificationId() { |
|
544 |
lastModificationId = database.getNextModificationDataId(); |
|
545 |
} |
|
541 | 546 | |
542 | 547 |
@Override |
543 | 548 |
public long getRowCountApproximation() { |
new/src/main/org/h2/table/RegularTable.java 2023-01-26 12:19:23 +0000 | ||
---|---|---|
125 | 125 |
protected RegularTable(CreateTableData data) { |
126 | 126 |
super(data); |
127 | 127 |
this.isHidden = data.isHidden; |
128 |
setNoUndo(data.isNoUndo); |
|
128 | 129 |
boolean b = false; |
129 | 130 |
for (Column col : getColumns()) { |
130 | 131 |
if (DataType.isLargeObject(col.getType().getValueType())) { |
new/src/main/org/h2/table/Table.java 2023-01-26 12:19:23 +0000 | ||
---|---|---|
79 | 79 |
* using the SCRIPT command. |
80 | 80 |
*/ |
81 | 81 |
protected boolean isHidden; |
82 |
|
|
83 |
/** |
|
84 |
* Is the table set with the no-undo flag? |
|
85 |
*/ |
|
86 |
private boolean isNoUndo; |
|
82 | 87 | |
83 | 88 |
private final HashMap<String, Column> columnMap; |
84 | 89 |
private final boolean persistIndexes; |
... | ... | |
351 | 356 |
* @return the modification id |
352 | 357 |
*/ |
353 | 358 |
public abstract long getMaxDataModificationId(); |
359 |
|
|
360 |
/** |
|
361 |
* Update the last data modification id. This method needs to be overrided if the intention is |
|
362 |
* to update the id. |
|
363 |
*/ |
|
364 |
public void updateMaxDataModificationId() |
|
365 |
{ |
|
366 |
|
|
367 |
} |
|
354 | 368 | |
355 | 369 |
/** |
356 | 370 |
* Check if the table is deterministic. |
... | ... | |
1426 | 1440 |
{ |
1427 | 1441 |
return true; |
1428 | 1442 |
} |
1443 |
|
|
1444 |
public boolean isNoUndo() { |
|
1445 |
return isNoUndo; |
|
1446 |
} |
|
1447 | ||
1448 |
public void setNoUndo(boolean isNoUndo) { |
|
1449 |
this.isNoUndo = isNoUndo; |
|
1450 |
} |
|
1429 | 1451 |
} |