You are here

public static function Connection::createConnectionOptionsFromUrl in Drupal driver for SQL Server and SQL Azure 8.2

Same name and namespace in other branches
  1. 3.0.x drivers/lib/Drupal/Driver/Database/sqlsrv/Connection.php \Drupal\Driver\Database\sqlsrv\Connection::createConnectionOptionsFromUrl()

Adding schema to the connection URL.

Overrides Connection::createConnectionOptionsFromUrl

File

drivers/lib/Drupal/Driver/Database/sqlsrv/Connection.php, line 681
Definition of Drupal\Driver\Database\sqlsrv\Connection

Class

Connection
Temporary tables: temporary table support is done by means of global temporary tables (#) to avoid the use of DIRECT QUERIES. You can enable and disable the use of direct queries with $this->driver_settings->defaultDirectQuery =…

Namespace

Drupal\Driver\Database\sqlsrv

Code

public static function createConnectionOptionsFromUrl($url, $root) {
  $database = parent::createConnectionOptionsFromUrl($url, $root);
  $url_components = parse_url($url);
  if (isset($url_components['query'])) {
    $query = [];
    parse_str($url_components['query'], $query);
    if (isset($query['schema'])) {
      $database['schema'] = $query['schema'];
    }
    $database['cache_schema'] = isset($query['cache_schema']) && $query['cache_schema'] == 'true' ? TRUE : FALSE;
  }
  return $database;
}