1 database.inc protected DatabaseConnection_mysql::popCommittableTransactions()

Overridden to work around issues to MySQL not supporting transactional DDL.

Overrides DatabaseConnection::popCommittableTransactions


core/includes/database/mysql/database.inc, line 275
Database interface code for MySQL database servers.




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) {

    // If there are no more layers left then we should commit.
    if (empty($this->transactionLayers)) {
      if (!$this->doCommit()) {
        throw new DatabaseTransactionCommitFailedException();
    else {
      // Attempt to release this savepoint in the standard way.
      try {
        $this->query('RELEASE SAVEPOINT ' . $name);
      catch (PDOException $e) {
        // However, in MySQL (InnoDB), savepoints are automatically committed
        // when tables are altered or created (DDL transactions are not
        // supported). This can cause exceptions due to trying to release
        // savepoints which no longer exist.
        // To avoid exceptions when no actual error has occurred, we silently
        // succeed for MySQL error code 1305 ("SAVEPOINT does not exist").
        if ($e->errorInfo[1] == '1305') {
          // If one SAVEPOINT was released automatically, then all were.
          // Therefore, clean the transaction stack.
          $this->transactionLayers = array();
          // We also have to explain to PDO that the transaction stack has
          // been cleaned-up.
        else {
          throw $e;