Creates a new savepoint.

@param string $savepoint The name of the savepoint to create.

@return void

@throws ConnectionException
511288
public function createSavepoint($savepoint)
    {
        if (! $this->getDatabasePlatform()->supportsSavepoints()) {
            throw ConnectionException::savepointsNotSupported();
        }

        $this->getWrappedConnection()->exec($this->platform->createSavePoint($savepoint));
    }
654588
def create_savepoint(self, savepoint):
        
        if not self._platform.is_savepoints_supported():
            raise DBALConnectionError.savepoints_not_supported()
        self.ensure_connected()
        self._platform.create_savepoint(savepoint)
978207
public function rollbackSavepoint($savepoint)
    {
        if (! $this->getDatabasePlatform()->supportsSavepoints()) {
            throw ConnectionException::savepointsNotSupported();
        }

        $this->getWrappedConnection()->exec($this->platform->rollbackSavePoint($savepoint));
    }
375719
def rollback_savepoint(self, savepoint):
        
        if not self._platform.is_savepoints_supported():
            raise DBALConnectionError.savepoints_not_supported()
        self.ensure_connected()
        self._platform.rollback_savepoint(savepoint)
1248565
public function commit()
    {
        --$this->currentTransactionLevel;
        if ($this->currentTransactionLevel == 0 || !$this->nestable()) {
            parent::commit();
        } else {
            $this->exec("RELEASE SAVEPOINT LEVEL{$this->currentTransactionLevel}");
        }
    }
838257
public function commit() {
		if ($this->_transactionDepth === 0) {
			throw new PDOException('Rollback error : There is no transaction started');
		}

		$this->_transactionDepth--;

		if ($this->_transactionDepth === 0) {
			parent::commit();
		} else {
			$this->exec("RELEASE SAVEPOINT LEVEL{$this->_transactionDepth}");
		}
	}
57641
@Override
    public synchronized void savepoint(String name) {

        int index = sessionContext.savepoints.getIndex(name);

        if (index != -1) {
            sessionContext.savepoints.remove(name);
            sessionContext.savepointTimestamps.remove(index);
        }

        sessionContext.savepoints.add(name,
                                      ValuePool.getInt(rowActionList.size()));
        sessionContext.savepointTimestamps.addLast(actionTimestamp);

        try {
            database.logger.writeToLog(this, getSavepointSQL(name));
        } catch (HsqlException e) {}
    }
46577
@Override
	public void rollback(Savepoint savepoint) throws SQLException {
		conn.rollback(savepoint);

		rollbacks.increase();
	}
1192689
protected function ensureConnectionIsEstablished($connection)
    {
        if (!$this->isConnectionEstablished($connection)) {
            $message = $this->createConnectionErrorMessage($connection);

            throw new ConnectionException($message);
        }
    }
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;
    }
1282523
public function transactionStart($asSavepoint = false)
	{
		$this->connect();

		if (!$asSavepoint || !$this->transactionDepth)
		{
			if ($this->setQuery('BEGIN TRANSACTION')->execute())
			{
				$this->transactionDepth = 1;
			}

			return;
		}

		$savepoint = 'SP_' . $this->transactionDepth;
		$this->setQuery('BEGIN TRANSACTION ' . $this->quoteName($savepoint));

		if ($this->execute())
		{
			$this->transactionDepth++;
		}
	}
306297
public function transactionRollback($toSavepoint = false)
	{
		$this->connect();

		if (!$toSavepoint || $this->transactionDepth <= 1)
		{
			if ($this->setQuery('ROLLBACK')->execute())
			{
				$this->transactionDepth = 0;
			}

			return;
		}

		$savepoint = 'SP_' . ($this->transactionDepth - 1);
		$this->setQuery('ROLLBACK TO SAVEPOINT ' . $this->quoteName($savepoint));

		if ($this->execute())
		{
			$this->transactionDepth--;
			$this->setQuery('RELEASE SAVEPOINT ' . $this->quoteName($savepoint))->execute();
		}
	}
889276
@Override
	public void setSavepoint(final String savepointName) {
		Optional<LocalTransactionContext> txContext = currentTxContext();
		if (txContext.isPresent()) {
			txContext.get().setSavepoint(savepointName);
		} else {
			this.unmanagedTransaction.ifPresent(ut -> ut.setSavepoint(savepointName));
		}
	}
1035825
public function save() {
		if($this->persistent) {
			$action = $this->{'update'};
			$action->directCall($this->attrsForApi($action));
			
		} else {
			// insert
			$action = $this->{'create'};
			$ret = new Response($action, $action->directCall($this->attrsForApi($action)));
			
			if($ret->isOk()) {
				$this->attrs = array_merge($this->attrs, (array) $ret->getResponse());
				
			} else {
				throw new Exception\ActionFailed($ret, "Action '".$action->name()."' failed: ".$ret->message());
			}
			
			$this->persistent = true;
		}
	}
241598
public function commit($savepoint = null){
		$this->connection->getDriver()->commit($savepoint);
		$this->notifyObservers(ObserverInterface::COMMIT);
		return $this;
	}
489022
public function transactionCommit($toSavepoint = false)
	{
		$this->connect();

		if (!$toSavepoint || $this->transactionDepth <= 1)
		{
			if ($this->setQuery('COMMIT')->execute())
			{
				$this->transactionDepth = 0;
			}

			return;
		}

		$this->transactionDepth--;
	}
326798
public function rollback($savepoint = null){
		if(!$this->resource->rollBack()){
			$error = $this->resource->errorInfo();
			throw new DriverException("SQLSTATE[$error[0]]: $error[2]", $error[1]);
		}
	}