Merge branch '2'

This commit is contained in:
Daniel Hensby 2018-07-13 17:43:45 +01:00
commit 4157408adb
No known key found for this signature in database
GPG Key ID: B00D1E9767F0B06E
2 changed files with 23 additions and 7 deletions

View File

@ -1,6 +1,7 @@
# PostgreSQL Module Module
[![Build Status](https://travis-ci.org/silverstripe/silverstripe-postgresql.png?branch=master)](https://travis-ci.org/silverstripe/silverstripe-postgresql)
[![SilverStripe supported module](https://img.shields.io/badge/silverstripe-supported-0071C4.svg)](https://www.silverstripe.org/software/addons/silverstripe-commercially-supported-module-list/)
## Maintainer Contact

View File

@ -547,16 +547,31 @@ class PostgreSQLDatabase extends Database
public function transactionRollback($savepoint = false)
{
// Named savepoint
if ($savepoint) {
$this->query('ROLLBACK TO ' . $savepoint);
} else {
--$this->transactionNesting;
if ($this->transactionNesting > 0) {
$this->transactionRollback('NESTEDTRANSACTION' . $this->transactionNesting);
} else {
$this->query('ROLLBACK');
}
return true;
}
// Abort if unable to unnest, otherwise jump up a level
if (!$this->transactionNesting) {
return false;
}
--$this->transactionNesting;
// Rollback nested
if ($this->transactionNesting > 0) {
return $this->transactionRollback('NESTEDTRANSACTION' . $this->transactionNesting);
}
// Rollback top level
$this->query('ROLLBACK');
return true;
}
public function transactionDepth()
{
return $this->transactionNesting;
}
public function transactionEnd($chain = false)