Skip to content

Commit

Permalink
Add Connnection::disableSavePoints().
Browse files Browse the repository at this point in the history
  • Loading branch information
ADmad committed Nov 1, 2018
1 parent 5fe3e0c commit f50a5ac
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 1 deletion.
13 changes: 13 additions & 0 deletions src/Database/Connection.php
Expand Up @@ -598,6 +598,19 @@ public function enableSavePoints($enable)
return $this;
}

/**
* Disables the usage of savepoints.
*
* @param bool $enable Whether or not save points should be used.
* @return $this
*/
public function disableSavePoints()
{
$this->_useSavePoints = false;

return $this;
}

/**
* Returns whether this connection is using savepoints for nested transactions
*
Expand Down
1 change: 1 addition & 0 deletions src/Datasource/ConnectionInterface.php
Expand Up @@ -27,6 +27,7 @@
* @method \Cake\Database\StatementInterface execute($query, $params = [], array $types = [])
* @method $this enableQueryLogging($value)
* @method $this disableQueryLogging()
* @method $this disableSavePoints()
* @method bool isQueryLoggingEnabled()
* @method string quote($value, $type = null)
*/
Expand Down
2 changes: 1 addition & 1 deletion tests/TestCase/Database/ConnectionTest.php
Expand Up @@ -62,7 +62,7 @@ public function setUp()
public function tearDown()
{
Log::reset();
$this->connection->enableSavePoints(false);
$this->connection->disableSavePoints();
$this->connection->setLogger(null);
unset($this->connection);
parent::tearDown();
Expand Down

0 comments on commit f50a5ac

Please sign in to comment.