You are here

public function Scheme::getDatabaseInfo in Drupal driver for SQL Server and SQL Azure 8.2

Get general database information.

Parameters

string $database: Name of the database.

Return value

mixed

File

drivers/lib/Drupal/Driver/Database/sqlsrv/Scheme.php, line 796

Class

Scheme

Namespace

Drupal\Driver\Database\sqlsrv

Code

public function getDatabaseInfo($database) {
  static $result;
  if (isset($result)) {
    return $result;
  }
  $sql = <<<EOF
      select name
        , db.snapshot_isolation_state
        , db.snapshot_isolation_state_desc
        , db.is_read_committed_snapshot_on
        , db.recovery_model
        , db.recovery_model_desc
        , db.collation_name
    from sys.databases db
    WHERE DB_NAME(db.database_id) = :database
EOF;

  // Database is defaulted from active connection.
  $result = $this->cnn
    ->query_execute($sql, array(
    ':database' => $database,
  ))
    ->fetchObject();
  return $result;
}