Skip to content

Commit

Permalink
rename getAutoCommit to isAutoCommit
Browse files Browse the repository at this point in the history
  • Loading branch information
codefollower committed Jan 15, 2015
1 parent 6f74495 commit 8957194
Show file tree
Hide file tree
Showing 13 changed files with 14 additions and 14 deletions.
Expand Up @@ -184,7 +184,7 @@ public void cancelStatement(int id) {
} }


@Override @Override
public boolean getAutoCommit() { public boolean isAutoCommit() {
return autoCommit; return autoCommit;
} }


Expand Down
Expand Up @@ -413,7 +413,7 @@ public synchronized void setAutoCommit(boolean autoCommit) throws SQLException {
debugCode("setAutoCommit(" + autoCommit + ");"); debugCode("setAutoCommit(" + autoCommit + ");");
} }
checkClosed(); checkClosed();
if (autoCommit && !session.getAutoCommit()) { if (autoCommit && !session.isAutoCommit()) {
commit(); commit();
} }
session.setAutoCommit(autoCommit); session.setAutoCommit(autoCommit);
Expand All @@ -433,7 +433,7 @@ public synchronized boolean getAutoCommit() throws SQLException {
try { try {
checkClosed(); checkClosed();
debugCodeCall("getAutoCommit"); debugCodeCall("getAutoCommit");
return session.getAutoCommit(); return session.isAutoCommit();
} catch (Exception e) { } catch (Exception e) {
throw logAndConvert(e); throw logAndConvert(e);
} }
Expand Down
Expand Up @@ -107,7 +107,7 @@ public interface SessionInterface extends Closeable {
* *
* @return true if the session is in auto-commit mode * @return true if the session is in auto-commit mode
*/ */
boolean getAutoCommit(); boolean isAutoCommit();


/** /**
* Set the auto-commit mode. This call doesn't commit the current * Set the auto-commit mode. This call doesn't commit the current
Expand Down
Expand Up @@ -424,7 +424,7 @@ private void process() throws IOException {
if (operation == FrontendSession.COMMAND_EXECUTE_DISTRIBUTED_UPDATE) if (operation == FrontendSession.COMMAND_EXECUTE_DISTRIBUTED_UPDATE)
transfer.writeString(session.getTransaction().getLocalTransactionNames()); transfer.writeString(session.getTransaction().getLocalTransactionNames());


transfer.writeInt(updateCount).writeBoolean(session.getAutoCommit()); transfer.writeInt(updateCount).writeBoolean(session.isAutoCommit());
transfer.flush(); transfer.flush();
break; break;
} }
Expand Down
2 changes: 1 addition & 1 deletion lealone-sql/src/main/java/org/lealone/command/Command.java
Expand Up @@ -152,7 +152,7 @@ private void stop() {
session.setCurrentCommand(null); session.setCurrentCommand(null);
if (!isTransactional()) { if (!isTransactional()) {
session.commit(true); session.commit(true);
} else if (session.getAutoCommit()) { } else if (session.isAutoCommit()) {
session.commit(false); session.commit(false);
} else if (session.getDatabase().isMultiThreaded()) { } else if (session.getDatabase().isMultiThreaded()) {
Database db = session.getDatabase(); Database db = session.getDatabase();
Expand Down
Expand Up @@ -78,7 +78,7 @@ private void execute(String sql) {
} else { } else {
command.update(); command.update();
} }
if (session.getAutoCommit()) { if (session.isAutoCommit()) {
session.commit(false); session.commit(false);
} }
} catch (DbException e) { } catch (DbException e) {
Expand Down
Expand Up @@ -400,7 +400,7 @@ public Value getValue(Session session, Expression[] args, boolean columnList) {
params[p] = o; params[p] = o;
} }
} }
boolean old = session.getAutoCommit(); boolean old = session.isAutoCommit();
Value identity = session.getLastScopeIdentity(); Value identity = session.getLastScopeIdentity();
boolean defaultConnection = session.getDatabase().getSettings().defaultConnection; boolean defaultConnection = session.getDatabase().getSettings().defaultConnection;
try { try {
Expand Down
Expand Up @@ -192,7 +192,7 @@ public boolean fireRow(Session session, Row oldRow, Row newRow, boolean beforeAc
newListBackup = null; newListBackup = null;
} }
Connection c2 = session.createConnection(false); Connection c2 = session.createConnection(false);
boolean old = session.getAutoCommit(); boolean old = session.isAutoCommit();
boolean oldDisabled = session.setCommitOrRollbackDisabled(true); boolean oldDisabled = session.setCommitOrRollbackDisabled(true);
Value identity = session.getLastScopeIdentity(); Value identity = session.getLastScopeIdentity();
try { try {
Expand Down
2 changes: 1 addition & 1 deletion lealone-sql/src/main/java/org/lealone/engine/Session.java
Expand Up @@ -350,7 +350,7 @@ void removeLocalTempTableConstraint(Constraint constraint) {
} }


@Override @Override
public boolean getAutoCommit() { public boolean isAutoCommit() {
return autoCommit; return autoCommit;
} }


Expand Down
Expand Up @@ -756,7 +756,7 @@ private Value getSimpleValue(Session session, Value v0, Expression[] args, Value
result = session.getLastScopeIdentity(); result = session.getLastScopeIdentity();
break; break;
case AUTOCOMMIT: case AUTOCOMMIT:
result = ValueBoolean.get(session.getAutoCommit()); result = ValueBoolean.get(session.isAutoCommit());
break; break;
case READONLY: case READONLY:
result = ValueBoolean.get(database.isReadOnly()); result = ValueBoolean.get(database.isReadOnly());
Expand Down
Expand Up @@ -50,7 +50,7 @@ public abstract class TransactionBase implements TransactionInterface {


protected TransactionBase(Session session) { protected TransactionBase(Session session) {
this.session = session; this.session = session;
autoCommit = session.getAutoCommit(); autoCommit = session.isAutoCommit();
} }


@Override @Override
Expand Down
Expand Up @@ -83,7 +83,7 @@ private int execute(boolean isBatch, Prepared p) {


try { try {
if (isBatch) { if (isBatch) {
if (session.getAutoCommit()) { if (session.isAutoCommit()) {
session.setAutoCommit(false); session.setAutoCommit(false);
isTopTransaction = true; isTopTransaction = true;
} else { } else {
Expand Down
Expand Up @@ -215,7 +215,7 @@ public synchronized void close() {


private int nextTransactionId(Session session) { private int nextTransactionId(Session session) {
//分布式事务使用奇数的事务ID //分布式事务使用奇数的事务ID
if (!session.getAutoCommit() && Session.isClusterMode()) { if (!session.isAutoCommit() && Session.isClusterMode()) {
return nextOddTransactionId(); return nextOddTransactionId();
} }


Expand Down

0 comments on commit 8957194

Please sign in to comment.