提交 5366bc3c authored 作者: dyorgio's avatar dyorgio

Added support to define last IDENTIFIER on a Trigger.

上级 91b2048d
...@@ -78,6 +78,7 @@ public class Session extends SessionWithState { ...@@ -78,6 +78,7 @@ public class Session extends SessionWithState {
private int lockTimeout; private int lockTimeout;
private Value lastIdentity = ValueLong.get(0); private Value lastIdentity = ValueLong.get(0);
private Value lastScopeIdentity = ValueLong.get(0); private Value lastScopeIdentity = ValueLong.get(0);
private Value lastTriggerIdentity = null;
private int firstUncommittedLog = Session.LOG_WRITTEN; private int firstUncommittedLog = Session.LOG_WRITTEN;
private int firstUncommittedPos = Session.LOG_WRITTEN; private int firstUncommittedPos = Session.LOG_WRITTEN;
private HashMap<String, Savepoint> savepoints; private HashMap<String, Savepoint> savepoints;
...@@ -1000,6 +1001,14 @@ public class Session extends SessionWithState { ...@@ -1000,6 +1001,14 @@ public class Session extends SessionWithState {
return lastScopeIdentity; return lastScopeIdentity;
} }
public void setLastTriggerIdentity(Value last) {
this.lastTriggerIdentity = last;
}
public Value getLastTriggerIdentity() {
return lastTriggerIdentity;
}
/** /**
* Called when a log entry for this session is added. The session keeps * Called when a log entry for this session is added. The session keeps
* track of the first entry in the transaction log that is not yet * track of the first entry in the transaction log that is not yet
......
...@@ -262,7 +262,12 @@ public class TriggerObject extends SchemaObjectBase { ...@@ -262,7 +262,12 @@ public class TriggerObject extends SchemaObjectBase {
throw DbException.convert(e); throw DbException.convert(e);
} }
} finally { } finally {
if (session.getLastTriggerIdentity() != null) {
session.setLastScopeIdentity(session.getLastTriggerIdentity());
session.setLastTriggerIdentity(null);
} else {
session.setLastScopeIdentity(identity); session.setLastScopeIdentity(identity);
}
session.setCommitOrRollbackDisabled(oldDisabled); session.setCommitOrRollbackDisabled(oldDisabled);
session.setAutoCommit(old); session.setAutoCommit(old);
} }
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论