protected Connection::popCommittableTransactions()
Overridden to work around issues to MySQL not supporting transactional DDL.
Overrides Connection::popCommittableTransactions
File
- core/lib/Drupal/Core/Database/Driver/mysql/Connection.php, line 288
Class
- Connection
- MySQL implementation of \Drupal\Core\Database\Connection.
Namespace
Drupal\Core\Database\Driver\mysql
Code
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 | 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 (! $this ->connection->commit()) { throw new TransactionCommitFailedException(); } } else { // Attempt to release this savepoint in the standard way. try { $this ->query( 'RELEASE SAVEPOINT ' . $name ); } catch (DatabaseExceptionWrapper $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 ->getPrevious()->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. $this ->connection->commit(); } else { throw $e ; } } } } } |
Please login to continue.