diff --git a/core/lib/Drupal/Core/Database/Connection.php b/core/lib/Drupal/Core/Database/Connection.php
index 2aa6315..c0beb31 100644
--- a/core/lib/Drupal/Core/Database/Connection.php
+++ b/core/lib/Drupal/Core/Database/Connection.php
@@ -146,6 +146,15 @@
   protected $unprefixedTablesMap = [];
 
   /**
+   * The ambient isolation level, either set by the user in settings.php
+   * or read from the database default's when starting a connection
+   *
+   * @var string
+   */
+  protected $ambientIsolationLevel;
+
+
+  /**
    * Constructs a Connection object.
    *
    * @param \PDO $connection
@@ -1048,9 +1057,12 @@ public function transactionDepth() {
    *
    * @see \Drupal\Core\Database\Transaction
    */
-  public function startTransaction($name = '') {
+  public function startTransaction($name = '', TransactionSettings $settings = NULL) {
     $class = $this->getDriverClass('Transaction');
-    return new $class($this, $name);
+    if (empty($settings)) {
+      $settings = TransactionSettings::GetDefaults();
+    }
+    return new $class($this, $name, $settings);
   }
 
   /**
@@ -1085,14 +1097,18 @@ public function rollback($savepoint_name = 'drupal_transaction') {
     // we need to throw an exception.
     $rolled_back_other_active_savepoints = FALSE;
     while ($savepoint = array_pop($this->transactionLayers)) {
-      if ($savepoint == $savepoint_name) {
+      if ($savepoint['name'] == $savepoint_name) {
         // If it is the last the transaction in the stack, then it is not a
         // savepoint, it is the transaction itself so we will need to roll back
         // the transaction rather than a savepoint.
         if (empty($this->transactionLayers)) {
           break;
         }
-        $this->query('ROLLBACK TO SAVEPOINT ' . $savepoint);
+        // When using REQUIRES this transaction might have never been started
+        // because it already had an ambient transaction.
+        if ($savepoint['started'] == TRUE) {
+          $this->query('ROLLBACK TO SAVEPOINT ' . $savepoint);
+        }
         $this->popCommittableTransactions();
         if ($rolled_back_other_active_savepoints) {
           throw new TransactionOutOfOrderException();
@@ -1104,6 +1120,7 @@ public function rollback($savepoint_name = 'drupal_transaction') {
       }
     }
     $this->connection->rollBack();
+    $this->RestoreAmbientIsolationLevel($savepoint['settings']);
     if ($rolled_back_other_active_savepoints) {
       throw new TransactionOutOfOrderException();
     }
@@ -1116,27 +1133,56 @@ public function rollback($savepoint_name = 'drupal_transaction') {
    *
    * @param string $name
    *   The name of the transaction.
+   * @param TransactionSettings $settings
+   *   The transaction settings.
    *
    * @throws \Drupal\Core\Database\TransactionNameNonUniqueException
    *
    * @see \Drupal\Core\Database\Transaction
    */
-  public function pushTransaction($name) {
+  public function pushTransaction($name, TransactionSettings $settings) {
     if (!$this->supportsTransactions()) {
       return;
     }
     if (isset($this->transactionLayers[$name])) {
       throw new TransactionNameNonUniqueException($name . " is already in use.");
     }
-    // If we're already in a transaction then we want to create a savepoint
-    // rather than try to create another transaction.
+    // Depending on the scopeoption this transaction might be started or not.
+    $started = FALSE;
     if ($this->inTransaction()) {
-      $this->query('SAVEPOINT ' . $name);
+      switch ($settings->GetScopeOption()) {
+        case TransactionSettings::TRANSACTION_SCOPEOPTION_REQUIRESNEW:
+          // If we're already in a transaction then we want to create a savepoint
+          // rather than try to create another transaction.
+          $this->query('SAVEPOINT ' . $name);
+          $started = TRUE;
+          break;
+        case TransactionSettings::TRANSACTION_SCOPEOPTION_REQUIRED:
+          // We are already in a transaction, do nothing.
+          break;
+        case TransactionSettings::TRANSACTION_SCOPEOPTION_SUPRESS:
+          // Implementing this will require spinning up a new connection...
+          throw new \Exception("Not implemented");
+          break;
+      }
     }
     else {
+      // Make sure that we have a valid ambient/default isolation level populated that we
+      // can later restore.
+      $this->getAmbientTransactionIsolationLevel();
+      if ($settings->GetIsolationLevel() != TransactionSettings::TRANSACTION_ISOLATION_IGNORE) {
+        // TODO: Instead of reading this from the context, it *might* be better
+        // to have some defaults in settings.php that are forcefully set when openning
+        // the connection. Or maybe getAmbientTransactionIsolationLevel should take care
+        // of that when opening the connection and store the value once.
+        if ($this->getAmbientTransactionIsolationLevel() != $settings->GetIsolationLevel()) {
+          $this->setTransactionIsolationLevel($settings->GetIsolationLevel());
+        }
+      }
       $this->connection->beginTransaction();
     }
-    $this->transactionLayers[$name] = $name;
+    // Store name and settings in the stack.
+    $this->transactionLayers[$name] = array('settings' => $settings, 'active' => TRUE, 'name' => $name, 'started' => $started);
   }
 
   /**
@@ -1167,7 +1213,7 @@ public function popTransaction($name) {
     }
 
     // Mark this layer as committable.
-    $this->transactionLayers[$name] = FALSE;
+    $this->transactionLayers[$name]['active'] = FALSE;
     $this->popCommittableTransactions();
   }
 
@@ -1176,17 +1222,24 @@ public function popTransaction($name) {
    */
   protected function popCommittableTransactions() {
     // Commit all the committable layers.
-    foreach (array_reverse($this->transactionLayers) as $name => $active) {
+    foreach (array_reverse($this->transactionLayers) as $name => $state) {
       // Stop once we found an active transaction.
-      if ($active) {
+      if ($state['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();
+        try {
+          // PDO::commit() can either return FALSE or throw an exception itself
+          if (!$this->connection->commit()) {
+            throw new TransactionCommitFailedException();
+          }
+        }
+        finally {
+          /** @var TransactionSettings $settings */
+          $settings = $state['settings'];
+          $this->RestoreAmbientIsolationLevel($settings);
         }
       }
       else {
@@ -1196,6 +1249,62 @@ protected function popCommittableTransactions() {
   }
 
   /**
+   * Restore the ambient transaction isolation level.
+   *
+   * @param TransactionSettings $settings
+   */
+  protected function RestoreAmbientIsolationLevel(TransactionSettings $settings) {
+    // Restore the ambient transaction isolation level for this connection
+    // if it is different than the one from the transaction.
+    if ($this->getAmbientTransactionIsolationLevel() != TransactionSettings::TRANSACTION_ISOLATION_IGNORE
+      && $this->getAmbientTransactionIsolationLevel() != $settings->GetIsolationLevel()) {
+      $this->setTransactionIsolationLevel($this->getAmbientTransactionIsolationLevel());
+    }
+  }
+
+  /**
+   * Get the current active isolation level.
+   *
+   * Database drivers that support transaction isolation levels should extend
+   * this class to return the current transaction isolation level.
+   *
+   * @return string
+   *   Isolation level constant.
+   */
+  public function getTransactionIsolationLevel() {
+    return TransactionSettings::TRANSACTION_ISOLATION_IGNORE;
+  }
+
+  /**
+   * Get the ambient/default transaction isolation level for current session.
+   *
+   * Database drivers that support transaction isolation levels should extend
+   * this class to return the ambient/default isolation level.
+   *
+   * @return string
+   *   Isolation level constant.
+   */
+  public function getAmbientTransactionIsolationLevel() {
+    if (!isset($this->ambientIsolationLevel)) {
+      $this->ambientIsolationLevel = $this->getTransactionIsolationLevel();
+    }
+    return $this->ambientIsolationLevel;
+  }
+
+  /**
+   * Set the current isolation level for the session.
+   *
+   * @param string $level
+   * @throws \Exception
+   */
+  protected function setTransactionIsolationLevel($level) {
+    if ($level == TransactionSettings::TRANSACTION_ISOLATION_IGNORE) {
+      return;
+    }
+    throw new \Exception("Not implemented.");
+  }
+
+  /**
    * Runs a limited-range query on this database object.
    *
    * Use this as a substitute for ->query() when a subset of the query is to be
diff --git a/core/lib/Drupal/Core/Database/Driver/mysql/Connection.php b/core/lib/Drupal/Core/Database/Driver/mysql/Connection.php
index dd8c299..5af8214 100644
--- a/core/lib/Drupal/Core/Database/Driver/mysql/Connection.php
+++ b/core/lib/Drupal/Core/Database/Driver/mysql/Connection.php
@@ -14,6 +14,7 @@
 use Drupal\Core\Database\TransactionCommitFailedException;
 use Drupal\Core\Database\DatabaseException;
 use Drupal\Core\Database\Connection as DatabaseConnection;
+use Drupal\Core\Database\TransactionSettings;
 use Drupal\Component\Utility\Unicode;
 
 /**
@@ -84,7 +85,8 @@ public function __construct(\PDO $connection, array $connection_options = array(
   public function query($query, array $args = array(), $options = array()) {
     try {
       return parent::query($query, $args, $options);
-    } catch (DatabaseException $e) {
+    }
+    catch (DatabaseException $e) {
       if ($e->getPrevious()->errorInfo[1] == 1153) {
         // If a max_allowed_packet error occurs the message length is truncated.
         // This should prevent the error from recurring if the exception is
@@ -291,17 +293,24 @@ public function nextIdDelete() {
    */
   protected function popCommittableTransactions() {
     // Commit all the committable layers.
-    foreach (array_reverse($this->transactionLayers) as $name => $active) {
+    foreach (array_reverse($this->transactionLayers) as $name => $state) {
       // Stop once we found an active transaction.
-      if ($active) {
+      if ($state['active']) {
         break;
       }
-
       // If there are no more layers left then we should commit.
       unset($this->transactionLayers[$name]);
+      /** @var TransactionSettings $settings */
+      $settings = $state['settings'];
       if (empty($this->transactionLayers)) {
-        if (!$this->connection->commit()) {
-          throw new TransactionCommitFailedException();
+        try {
+          // PDO::commit() can either return FALSE or throw an exception itself
+          if (!$this->connection->commit()) {
+            throw new TransactionCommitFailedException();
+          }
+        }
+        finally {
+          $this->RestoreAmbientIsolationLevel($settings);
         }
       }
       else {
@@ -324,6 +333,8 @@ protected function popCommittableTransactions() {
             // We also have to explain to PDO that the transaction stack has
             // been cleaned-up.
             $this->connection->commit();
+            // Restore the ambient transaction isolation level.
+            $this->RestoreAmbientIsolationLevel($settings);
           }
           else {
             throw $e;
@@ -333,6 +344,60 @@ protected function popCommittableTransactions() {
     }
   }
 
+  /**
+   * {@inheritdoc}
+   */
+  public function getTransactionIsolationLevel() {
+    $ret = TransactionSettings::TRANSACTION_ISOLATION_NONE;
+    $level_string = $this->connection->query("SELECT @@tx_isolation")->fetchField();
+
+    switch ($level_string) {
+      case 'SERIALIZABLE':
+        $ret = TransactionSettings::TRANSACTION_ISOLATION_SERIALIZABLE;
+        break;
+      case 'REPEATABLE-READ':
+        $ret = TransactionSettings::TRANSACTION_ISOLATION_REPEATABLEREAD;
+        break;
+      case 'READ-COMMITTED':
+        $ret = TransactionSettings::TRANSACTION_ISOLATION_READCOMMITTED;
+        break;
+      case 'READ-UNCOMMITTED':
+        $ret = TransactionSettings::TRANSACTION_ISOLATION_READUNCOMMITTED;
+        break;
+      default:
+        // We cannot restore an isolation level that we cannot recognize.
+        throw new \Exception("Isolation level not supported.");
+    }
+
+    return $ret;
+  }
+
+  /**
+   * {@inheritdoc}
+   */
+  protected function setTransactionIsolationLevel($level) {
+    $level_string = '';
+
+    switch ($level) {
+      case TransactionSettings::TRANSACTION_ISOLATION_SERIALIZABLE:
+        $level_string = 'SERIALIZABLE';
+        break;
+      case TransactionSettings::TRANSACTION_ISOLATION_REPEATABLEREAD:
+        $level_string = 'REPEATABLE READ';
+        break;
+      case TransactionSettings::TRANSACTION_ISOLATION_READCOMMITTED:
+        $level_string = 'READ COMMITTED';
+        break;
+      case TransactionSettings::TRANSACTION_ISOLATION_READUNCOMMITTED:
+        $level_string = 'READ UNCOMMITTED';
+        break;
+      default:
+        throw new \InvalidArgumentException('Invalid transaction isolation level provided.');
+        break;
+    }
+
+    $this->connection->query('SET TRANSACTION ISOLATION LEVEL ' . $level_string);
+  }
 }
 
 
diff --git a/core/lib/Drupal/Core/Database/Driver/pgsql/Connection.php b/core/lib/Drupal/Core/Database/Driver/pgsql/Connection.php
index 81aeabc..c5c005b 100644
--- a/core/lib/Drupal/Core/Database/Driver/pgsql/Connection.php
+++ b/core/lib/Drupal/Core/Database/Driver/pgsql/Connection.php
@@ -10,6 +10,7 @@
 use Drupal\Core\Database\Database;
 use Drupal\Core\Database\Connection as DatabaseConnection;
 use Drupal\Core\Database\DatabaseNotFoundException;
+use Drupal\Core\Database\TransactionSettings;
 
 /**
  * @addtogroup database
@@ -272,12 +273,12 @@ public function createDatabase($database) {
 
   public function mapConditionOperator($operator) {
     static $specials = array(
-      // In PostgreSQL, 'LIKE' is case-sensitive. For case-insensitive LIKE
-      // statements, we need to use ILIKE instead.
-      'LIKE' => array('operator' => 'ILIKE'),
-      'LIKE BINARY' => array('operator' => 'LIKE'),
-      'NOT LIKE' => array('operator' => 'NOT ILIKE'),
-      'REGEXP' => array('operator' => '~*'),
+    // In PostgreSQL, 'LIKE' is case-sensitive. For case-insensitive LIKE
+    // statements, we need to use ILIKE instead.
+    'LIKE' => array('operator' => 'ILIKE'),
+    'LIKE BINARY' => array('operator' => 'LIKE'),
+    'NOT LIKE' => array('operator' => 'NOT ILIKE'),
+    'REGEXP' => array('operator' => '~*'),
     );
     return isset($specials[$operator]) ? $specials[$operator] : NULL;
   }
@@ -352,7 +353,7 @@ public function getFullQualifiedTableName($table) {
    */
   public function addSavepoint($savepoint_name = 'mimic_implicit_commit') {
     if ($this->inTransaction()) {
-      $this->pushTransaction($savepoint_name);
+      $this->pushTransaction($savepoint_name, TransactionSettings::GetDefaults());
     }
   }
 
@@ -399,6 +400,60 @@ public function upsert($table, array $options = array()) {
     return new $class($this, $table, $options);
   }
 
+  /**
+   * {@inheritdoc}
+   */
+  public function getTransactionIsolationLevel() {
+    $ret = TransactionSettings::TRANSACTION_ISOLATION_NONE;
+    $level_string = $this->connection->query("SELECT current_setting('transaction_isolation')")->fetchField();
+
+    switch ($level_string) {
+      case 'SERIALIZABLE':
+        $ret = TransactionSettings::TRANSACTION_ISOLATION_SERIALIZABLE;
+        break;
+      case 'REPEATABLE-READ':
+        $ret = TransactionSettings::TRANSACTION_ISOLATION_REPEATABLEREAD;
+        break;
+      case 'READ-COMMITTED':
+        $ret = TransactionSettings::TRANSACTION_ISOLATION_READCOMMITTED;
+        break;
+      case 'READ-UNCOMMITTED':
+        $ret = TransactionSettings::TRANSACTION_ISOLATION_READUNCOMMITTED;
+        break;
+      default:
+        // We cannot restore an isolation level that we cannot recognize.
+        throw new \Exception("Isolation level not supported.");
+    }
+
+    return $ret;
+  }
+
+  /**
+   * {@inheritdoc}
+   */
+  protected function setTransactionIsolationLevel($level) {
+    $level_string = '';
+    switch ($level) {
+      case TransactionSettings::TRANSACTION_ISOLATION_SERIALIZABLE:
+        $level_string = 'SERIALIZABLE';
+        break;
+      case TransactionSettings::TRANSACTION_ISOLATION_REPEATABLEREAD:
+        $level_string = 'REPEATABLE READ';
+        break;
+      case TransactionSettings::TRANSACTION_ISOLATION_READCOMMITTED:
+        $level_string = 'READ COMMITTED';
+        break;
+      case TransactionSettings::TRANSACTION_ISOLATION_READUNCOMMITTED:
+        $level_string = 'READ UNCOMMITTED';
+        break;
+      default:
+        throw new \InvalidArgumentException('Invalid transaction isolation level provided.');
+        break;
+    }
+
+    $this->connection->query('SET TRANSACTION ISOLATION LEVEL ' . $level_string);
+  }
+
 }
 
 /**
diff --git a/core/lib/Drupal/Core/Database/Driver/sqlite/Connection.php b/core/lib/Drupal/Core/Database/Driver/sqlite/Connection.php
index b94ae9f..df05b1b 100644
--- a/core/lib/Drupal/Core/Database/Driver/sqlite/Connection.php
+++ b/core/lib/Drupal/Core/Database/Driver/sqlite/Connection.php
@@ -415,4 +415,11 @@ public function getFullQualifiedTableName($table) {
     return $prefix . $table;
   }
 
+  /**
+   * {@inheritdoc}
+   */
+  public function getTransactionIsolationLevel() {
+    throw new \Exception("Not implemented");
+  }
+
 }
diff --git a/core/lib/Drupal/Core/Database/Transaction.php b/core/lib/Drupal/Core/Database/Transaction.php
index eb4e182..03c5f1a 100644
--- a/core/lib/Drupal/Core/Database/Transaction.php
+++ b/core/lib/Drupal/Core/Database/Transaction.php
@@ -43,6 +43,13 @@ class Transaction {
   protected $rolledBack = FALSE;
 
   /**
+   * Transaction settings.
+   *
+   * @var TransactionSettings
+   */
+  protected $settings;
+
+  /**
    * The name of the transaction.
    *
    * This is used to label the transaction savepoint. It will be overridden to
@@ -50,8 +57,9 @@ class Transaction {
    */
   protected $name;
 
-  public function __construct(Connection $connection, $name = NULL) {
+  public function __construct(Connection $connection, $name = NULL, TransactionSettings $settings) {
     $this->connection = $connection;
+    $this->settings = $settings;
     // If there is no transaction depth, then no transaction has started. Name
     // the transaction 'drupal_transaction'.
     if (!$depth = $connection->transactionDepth()) {
@@ -65,13 +73,23 @@ public function __construct(Connection $connection, $name = NULL) {
     else {
       $this->name = $name;
     }
-    $this->connection->pushTransaction($this->name);
+    $this->connection->pushTransaction($this->name, $settings);
   }
 
   public function __destruct() {
-    // If we rolled back then the transaction would have already been popped.
-    if (!$this->rolledBack) {
-      $this->connection->popTransaction($this->name);
+    if (!$this->settings->GetImplicitRollbacks()) {
+      // If we rolled back then the transaction would have already been popped.
+      if (!$this->rolledBack) {
+        $this->connection->popTransaction($this->name);
+      }
+    }
+    else {
+      // If we did not commit and did not rollback explicitly, rollback.
+      // Rollbacks are not usually called explicitly by the user
+      // but that could happen.
+      if (!$this->commited && !$this->rolledBack) {
+        $this->rollback();
+      }
     }
   }
 
@@ -83,6 +101,27 @@ public function name() {
   }
 
   /**
+   * Commits the transaction. Only available for transactions with
+   * implicit rollbacks to respect Drupal's old implicit commit behaviour.
+   *
+   * @throws TransactionExplicitCommitNotAllowedException
+   */
+  public function commit() {
+    // Insane transaction behaviour does not allow explicit commits.
+    if (!$this->settings->GetImplicitRollbacks()) {
+      throw new TransactionExplicitCommitNotAllowedException();
+    }
+    // Cannot commit a rolledback transaction...
+    if ($this->rolledBack) {
+      throw new TransactionCannotCommitAfterRollbackException();
+    }
+    // Mark as commited, and commit!
+    $this->commited = TRUE;
+    // Finally pop it!
+    $this->connection->popTransaction($this->name);
+  }
+
+  /**
    * Rolls back the current transaction.
    *
    * This is just a wrapper method to rollback whatever transaction stack we are
diff --git a/core/lib/Drupal/Core/Database/TransactionCannotCommitAfterRollbackException.php b/core/lib/Drupal/Core/Database/TransactionCannotCommitAfterRollbackException.php
new file mode 100644
index 0000000..349f84d
--- /dev/null
+++ b/core/lib/Drupal/Core/Database/TransactionCannotCommitAfterRollbackException.php
@@ -0,0 +1,17 @@
+<?php
+
+/**
+ * @file
+ * Contains \Drupal\Core\Database\TransactionCannotCommitAfterRollbackException.
+ */
+
+namespace Drupal\Core\Database;
+
+
+/**
+ * Exception to deny attempts to explicitly manage transactions.
+ *
+ * This exception will be thrown when the PDO connection commit() is called.
+ * Code should never call this method directly.
+ */
+class TransactionCannotCommitAfterRollbackException extends TransactionException implements DatabaseException { }
\ No newline at end of file
diff --git a/core/lib/Drupal/Core/Database/TransactionSettings.php b/core/lib/Drupal/Core/Database/TransactionSettings.php
new file mode 100644
index 0000000..a8f3af0
--- /dev/null
+++ b/core/lib/Drupal/Core/Database/TransactionSettings.php
@@ -0,0 +1,153 @@
+<?php
+
+namespace Drupal\Core\Database;
+
+use Drupal\Core\Database\Database;
+
+/**
+ * Describes how a transaction should behave.
+ */
+class TransactionSettings {
+
+  #region Transaction Isolation Levels
+
+  /**
+   * Summary of TRANSACTION_ISOLATION_SERIALIZABLE
+   */
+  const TRANSACTION_ISOLATION_SERIALIZABLE = 'TRANSACTION_ISOLATION_SERIALIZABLE';
+
+  /**
+   * Summary of TRANSACTION_ISOLATION_REPEATABLEREAD
+   */
+  const TRANSACTION_ISOLATION_REPEATABLEREAD = 'TRANSACTION_ISOLATION_REPEATABLEREAD';
+
+  /**
+   * Summary of TRANSACTION_ISOLATION_READCOMMITTED
+   */
+  const TRANSACTION_ISOLATION_READCOMMITTED = 'TRANSACTION_ISOLATION_READCOMMITTED';
+
+  /**
+   * Summary of TRANSACTION_ISOLATION_READUNCOMMITTED
+   */
+  const TRANSACTION_ISOLATION_READUNCOMMITTED = 'TRANSACTION_ISOLATION_READUNCOMMITTED';
+
+  /**
+   * A different isolation level than the one specified is being used,
+   * but the level cannot be determined. An exception is thrown if this value is set.
+   */
+  const TRANSACTION_ISOLATION_NONE = 'TRANSACTION_ISOLATION_NONE';
+
+  /**
+   * Ignore transaction isolation levels, for drivers that do not support
+   * them.
+   */
+  const TRANSACTION_ISOLATION_IGNORE = 'TRANSACTION_ISOLATION_IGNORE';
+
+  #endregion
+
+  #region Transaction nesting behaviour
+
+  /**
+   * Summary of TRANSACTION_SCOPEOPTION_REQUIRED
+   */
+  const TRANSACTION_SCOPEOPTION_REQUIRED = 'TRANSACTION_SCOPEOPTION_REQUIRED';
+
+  /**
+   * Summary of TRANSACTION_SCOPEOPTION_SUPRESS
+   */
+  const TRANSACTION_SCOPEOPTION_SUPRESS = 'TRANSACTION_SCOPEOPTION_SUPRESS';
+
+  /**
+   * Summary of TRANSACTION_SCOPEOPTION_REQUIRESNEW
+   */
+  const TRANSACTION_SCOPEOPTION_REQUIRESNEW = 'TRANSACTION_SCOPEOPTION_REQUIRESNEW';
+
+  #endregion
+
+  /**
+   * Requested isolation level.
+   *
+   * @var string
+   */
+  private $isolationLevel;
+
+  /**
+   * Requested scope option.
+   *
+   * @var string
+   */
+  private $scopeOption;
+
+  /**
+   * Implicit rollbacks.
+   *
+   * @var bool
+   */
+  private $implicitRollbacks;
+
+  /**
+   * Get a TransactionSettings instance. Defaults to Drupal's
+   * historical default behaviour.
+   *
+   * @param Bool $sane
+   *   Wether to use implicit commits or implicit rollbacks.
+   *
+   * @param String $ScopeOption
+   *   How nested transactions whould behave.
+   *
+   * @param String $IsolationLevel
+   *   Transaction isolation level.
+   */
+  public function __construct($sane = FALSE, $scopeoption = self::TRANSACTION_SCOPEOPTION_REQUIRED, $isolationlevel = self::TRANSACTION_ISOLATION_READUNCOMMITTED) {
+    $this->implicitRollbacks = $sane;
+    $this->isolationLevel = $isolationlevel;
+    $this->scopeOption = $scopeoption;
+  }
+
+
+
+  /**
+   * Get the isolation level for this transaction.
+   *
+   * @return string
+   */
+  public function GetIsolationLevel() {
+    return $this->isolationLevel;
+  }
+
+  /**
+   * Get the current ScopeOption.
+   *
+   * @return string
+   */
+  public function GetScopeOption() {
+    return $this->scopeOption;
+  }
+
+  /**
+   * Return commit behaviour for this transaction.
+   * 
+   * FALSE: this is Drupal's default, meaning that by default if you do
+   * not rollback a exception, it will be commited.
+   * 
+   * TRUE: you MUST call commit() on a transaction explictly, otherwise
+   * it will be automatically rolled back.
+   *
+   * @return bool
+   */
+  public function GetImplicitRollbacks() {
+    return $this->implicitRollbacks;
+  }
+
+  /**
+   * Returns a default setting system-wide to make it compatible
+   * with Drupal's defaults. Cannot use snapshot isolation because
+   * it is not compatible with DDL operations and Drupal historically
+   * has had no knowledge of transaction isolation.
+   *
+   * @return TransactionSettings
+   */
+  public static function GetDefaults() {
+    return new TransactionSettings();
+  }
+}
