You are here

class TransactionSettings in Drupal driver for SQL Server and SQL Azure 8

Same name and namespace in other branches
  1. 8.2 drivers/lib/Drupal/Driver/Database/sqlsrv/TransactionSettings.php \Drupal\Driver\Database\sqlsrv\TransactionSettings

Behaviour settings for a transaction.

Hierarchy

Expanded class hierarchy of TransactionSettings

6 files declare their use of TransactionSettings
Connection.php in drivers/lib/Drupal/Driver/Database/sqlsrv/Connection.php
Definition of Drupal\Driver\Database\sqlsrv\Connection
Insert.php in drivers/lib/Drupal/Driver/Database/sqlsrv/Insert.php
Definition of Drupal\Driver\Database\sqlsrv\Insert
Merge.php in drivers/lib/Drupal/Driver/Database/sqlsrv/Merge.php
Definition of Drupal\Driver\Database\sqlsrv\Merge
Schema.php in drivers/lib/Drupal/Driver/Database/sqlsrv/Schema.php
Definition of Drupal\Driver\Database\sqlsrv\Schema
Transaction.php in drivers/lib/Drupal/Driver/Database/sqlsrv/Transaction.php
Definition of Drupal\Driver\Database\sqlsrv\Transaction

... See full list

File

drivers/lib/Drupal/Driver/Database/sqlsrv/TransactionSettings.php, line 13

Namespace

Drupal\Driver\Database\sqlsrv
View source
class TransactionSettings {

  /**
   * Summary of __construct
   * @param mixed $Sane
   * @param DatabaseTransactionScopeOption $ScopeOption
   * @param DatabaseTransactionIsolationLevel $IsolationLevel
   */
  public function __construct($Sane = FALSE, DatabaseTransactionScopeOption $ScopeOption = NULL, DatabaseTransactionIsolationLevel $IsolationLevel = NULL) {
    $this->_Sane = $Sane;
    if ($ScopeOption == NULL) {
      $ScopeOption = DatabaseTransactionScopeOption::RequiresNew();
    }
    if ($IsolationLevel == NULL) {
      $IsolationLevel = DatabaseTransactionIsolationLevel::Unspecified();
    }
    $this->_IsolationLevel = $IsolationLevel;
    $this->_ScopeOption = $ScopeOption;
  }

  // @var DatabaseTransactionIsolationLevel
  private $_IsolationLevel;

  // @var DatabaseTransactionScopeOption
  private $_ScopeOption;

  // @var Boolean
  private $_Sane;

  /**
   * Summary of Get_IsolationLevel
   * @return mixed
   */
  public function Get_IsolationLevel() {
    return $this->_IsolationLevel;
  }

  /**
   * Summary of Get_ScopeOption
   * @return mixed
   */
  public function Get_ScopeOption() {
    return $this->_ScopeOption;
  }

  /**
   * Summary of Get_Sane
   * @return mixed
   */
  public function Get_Sane() {
    return $this->_Sane;
  }

  /**
   * Returns a default setting system-wide.
   *
   * @return TransactionSettings
   */
  public static function GetDefaults() {

    // Use snapshot if available.
    $isolation = DatabaseTransactionIsolationLevel::Ignore();

    // Otherwise use Drupal's default behaviour (except for nesting!)
    return new TransactionSettings(FALSE, DatabaseTransactionScopeOption::Required(), $isolation);
  }

  /**
   * Proposed better defaults.
   *
   * @return TransactionSettings
   */
  public static function GetBetterDefaults() {

    // Use snapshot if available.
    $isolation = DatabaseTransactionIsolationLevel::Ignore();

    // Otherwise use Drupal's default behaviour (except for nesting!)
    return new TransactionSettings(TRUE, DatabaseTransactionScopeOption::Required(), $isolation);
  }

  /**
   * Snapshot isolation is not compatible with DDL operations.
   *
   * @return TransactionSettings
   */
  public static function GetDDLCompatibleDefaults() {
    return new TransactionSettings(TRUE, DatabaseTransactionScopeOption::Required(), DatabaseTransactionIsolationLevel::ReadCommitted());
  }

}

Members

Namesort descending Modifiers Type Description Overrides
TransactionSettings::$_IsolationLevel private property
TransactionSettings::$_Sane private property
TransactionSettings::$_ScopeOption private property
TransactionSettings::GetBetterDefaults public static function Proposed better defaults.
TransactionSettings::GetDDLCompatibleDefaults public static function Snapshot isolation is not compatible with DDL operations.
TransactionSettings::GetDefaults public static function Returns a default setting system-wide.
TransactionSettings::Get_IsolationLevel public function Summary of Get_IsolationLevel
TransactionSettings::Get_Sane public function Summary of Get_Sane
TransactionSettings::Get_ScopeOption public function Summary of Get_ScopeOption
TransactionSettings::__construct public function Summary of __construct