/** * Snapshot isolation is not compatible with DDL operations. * * @return TransactionSettings */ public static function GetDDLCompatibleDefaults() { return new TransactionSettings(TRUE, DatabaseTransactionScopeOption::Required(), DatabaseTransactionIsolationLevel::ReadCommitted()); }
/** * Internal function: commit all the transaction layers that can commit. */ protected function popCommittableTransactions() { // Commit all the committable layers. foreach (array_reverse($this->transactionLayers) as $name => $state) { // Stop once we found an active transaction. if ($state['active']) { break; } // If there are no more layers left then we should commit. unset($this->transactionLayers[$name]); if (empty($this->transactionLayers)) { try { // PDO::commit() can either return FALSE or throw an exception itself if (!$this->connection->commit()) { throw new DatabaseTransactionCommitFailedException(); } } finally { // Restore original transaction isolation level if ($level = static::DefaultTransactionIsolationLevelInStatement()) { if($state['settings']->Get_IsolationLevel() != DatabaseTransactionIsolationLevel::Ignore()) { if ($level != $state['settings']->Get_IsolationLevel()->__toString()) { $this->query_direct("SET TRANSACTION ISOLATION LEVEL {$level}"); } } } } } else { // Savepoints cannot be commited, only rolled back. } } }