Example #1
0
  /**
   * Rollback the current local transaction
   *
   * @param startTxn
   * @throws SQLException
   */
  public void rollback(boolean startTxn) throws SQLException {

    // Check to see the connection is open
    checkConnection();
    if (!autoCommitFlag) {
      try {
        if (this.inLocalTxn) {
          this.inLocalTxn = false;
          try {
            ResultsFuture<?> future = this.dqp.rollback();
            future.get();
          } catch (Exception e) {
            throw TeiidSQLException.create(e);
          }
          logger.fine(JDBCPlugin.Util.getString("MMConnection.Rollback_success")); // $NON-NLS-1$
        }
      } finally {
        if (startTxn) {
          this.inLocalTxn = false;
        } else {
          this.autoCommitFlag = true;
        }
      }
    }
  }
Example #2
0
 protected Xid[] recoverTransaction(int arg0) throws SQLException {
   checkConnection();
   try {
     ResultsFuture<Xid[]> future = this.dqp.recover(arg0);
     return future.get();
   } catch (Exception e) {
     throw TeiidSQLException.create(e);
   }
 }
Example #3
0
 protected void forgetTransaction(XidImpl arg0) throws SQLException {
   checkConnection();
   try {
     ResultsFuture<?> future = this.dqp.forget(arg0);
     future.get();
   } catch (Exception e) {
     throw TeiidSQLException.create(e);
   }
 }
Example #4
0
 protected int prepareTransaction(XidImpl arg0) throws SQLException {
   checkConnection();
   transactionXid = null;
   try {
     ResultsFuture<Integer> future = this.dqp.prepare(arg0);
     return future.get();
   } catch (Exception e) {
     throw TeiidSQLException.create(e);
   }
 }
Example #5
0
 protected void endTransaction(XidImpl arg0, int arg1) throws SQLException {
   checkConnection();
   this.autoCommitFlag = true;
   try {
     ResultsFuture<?> future = this.dqp.end(arg0, arg1);
     future.get();
   } catch (Exception e) {
     throw TeiidSQLException.create(e);
   }
 }
Example #6
0
 protected void startTransaction(XidImpl arg0, int arg1, int timeout) throws SQLException {
   checkConnection();
   try {
     ResultsFuture<?> future = this.dqp.start(arg0, arg1, timeout);
     future.get();
   } catch (Exception e) {
     throw TeiidSQLException.create(e);
   }
   transactionXid = arg0;
   this.autoCommitFlag = false;
 }
Example #7
0
 protected void rollbackTransaction(XidImpl arg0) throws SQLException {
   checkConnection();
   transactionXid = null;
   this.autoCommitFlag = true;
   try {
     ResultsFuture<?> future = this.dqp.rollback(arg0);
     future.get();
   } catch (Exception e) {
     throw TeiidSQLException.create(e);
   }
 }
Example #8
0
 private void directCommit() throws SQLException {
   if (inLocalTxn) {
     try {
       ResultsFuture<?> future = this.dqp.commit();
       future.get();
     } catch (Exception e) {
       throw TeiidSQLException.create(e);
     }
     logger.fine(JDBCPlugin.Util.getString("MMConnection.Commit_success")); // $NON-NLS-1$
   }
 }