示例#1
0
 private void setAutoCommitSend(boolean autoCommit) {
   if (clientVersion >= Constants.TCP_PROTOCOL_VERSION_8) {
     for (int i = 0, count = 0; i < transferList.size(); i++) {
       Transfer transfer = transferList.get(i);
       try {
         traceOperation("SESSION_SET_AUTOCOMMIT", autoCommit ? 1 : 0);
         transfer.writeInt(SessionRemote.SESSION_SET_AUTOCOMMIT).writeBoolean(autoCommit);
         done(transfer);
       } catch (IOException e) {
         removeServer(e, i--, ++count);
       }
     }
   } else {
     if (autoCommit) {
       if (autoCommitTrue == null) {
         autoCommitTrue = prepareCommand("SET AUTOCOMMIT TRUE", Integer.MAX_VALUE);
       }
       autoCommitTrue.executeUpdate();
     } else {
       if (autoCommitFalse == null) {
         autoCommitFalse = prepareCommand("SET AUTOCOMMIT FALSE", Integer.MAX_VALUE);
       }
       autoCommitFalse.executeUpdate();
     }
   }
 }
示例#2
0
 private void checkClusterDisableAutoCommit(String serverList) {
   if (autoCommit && transferList.size() > 1) {
     setAutoCommitSend(false);
     CommandInterface c = prepareCommand("SET CLUSTER " + serverList, Integer.MAX_VALUE);
     // this will set autoCommit to false
     c.executeUpdate();
     // so we need to switch it on
     autoCommit = true;
     cluster = true;
   }
 }
示例#3
0
 private void switchOffCluster() {
   CommandInterface ci = prepareCommand("SET CLUSTER ''", Integer.MAX_VALUE);
   ci.executeUpdate();
 }