\PDO::ATTR_EMULATE_PREPARES => TRUE,
// Limit SQL to a single statement like mysqli.
\PDO::MYSQL_ATTR_MULTI_STATEMENTS => FALSE,
// Convert numeric values to strings when fetching. In PHP 8.1,
// \PDO::ATTR_EMULATE_PREPARES now behaves the same way as non emulated
// prepares and returns integers. See https://externals.io/message/113294
// for further discussion.
\PDO::ATTR_STRINGIFY_FETCHES => TRUE,
];
try { $pdo =
new \
PDO($dsn,
$connection_options['username'
],
$connection_options['password'
],
$connection_options['pdo'
]);
} catch (\PDOException
$e) { switch ($e->
getCode()) { case static::CONNECTION_REFUSED:
if (isset($connection_options['unix_socket'
])) { // Show message for socket connection via 'unix_socket' option.
$message = 'Drupal is configured to connect to the database server via a socket, but the socket file could not be found.';
$message .= ' This message normally means that there is no MySQL server running on the system or that you are using an incorrect Unix socket file name when trying to connect to the server.';
throw new DatabaseConnectionRefusedException($e->
getMessage() . ' [Tip: ' .
$message . '] ',
$e->
getCode(),
$e);
} if (isset($connection_options['host'
]) &&
in_array(strtolower($connection_options['host'
]),
['', 'localhost'
], TRUE
)) {