Context.php in Drupal driver for SQL Server and SQL Azure 8
File
drivers/lib/Drupal/Driver/Database/sqlsrv/Context.php
View source
<?php
namespace Drupal\Driver\Database\sqlsrv;
use Drupal\Core\Database\Database;
use Drupal\Driver\Database\sqlsrv\DriverSettings;
class Context {
var $connection;
var $settings = NULL;
public function __construct(Connection $connection = NULL, $bypass_queries = NULL, $direct_query = NULL, $statement_caching = NULL) {
$this->connection = $connection ? $connection : Database::getConnection();
$this->settings = $this->connection->driver_settings;
$configuration = $this->settings
->exportConfiguration();
if ($bypass_queries !== NULL) {
$configuration['default_bypass_query_preprocess'] = $bypass_queries;
}
if ($direct_query !== NULL) {
$configuration['default_direct_queries'] = $direct_query;
}
if ($statement_caching !== NULL) {
$configuration['statement_caching_mode'] = $statement_caching;
}
$settings = DriverSettings::instanceFromData($configuration);
$this->connection->driver_settings = $settings;
}
public function __destruct() {
$this->connection->driver_settings = $this->settings;
}
}
Classes
Name |
Description |
Context |
Defines a behaviour scope for the database
driver that lasts until the object is destroyed. |