Commit Transaction
@param $xid
@throws DbException
@internal param TransactionID $string from beginTransaction
512117
public function commit($xid)
    {
        if ($this->activeTransaction != $xid || $this->activeTransaction === false) {
            return;
        }

        $this->activeTransaction = false;

        if (!$this->connection->commit()) {
            throw new DbException("Commit failed");
        }

        $this->connection->autocommit(true);
    }
774478
public function begin()
    {
        $context = $this->_context;

        $this->logger->info('transaction begin', 'db.transaction.begin');

        if ($context->transaction_level === 0) {
            $this->eventsManager->fireEvent('db:beginTransaction', $this);

            try {
                $connection = $this->poolManager->pop($this, $this->_timeout);

                if (!$connection->beginTransaction()) {
                    throw new DbException('beginTransaction failed.');
                }
                $context->connection = $connection;
            } catch (\PDOException $exception) {
                throw new DbException('beginTransaction failed: ' . $exception->getMessage(), $exception->getCode(), $exception);
            } finally {
                if (!$context->connection) {
                    $this->poolManager->push($this, $context);
                }
            }
        }

        $context->transaction_level++;
    }
1206135
@Override
	public void onTxCommit(Transaction tx) {
		if (!tx.isReadOnly() && enableLogging) {
			LogSeqNum lsn = new CommitRecord(txNum).writeToLog();
			VanillaDb.logMgr().flush(lsn);
		}
	}
699801
protected function commit_transaction() {
        $this->query_start('native sqlsrv_commit', NULL, SQL_QUERY_AUX);
        $result = sqlsrv_commit($this->sqlsrv);
        $this->query_end($result);
    }
46362
@Override
    public final synchronized void commit(ContainerTx tx)
                    throws RemoteException
    {
        final boolean isTraceOn = TraceComponent.isAnyTracingEnabled();
        if (isTraceOn && tc.isEntryEnabled())
            Tr.entry(tc, "commit: " + getStateName(state), tx);

        if (removed) {
            if (isTraceOn && tc.isEntryEnabled())
                Tr.exit(tc, "commit: removed");
            return;
        }

        if (tx.ivRemoveBeanO == this)
        {
            completeRemoveMethod(tx); // d647928
        }
        else
        {
            // Perform normal afterCompletion processing.... calling
            // afterCompletion if present.
            setState(COMMITTING_OUTSIDE_METHOD, AFTER_COMPLETION); // d159152

            // Session Synchronization AfterCompletion needs to be called if either
            // the annotation (or XML) was specified or the bean implemented
            // the interface and a global transaction is active.        F743-25855
            if ((ivAfterCompletion != null || sessionSync != null) &&
                tx.isTransactionGlobal())
            {
                EJBThreadData threadData = EJSContainer.getThreadData();

                threadData.pushContexts(this);
                try
                {
                    if (ivAfterCompletion != null) {
                        invokeSessionSynchMethod(ivAfterCompletion, new Object[] { true });
                    } else {
                        sessionSync.afterCompletion(true);
                    }
                } finally
                {
                    threadData.popContexts();
                }
            }

            setState(AFTER_COMPLETION, METHOD_READY); // d159152
        }

        // currentTx is now reset in atCommit/atRollback AFTER the final pin
        // is undone.                                                      d258770
        // currentTx = null;                                            // PQ99986

        if (isTraceOn && tc.isEntryEnabled())
            Tr.exit(tc, "commit: " + getStateName(state));
    }
783165
public function beginTransaction()
    {
        if (self::$transaction) {
            throw new TransactionException("Transaction Already Started");
        }

        self::$transaction = true;
        foreach (self::$connectionList as $dbDriver) {
            $dbDriver->beginTransaction();
        }
    }
852602
public void commit(Xid xid, boolean onePhase) throws XAException {

        // Comment out following debug statement before public release:
        System.err.println("Performing a " + (onePhase ? "1-phase"
                                                       : "2-phase") + " commit on "
                                                       + xid);

        JDBCXAResource resource = xaDataSource.getResource(xid);

        if (resource == null) {
            throw new XAException("The XADataSource has no such Xid:  " + xid);
        }

        resource.commitThis(onePhase);
    }
1235104
public void commit() throws SQLException {
    lock.lock();
    try {
      if (protocol.inTransaction()) {
        try (Statement st = createStatement()) {
          st.execute("COMMIT");
        }
      }
    } finally {
      lock.unlock();
    }
  }
1095711
public function commitTransaction()
    {
        if (!self::$transaction) {
            throw new TransactionException("There is no Active Transaction");
        }

        self::$transaction = false;
        foreach (self::$connectionList as $dbDriver) {
            $dbDriver->commitTransaction();
        }
    }
1156777
public function commitTransaction() {
        // check that a transaction is really active - do not check/renew the connection - renewing a connection breaks the transaction
        if (!$this->getConnection(false)->inTransaction())
            throw new \Exception("Not inside a DB transaction. Cannot commit.");

        try {
            $this->getConnection(false)->commit();
        } catch (Exception $_e) {
            throw new \Exception("Error while committing DB transaction: ".$pe->getMessage());
        }
    }
1325300
void closeTransactionalBranch(Xid xid) {

        if (this.transactionBinding.getTransactionBindingType() != TransactionBindingType.GlobalTransaction) {
            throw new IllegalStateException("XAConnection not associated to a global transaction");
        }

        GlobalTransactionProxy<C> globalTransactionProxy = this.transactionBinding.getEnlistedGlobalTransaction();
        globalTransactionProxy.close();

        delistTransaction();
    }
1042963
public void rollback(Xid xid) throws XAException
    {
        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
            Tr.entry(this, tc, "rollback", new Object[] 
                     {
                      ivManagedConnection,
                      AdapterUtil.toString(xid) 
            });

        if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { 
            String cId = null;
            try {
                cId = ivManagedConnection.mcf.getCorrelator(ivManagedConnection); 
            } catch (SQLException x) {
                // will just log the exception here and ignore it since its in trace
                Tr.debug(this, tc, "got an exception trying to get the correlator in commit, exception is: ", x);
            }
            if (cId != null) {
                StringBuffer stbuf = new StringBuffer(200);
                stbuf.append("Correlator: DB2, ID: ");
                stbuf.append(cId);
                if (xid != null) {
                    stbuf.append("Transaction ID : ");
                    stbuf.append(xid);
                }
                stbuf.append(" ROLLBACK");
                Tr.debug(this, tc, stbuf.toString());
            }
        }

        // Reset so we can deferred enlist in a future global transaction. 
        ivManagedConnection.wasLazilyEnlistedInGlobalTran = false; 

        try {
            // If no work was done during the transaction, the autoCommit value may still
            // be on.  In this case, just no-op, since some drivers like ConnectJDBC 3.1
            // don't allow commit/rollback when autoCommit is on.  

            ivSqlConn.rollback();
            ivStateManager.setState(WSStateManager.XA_ROLLBACK);
        } catch (SQLException sqe) {
            FFDCFilter.processException(sqe, "com.ibm.ws.rsadapter.spi.WSRdbOnePhaseXaResourceImpl.rollback", "342", this);
            Tr.error(tc, "DSA_INTERNAL_ERROR", new Object[] { "Exception caught during rollback on the OnePhaseXAResource", sqe });
            XAException xae = new XAException(XAException.XAER_RMERR);
            traceXAException(xae, currClass);
            if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
                Tr.exit(this, tc, "rollback", "Exception"); 
            throw xae;
        } catch (TransactionException te) {
            //Exception means setState failed because it was invalid to set the state in this case
            FFDCFilter.processException(te, "com.ibm.ws.rsadapter.spi.WSRdbOnePhaseXaResourceImpl.rollback", "351", this);
            Tr.error(tc, "INVALID_TX_STATE", new Object[] { "OnePhaseXAResource.rollback()", ivManagedConnection.getTransactionStateAsString() });
            XAException xae = new XAException(XAException.XAER_RMERR);
            traceXAException(xae, currClass);
            if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
                Tr.exit(this, tc, "rollback", "Exception"); 
            throw xae;
        }

        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
            Tr.exit(this, tc, "rollback"); 
    }
45445
public void commit(DBTransaction transaction) {
        try {
            applyUpdates(transaction);
        } catch (Exception e) {
            m_logger.error("Updates failed", e);
            throw e;
        } finally {
            transaction.clear();
        }
    }
89358
@Override
   public void commit(Xid externalXid, boolean isOnePhase) throws XAException {
      txTable.commit(externalXid, isOnePhase);
   }
785498
public void rollback(final Xid xid) throws XAException {

        final String methodName = "rollback";
        if (TraceComponent.isAnyTracingEnabled() && TRACE.isEntryEnabled()) {
            SibTr.entry(this, TRACE, methodName, xid);
        }

        _siXaResource.rollback(xid);

        // Add the value true to indicate we have rolled back to the hashtable of
        // stats (keying off the xid)
        synchronized (_transactionStates) {

          _transactionStates.put (xid, Boolean.TRUE);

          if (TraceComponent.isAnyTracingEnabled() && TRACE.isDebugEnabled()) {
            StringBuffer sb = new StringBuffer ("After adding the xid ");
            sb.append (xid);
            sb.append (" the hashtable of transactionStates now contains ");
            sb.append (_transactionStates.size());
            sb.append (" entries");
            SibTr.debug (this, TRACE, sb.toString());
          }

        }

        if (TraceComponent.isAnyTracingEnabled() && TRACE.isEntryEnabled()) {
            SibTr.exit(this, TRACE, methodName);
        }

    }
495091
public function transaction(\Closure $callback)
    {
        try {
            // Begin the PDO transaction
            $this->pdo->beginTransaction();

            // Get the Transaction class
            $transaction = $this->container->build('\\Pixie\\QueryBuilder\\Transaction', array($this->connection));

            // Call closure
            $callback($transaction);

            // If no errors have been thrown or the transaction wasn't completed within
            // the closure, commit the changes
            $this->pdo->commit();

            return $this;
        } catch (TransactionHaltException $e) {
            // Commit or rollback behavior has been handled in the closure, so exit
            return $this;
        } catch (\Exception $e) {
            // something happened, rollback changes
            $this->pdo->rollBack();
            return $this;
        }
    }
371417
public function commit()
    {
        if (!$this->started) {
            throw new \RuntimeException('Cannot commit transaction before start');
        }
        if (!$this->pdo->commit()) {
            throw new \RuntimeException('Failed to commit transaction');
        }

        $this->started = false;
    }