On begin.

@return the transaction
192019
private Transaction onBegin()
    {
        Transaction tx;
        if (((StatelessSessionImpl) s).getTransactionCoordinator().isTransactionActive())
        {
            tx = ((StatelessSessionImpl) s).getTransaction();
        }
        else
        {
            tx = s.beginTransaction();
        }
        return tx;
    }
302001
public function start_transaction()
	{
		$result = true;

		if ($this->_transaction_depth == 0)
		{
			if ($this->driver_start_transaction())
			{
				$this->_in_transaction = true;
			}
			else
			{
				$result = false;
			}
		}
		else
		{
			$result = $this->set_savepoint($this->_transaction_depth);
			// If savepoint is not supported it is not an error
			isset($result) or $result = true;
		}

		$result and $this->_transaction_depth ++;

		return $result;
	}
371097
public function begin() {
        if($this->isInTransaction()) {
            throw new \Exception('You cannot start a new transaction once you are already in one (Originally started at: ' . self::$stackTrace . ')');
        } else {
            $e = new \Exception();
            self::$stackTrace = $e->getTraceAsString();
        }
        $transactionManager = new TransactionManager();
        $transactionManager->setDbService($this->getDbService());
        $this->setTransaction($transactionManager->get());
    }
1349554
public function beginTransaction()
    {
        try {
            $this->connection->beginTransaction();
        } catch (DBALException $e) {
            throw new OrmException("Unable to start transaction.\n" . $e->getMessage(), 0, $e);
        }
    }
1228083
public function beginTransaction() {
        ++$this->transactions;

        if ($this->transactions == 1) {
            $this->transaction = $this->orient->beginTransaction();
        }

        $this->fireConnectionEvent('beganTransaction');
    }
1182467
public function beginTransaction() {
        $this->_fireEvent('phpsweetpdo.begin_transaction.started', array ());
        $result = $this->_pdoObject->beginTransaction();
        $this->_fireEvent('phpsweetpdo.begin_transaction.finished', array ('result' => $result));

        return $result;
    }
54443
public void beginTransaction() throws HibernateException
    {
        Transaction tx = threadTransaction.get();
        if (tx == null)
        {
            tx = getSession().beginTransaction();
            threadTransaction.set(tx);
        }
    }
1263117
protected function beginTransaction()
    {
        $modelClass = $this->modelClass;
        $transaction = $modelClass::getDb()->beginTransaction();

        $this->_transaction[] = $transaction;
    }
969477
public function beginTransaction()
    {
        ++$this->transactions;

        if ($this->transactions == 1) {
            $this->pdo->beginTransaction();
        }

        $this->fireConnectionEvent('beganTransaction');
    }
472205
def begin(self, sql=None):
        """"""
        self._transaction = True
        try:
            begin = self._con.begin
        except AttributeError:
            return self._con.query(sql or 'begin')
        else:
            # use existing method if available
            if sql:
                return begin(sql=sql)
            else:
                return begin()
908015
public function beginTransaction() {
		if ($this->inTransaction) {
			return false;
		}

		$this->inTransaction = $this->pdo->beginTransaction();
		return $this->inTransaction;
	}
1064373
public TransactionWrapper startTransaction() throws DataAccessException {
        TransactionWrapper transaction = new TransactionWrapper();
        TransactionUtil transUtil = TransactionUtil.getInstance();
        TransactionManager transManager = transUtil.getTransactionManager();
        try {
            if (logger.isTraceEnabled()) {
                logger.trace("startTransaction - transaction manager=" + transManager.hashCode() + " (status=" + transManager.getStatus() + ")");
            }
            transaction.setDatabaseAccess(db);
            if (transManager.getStatus()==Status.STATUS_NO_TRANSACTION) {
                transaction.setTransactionAlreadyStarted(false);
                // Get connection BEFORE beginning transaction to avoid transaction timeout (10 minutes) exceptions (Fail to stop the transaction)
                db.openConnection().setAutoCommit(false); // Also set autoCommit to false
                transManager.begin();
                transUtil.setCurrentConnection(db.getConnection());
            } else {
                if (logger.isTraceEnabled())
                    logger.trace("   ... transaction already started, status=" + transManager.getStatus());
                transaction.setTransactionAlreadyStarted(true);
                if (db.connectionIsOpen()) {
                    transaction.setDatabaseConnectionAlreadyOpened(true);
                } else {
                    if (logger.isTraceEnabled())
                        logger.trace("   ... but database is not open");
                    // not opened through this DatabaseAccess
                    transaction.setDatabaseConnectionAlreadyOpened(false);
                    if (transUtil.getCurrentConnection() == null) {
                        db.openConnection().setAutoCommit(false);  // Set autoCommit to false
                        transUtil.setCurrentConnection(db.getConnection());
                    } else {
                        db.setConnection(transUtil.getCurrentConnection());
                    }
                }
            }
            transaction.setTransaction(transManager.getTransaction());
            return transaction;
        } catch (Throwable e) {
            if (transaction.getTransaction()!=null) stopTransaction(transaction);
            throw new DataAccessException(0, "Fail to start transaction", e);
        }
    }
1075680
def begin(self):
        """"""
        if self.in_transaction:  # we're already in a transaction...
            if self._auto_transaction:
                self._auto_transaction = False
                return
            self.commit()
        self.in_transaction = True
        for collection, store in self.stores.items():
            store.begin()
            indexes = self.indexes[collection]
            for index in indexes.values():
                index.begin()
1038949
public function beginTransaction() : bool
    {
        if ($this->dbconn->inTransaction()) {
            throw new TransactionErrorException("A transaction has already been started.");
        }
        try {
            return $this->dbconn->beginTransaction();
        } catch (\PDOException $exception) {
            throw new TransactionsNotSupportedException("Transactions are not supported in this database.");
        }
    }
189581
def transaction_begin(self, **kwargs):
        
        self.__transaction_id += 1
        self.__transactions.add(self.__transaction_id)
        self.log.debug("Starting transaction with ID %d", self.__subscription_id)
        self._transaction_begin(self.__transaction_id, **kwargs)
        return self.__transaction_id
807236
public function startTransaction()
    {
        $this->db_connect('w', true);

        // check connection before proceeding
        if (!$this->is_connected()) {
            return $this->last_result = false;
        }

        $this->debug('BEGIN TRANSACTION');

        return $this->last_result = $this->dbh->beginTransaction();
    }
281938
public function beginTransaction()
    {
        ++$this->transactions;

        if ($this->transactions == 1)
        {
            $this->transaction = $this->neo->beginTransaction();
        }

        $this->fireConnectionEvent('beganTransaction');
    }