By daffie on
Change record status:
Published (View all published change records)
Project:
Introduced in branch:
8.3.x
Introduced in version:
8.3.0
Issue links:
Description:
For databases other then the ones that are supported by Drupal 8 they need to add support for:
- There is a new protected method \Drupal\Core\Database\Connection::getSQLState(). This method extracts the SQLSTATE error from the PDOException. This method may need to be overriden.
-
The opening of a PDO-connection for the by core supported databases have now exception handeling for a "Database Not Found Exception" and for a "Database Access Denied Exception". The code example for MySQL is:
try { $pdo = new \PDO($dsn, $connection_options['username'], $connection_options['password'], $connection_options['pdo']); } catch (\PDOException $e) { if ($e->getCode() == static::DATABASE_NOT_FOUND) { throw new DatabaseNotFoundException($e->getMessage(), $e->getCode(), $e); } if ($e->getCode() == static::ACCESS_DENIED) { throw new DatabaseAccessDeniedException($e->getMessage(), $e->getCode(), $e); } throw $e; }
Impacts:
Module developers