Begins a transaction if supported.
@param string $savepoint
@return Manager fluent interface
760693
public function begin($savepoint = null){
		$this->connection->getDriver()->beginTransaction($savepoint);
		$this->notifyObservers(ObserverInterface::BEGIN);
		return $this;
	}
1248565
public function commit()
    {
        --$this->currentTransactionLevel;
        if ($this->currentTransactionLevel == 0 || !$this->nestable()) {
            parent::commit();
        } else {
            $this->exec("RELEASE SAVEPOINT LEVEL{$this->currentTransactionLevel}");
        }
    }
1011608
public function hit(Endpoint $endpoint, $count = 1)
    {
        $region = $endpoint->getRegion();
        
        $rateLimit = isset($this->limits[get_class($endpoint)]) ? $this->limits[get_class($endpoint)] : $endpoint->getLimit();
        
        $time = array_keys($rateLimit)[0];
        $limit = $rateLimit[$time];
        
        // Get the respective time limit for this region
        $item = $this->get($endpoint, $time);

        // No results found, create new count for the limit
        if (! $item->isHit()) {
            $item->set($count)->expiresAfter($time);
            $this->store->save($item);
            
            return true;
        }

        // Otherwise there is a count saved for region+method,
        // check if the request count can be performed.
        $currentCount = $item->get();
        if ($count + $currentCount > $limit) {
            throw new RateLimitReachedException(
                "Sending {$count} request".($count === 1) ? '' : 's'." is not allowed! ".
                "Rate limit for '{$endpoint->getName()}' ({$region->getName()}) reached. ".
                "Current count: {$currentCount}. Limit: {$limit}/{$time}s."
            );
        }

        // If it can, increase the current limit
        $item->set($currentCount + $count);
        $this->store->save($item);
        
        return true;
    }
1063395
public function beginTransaction()
	{
		++$this->transactions;

		if ( $this->transactions == 1 )
		{
			try
			{
				$this->getPdo()->beginTransaction();
			}
			catch ( Exception $e )
			{
				--$this->transactions;

				throw $e;
			}
		}
		elseif ( $this->transactions > 1 && $this->queryGrammar->supportsSavepoints() )
		{
			$this->getPdo()->exec( $this->queryGrammar->compileSavepoint( 'trans' . $this->transactions ) );
		}

		$this->fireConnectionEvent( 'beganTransaction' );
	}
111748
public function transactionRollback($toSavepoint = false)
	{
		if (!$toSavepoint || $this->transactionDepth <= 1)
		{
			$this->connect();

			if ($this->connection->rollback())
			{
				$this->transactionDepth = 0;
			}

			return;
		}

		$savepoint = 'SP_' . ($this->transactionDepth - 1);

		if ($this->executeUnpreparedQuery('ROLLBACK TO SAVEPOINT ' . $this->quoteName($savepoint)))
		{
			$this->transactionDepth--;
		}
	}
158955
public function beginTransaction ()
    {
        if(!$this->nestable() || $this->tansaction_level == 0) {
            parent::beginTransaction();
        } else {
            $this->exec("SAVEPOINT LEVEL{$this->transaction_level}");
        }

        $this->transaction_level++;
    }
1061481
public function transactionSavepoint($savepointName)
	{
		$this->connect();
		$this->setQuery('SAVEPOINT ' . $this->quoteName($this->escape($savepointName)));
		$this->execute();
	}
1286598
public function startTransaction(string $name, array $context = [], float $start = null): Transaction
    {
        // Create and Store Transaction
        $this->transactionsStore->register(
            $this->eventFactory->createTransaction($name, array_replace_recursive($this->sharedContext, $context), $start)
        );

        // Start the Transaction
        $transaction = $this->transactionsStore->fetch($name);

        if (null === $start) {
            $transaction->start();
        }

        return $transaction;
    }
1283199
function CommitTransaction()
	{
		if ($this->ConnectionSetting->IsReadOnlySlave)
			throw new Exception('Transactions are not allowed on a read-only slave');
		
		$this->RequireConnection(true);
		$this->Observe("DataAdapter ($this->_label) (DataAdapter.CommitTransaction)", OBSERVE_QUERY);
		$this->_transactionInProgress = false;
		return $this->_driver->CommitTransaction($this->_dbconn);
	}
148538
public function beginTransaction()
    {
        if ($this->isTransactionEnabled() === false) {
            throw new ServiceException(sprintf(
                'The repository for %s doesn\'t support Transactions',
                $this->getEntityServiceName()
            ));
        }

        $this->getRepository()->beginTransaction();
    }
1134432
public function restart($point)
	{
		// If native FTP support is enabled let's use it...
		if (FTP_NATIVE)
		{
			if (@ftp_site($this->conn, 'REST ' . $point) === false)
			{
				throw new FilesystemException(__METHOD__ . 'Bad response.');
			}

			return true;
		}

		// Send restart command and verify success
		if (!$this->_putCmd('REST ' . $point, 350))
		{
			throw new FilesystemException(
				sprintf(
					'%1$s: Bad response.  Server response: %2$s [Expected: 350].  Restart point sent: %3$s', __METHOD__, $this->response, $point
				)
			);
		}

		return true;
	}
1348232
protected function createTransaction()
    {
        if ($this->transactions === 0) {
            try {
                $this->getPdo()->beginTransaction();
            } catch (Exception $e) {
                $this->handleBeginTransactionException($e);
            }
        } elseif ($this->transactions >= 1 && $this->queryGrammar->supportsSavepoints()) {
            $this->createSavepoint();
        }
    }
504628
public function consume(EndpointInterface $endpoint)
    {
        $this->initialize($endpoint);

        while (!$this->shouldStop()) {
            try {
                // Receive
                $message = $this->readMessage($endpoint);

                // Process
                if ($message) {
                    $startConsumeTime = microtime(true);

                    --$this->expirationCount;

                    $this->process($endpoint, $message);

                    $this->logConsumeMessage();

                    $this->confirmMessage($endpoint, $message);

                    $endConsumeTime = microtime(true);
                    $this->dispatchConsumerTimingEvent((int) (($endConsumeTime - $startConsumeTime) * 1000), $message);
                }
            } catch (\Exception $ex) {
                if (!$this->stop) {
                    throw $ex;
                }
            }
        }

        $this->cleanUp($endpoint);
    }
683836
public function transactionStart($asSavepoint = false)
	{
		$this->connect();

		if (!$asSavepoint || !$this->transactionDepth)
		{
			if ($this->executeUnpreparedQuery('START TRANSACTION'))
			{
				$this->transactionDepth = 1;
			}

			return;
		}

		$savepoint = 'SP_' . $this->transactionDepth;

		if ($this->executeUnpreparedQuery('SAVEPOINT ' . $this->quoteName($savepoint)))
		{
			$this->transactionDepth++;
		}
	}
981950
public function transactionStart($asSavepoint = false)
	{
		$this->connect();

		if (!$asSavepoint || !$this->transactionDepth)
		{
			$this->connection->beginTransaction();
		}

		$this->transactionDepth++;
	}
79669
function rollback() {
		$this->savepoint--;

		if ($this->savepoint == 0) {
			$this->dbh->rollBack();
		}
		else { // not finished with transaction
			$this->dbh->exec('ROLLBACK TO SAVEPOINT save'.$this->savepoint);
		}

		return $this;
	}
327061
final public function beginTransaction(int $isolation = Transaction::ISOLATION_COMMITTED): Promise
    {
        if (! $this->handle) {
            throw new FailureException('Not connected');
        }

        return call(function () use ($isolation) {
            switch ($isolation) {
                case Transaction::ISOLATION_UNCOMMITTED:
                    yield $this->handle->query("BEGIN TRANSACTION ISOLATION LEVEL READ UNCOMMITTED");
                    break;

                case Transaction::ISOLATION_COMMITTED:
                    yield $this->handle->query("BEGIN TRANSACTION ISOLATION LEVEL READ COMMITTED");
                    break;

                case Transaction::ISOLATION_REPEATABLE:
                    yield $this->handle->query("BEGIN TRANSACTION ISOLATION LEVEL REPEATABLE READ");
                    break;

                case Transaction::ISOLATION_SERIALIZABLE:
                    yield $this->handle->query("BEGIN TRANSACTION ISOLATION LEVEL SERIALIZABLE");
                    break;

                default:
                    throw new \Error("Invalid transaction type");
            }

            $this->busy = new Deferred;

            return new ConnectionTransaction($this->handle, $this->callableFromInstanceMethod("release"), $isolation);
        });
    }