// the preparation than to actually ready statements for re-use. If in
// doubt, reset to FALSE and measure performance.
\PDO::ATTR_EMULATE_PREPARES => TRUE,
// Convert numeric values to strings when fetching.
\PDO::ATTR_STRINGIFY_FETCHES => TRUE,
];
try { $pdo =
new \
PDO($dsn,
$connection_options['username'
],
$connection_options['password'
],
$connection_options['pdo'
]);
} catch (\PDOException
$e) { if (static::
getSQLState($e) ==
static::CONNECTION_FAILURE
) { if (str_contains($e->
getMessage(), 'password authentication failed for user'
)) { throw new DatabaseAccessDeniedException($e->
getMessage(),
$e->
getCode(),
$e);
} elseif (str_contains($e->
getMessage(), 'database'
) &&
str_contains($e->
getMessage(), 'does not exist'
)) { throw new DatabaseNotFoundException($e->
getMessage(),
$e->
getCode(),
$e);
} } throw $e;
} return $pdo;
}