public function Connection::createDatabase in Drupal driver for SQL Server and SQL Azure 8
Same name and namespace in other branches
- 8.2 drivers/lib/Drupal/Driver/Database/sqlsrv/Connection.php \Drupal\Driver\Database\sqlsrv\Connection::createDatabase()
- 3.0.x drivers/lib/Drupal/Driver/Database/sqlsrv/Connection.php \Drupal\Driver\Database\sqlsrv\Connection::createDatabase()
Overrides \Drupal\Core\Database\Connection::createDatabase().
Parameters
string $database: The name of the database to create.
Throws
\Drupal\Core\Database\DatabaseNotFoundException
Overrides Connection::createDatabase
File
- drivers/
lib/ Drupal/ Driver/ Database/ sqlsrv/ Connection.php, line 1011 - 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\sqlsrvCode
public function createDatabase($database) {
// Escape the database name.
$database = Database::getConnection()
->escapeDatabase($database);
try {
// Create the database and set it as active.
$this->connection
->exec("CREATE DATABASE {$database} COLLATE " . Schema::DEFAULT_COLLATION_CI);
} catch (DatabaseException $e) {
throw new DatabaseNotFoundException($e
->getMessage());
}
}