提交 b730eb70 authored 作者: noelgrandin's avatar noelgrandin

rename the identity and scopeIdentity methods and fields to use the same naming convention

上级 b52ac445
...@@ -391,7 +391,7 @@ public class FunctionAlias extends SchemaObjectBase { ...@@ -391,7 +391,7 @@ public class FunctionAlias extends SchemaObjectBase {
} }
} }
boolean old = session.getAutoCommit(); boolean old = session.getAutoCommit();
Value identity = session.getScopeIdentity(); Value identity = session.getLastScopeIdentity();
boolean defaultConnection = session.getDatabase().getSettings().defaultConnection; boolean defaultConnection = session.getDatabase().getSettings().defaultConnection;
try { try {
session.setAutoCommit(false); session.setAutoCommit(false);
...@@ -422,7 +422,7 @@ public class FunctionAlias extends SchemaObjectBase { ...@@ -422,7 +422,7 @@ public class FunctionAlias extends SchemaObjectBase {
Value ret = DataType.convertToValue(session, returnValue, dataType); Value ret = DataType.convertToValue(session, returnValue, dataType);
return ret.convertTo(dataType); return ret.convertTo(dataType);
} finally { } finally {
session.setScopeIdentity(identity); session.setLastScopeIdentity(identity);
session.setAutoCommit(old); session.setAutoCommit(old);
if (defaultConnection) { if (defaultConnection) {
Driver.setDefaultConnection(null); Driver.setDefaultConnection(null);
......
...@@ -67,7 +67,7 @@ public class Session extends SessionWithState { ...@@ -67,7 +67,7 @@ public class Session extends SessionWithState {
private Random random; private Random random;
private int lockTimeout; private int lockTimeout;
private Value lastIdentity = ValueLong.get(0); private Value lastIdentity = ValueLong.get(0);
private Value scopeIdentity = ValueLong.get(0); private Value lastScopeIdentity = ValueLong.get(0);
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, Integer> savepoints; private HashMap<String, Integer> savepoints;
...@@ -707,7 +707,7 @@ public class Session extends SessionWithState { ...@@ -707,7 +707,7 @@ public class Session extends SessionWithState {
} }
public void setLastIdentity(Value last) { public void setLastIdentity(Value last) {
this.scopeIdentity = last; this.lastScopeIdentity = last;
this.lastIdentity = last; this.lastIdentity = last;
} }
...@@ -715,12 +715,12 @@ public class Session extends SessionWithState { ...@@ -715,12 +715,12 @@ public class Session extends SessionWithState {
return lastIdentity; return lastIdentity;
} }
public void setScopeIdentity(Value scopeIdentity) { public void setLastScopeIdentity(Value last) {
this.scopeIdentity = scopeIdentity; this.lastScopeIdentity = last;
} }
public Value getScopeIdentity() { public Value getLastScopeIdentity() {
return scopeIdentity; return lastScopeIdentity;
} }
/** /**
......
...@@ -722,7 +722,7 @@ public class Function extends Expression implements FunctionCall { ...@@ -722,7 +722,7 @@ public class Function extends Expression implements FunctionCall {
result = session.getLastIdentity(); result = session.getLastIdentity();
break; break;
case SCOPE_IDENTITY: case SCOPE_IDENTITY:
result = session.getScopeIdentity(); result = session.getLastScopeIdentity();
break; break;
case AUTOCOMMIT: case AUTOCOMMIT:
result = ValueBoolean.get(session.getAutoCommit()); result = ValueBoolean.get(session.getAutoCommit());
......
...@@ -115,14 +115,14 @@ public class TriggerObject extends SchemaObjectBase { ...@@ -115,14 +115,14 @@ public class TriggerObject extends SchemaObjectBase {
if (type != Trigger.SELECT) { if (type != Trigger.SELECT) {
old = session.setCommitOrRollbackDisabled(true); old = session.setCommitOrRollbackDisabled(true);
} }
Value identity = session.getScopeIdentity(); Value identity = session.getLastScopeIdentity();
try { try {
triggerCallback.fire(c2, null, null); triggerCallback.fire(c2, null, null);
} catch (Throwable e) { } catch (Throwable e) {
throw DbException.get(ErrorCode.ERROR_EXECUTING_TRIGGER_3, e, getName(), throw DbException.get(ErrorCode.ERROR_EXECUTING_TRIGGER_3, e, getName(),
triggerClassName, e.toString()); triggerClassName, e.toString());
} finally { } finally {
session.setScopeIdentity(identity); session.setLastScopeIdentity(identity);
if (type != Trigger.SELECT) { if (type != Trigger.SELECT) {
session.setCommitOrRollbackDisabled(old); session.setCommitOrRollbackDisabled(old);
} }
...@@ -196,7 +196,7 @@ public class TriggerObject extends SchemaObjectBase { ...@@ -196,7 +196,7 @@ public class TriggerObject extends SchemaObjectBase {
Connection c2 = session.createConnection(false); Connection c2 = session.createConnection(false);
boolean old = session.getAutoCommit(); boolean old = session.getAutoCommit();
boolean oldDisabled = session.setCommitOrRollbackDisabled(true); boolean oldDisabled = session.setCommitOrRollbackDisabled(true);
Value identity = session.getScopeIdentity(); Value identity = session.getLastScopeIdentity();
try { try {
session.setAutoCommit(false); session.setAutoCommit(false);
triggerCallback.fire(c2, oldList, newList); triggerCallback.fire(c2, oldList, newList);
...@@ -216,7 +216,7 @@ public class TriggerObject extends SchemaObjectBase { ...@@ -216,7 +216,7 @@ public class TriggerObject extends SchemaObjectBase {
throw DbException.convert(e); throw DbException.convert(e);
} }
} finally { } finally {
session.setScopeIdentity(identity); session.setLastScopeIdentity(identity);
session.setCommitOrRollbackDisabled(oldDisabled); session.setCommitOrRollbackDisabled(oldDisabled);
session.setAutoCommit(old); session.setAutoCommit(old);
} }
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论