protected function DatabaseConnection::popCommittableTransactions

protected DatabaseConnection::popCommittableTransactions()

Internal function: commit all the transaction layers that can commit.

File

includes/database/database.inc, line 1137
Core systems for the database layer.

Class

DatabaseConnection
Base Database API class.

Code

protected function popCommittableTransactions() {
  // Commit all the committable layers.
  foreach (array_reverse($this->transactionLayers) as $name => $active) {
    // Stop once we found an active transaction.
    if ($active) {
      break;
    }

    // If there are no more layers left then we should commit.
    unset($this->transactionLayers[$name]);
    if (empty($this->transactionLayers)) {
      if (!parent::commit()) {
        throw new DatabaseTransactionCommitFailedException();
      }
    }
    else {
      $this->query('RELEASE SAVEPOINT ' . $name);
    }
  }
}

© 2001–2016 by the original authors
Licensed under the GNU General Public License, version 2 and later.
Drupal is a registered trademark of Dries Buytaert.
https://api.drupal.org/api/drupal/includes!database!database.inc/function/DatabaseConnection::popCommittableTransactions/7.x