function Connection::__construct
Same name in this branch
- 9 core/modules/sqlite/src/Driver/Database/sqlite/Connection.php \Drupal\sqlite\Driver\Database\sqlite\Connection::__construct()
- 9 core/modules/pgsql/src/Driver/Database/pgsql/Connection.php \Drupal\pgsql\Driver\Database\pgsql\Connection::__construct()
- 9 core/lib/Drupal/Core/Database/Connection.php \Drupal\Core\Database\Connection::__construct()
Same name in other branches
- 8.9.x core/modules/system/tests/modules/driver_test/src/Driver/Database/DrivertestMysqlDeprecatedVersion/Connection.php \Drupal\driver_test\Driver\Database\DrivertestMysqlDeprecatedVersion\Connection::__construct()
- 8.9.x core/lib/Drupal/Core/Database/Driver/sqlite/Connection.php \Drupal\Core\Database\Driver\sqlite\Connection::__construct()
- 8.9.x core/lib/Drupal/Core/Database/Driver/mysql/Connection.php \Drupal\Core\Database\Driver\mysql\Connection::__construct()
- 8.9.x core/lib/Drupal/Core/Database/Driver/pgsql/Connection.php \Drupal\Core\Database\Driver\pgsql\Connection::__construct()
- 8.9.x core/lib/Drupal/Core/Database/Connection.php \Drupal\Core\Database\Connection::__construct()
- 10 core/modules/sqlite/src/Driver/Database/sqlite/Connection.php \Drupal\sqlite\Driver\Database\sqlite\Connection::__construct()
- 10 core/modules/mysql/src/Driver/Database/mysql/Connection.php \Drupal\mysql\Driver\Database\mysql\Connection::__construct()
- 10 core/modules/pgsql/src/Driver/Database/pgsql/Connection.php \Drupal\pgsql\Driver\Database\pgsql\Connection::__construct()
- 10 core/lib/Drupal/Core/Database/Connection.php \Drupal\Core\Database\Connection::__construct()
- 11.x core/modules/sqlite/src/Driver/Database/sqlite/Connection.php \Drupal\sqlite\Driver\Database\sqlite\Connection::__construct()
- 11.x core/modules/mysql/src/Driver/Database/mysql/Connection.php \Drupal\mysql\Driver\Database\mysql\Connection::__construct()
- 11.x core/modules/pgsql/src/Driver/Database/pgsql/Connection.php \Drupal\pgsql\Driver\Database\pgsql\Connection::__construct()
- 11.x core/lib/Drupal/Core/Database/Connection.php \Drupal\Core\Database\Connection::__construct()
Overrides Connection::__construct
File
-
core/
modules/ mysql/ src/ Driver/ Database/ mysql/ Connection.php, line 94
Class
- Connection
- MySQL implementation of \Drupal\Core\Database\Connection.
Namespace
Drupal\mysql\Driver\Database\mysqlCode
public function __construct(\PDO $connection, array $connection_options) {
// If the SQL mode doesn't include 'ANSI_QUOTES' (explicitly or via a
// combination mode), then MySQL doesn't interpret a double quote as an
// identifier quote, in which case use the non-ANSI-standard backtick.
//
// Because we still support MySQL 5.7, check for the deprecated combination
// modes as well.
//
// @see https://dev.mysql.com/doc/refman/5.7/en/sql-mode.html#sqlmode_ansi_quotes
$ansi_quotes_modes = [
'ANSI_QUOTES',
'ANSI',
'DB2',
'MAXDB',
'MSSQL',
'ORACLE',
'POSTGRESQL',
];
$is_ansi_quotes_mode = FALSE;
foreach ($ansi_quotes_modes as $mode) {
// None of the modes in $ansi_quotes_modes are substrings of other modes
// that are not in $ansi_quotes_modes, so a simple stripos() does not
// return false positives.
if (stripos($connection_options['init_commands']['sql_mode'], $mode) !== FALSE) {
$is_ansi_quotes_mode = TRUE;
break;
}
}
if ($this->identifierQuotes === [
'"',
'"',
] && !$is_ansi_quotes_mode) {
$this->identifierQuotes = [
'`',
'`',
];
}
parent::__construct($connection, $connection_options);
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.