bug #37342 [Cache] fix compat with DBAL v3 (nicolas-grekas)

This PR was merged into the 3.4 branch.

Discussion
----------

[Cache] fix compat with DBAL v3

| Q             | A
| ------------- | ---
| Branch?       | 3.4
| Bug fix?      | yes
| New feature?  | no
| Deprecations? | no
| Tickets       | -
| License       | MIT
| Doc PR        | -

Commits
-------

8c4b49613a [Cache] fix compat with DBAL v3
This commit is contained in:
Nicolas Grekas 2020-06-18 18:01:11 +02:00
commit 363eec265b

View File

@ -366,25 +366,31 @@ trait PdoTrait
if ($this->conn instanceof \PDO) { if ($this->conn instanceof \PDO) {
$this->driver = $this->conn->getAttribute(\PDO::ATTR_DRIVER_NAME); $this->driver = $this->conn->getAttribute(\PDO::ATTR_DRIVER_NAME);
} else { } else {
switch ($this->driver = $this->conn->getDriver()->getName()) { $driver = $this->conn->getDriver();
case 'mysqli':
case 'pdo_mysql': switch (true) {
case 'drizzle_pdo_mysql': case $driver instanceof \Doctrine\DBAL\Driver\AbstractMySQLDriver:
case $driver instanceof \Doctrine\DBAL\Driver\DrizzlePDOMySql\Driver:
case $driver instanceof \Doctrine\DBAL\Driver\Mysqli\Driver:
case $driver instanceof \Doctrine\DBAL\Driver\PDOMySql\Driver:
$this->driver = 'mysql'; $this->driver = 'mysql';
break; break;
case 'pdo_sqlite': case $driver instanceof \Doctrine\DBAL\Driver\PDOSqlite\Driver:
$this->driver = 'sqlite'; $this->driver = 'sqlite';
break; break;
case 'pdo_pgsql': case $driver instanceof \Doctrine\DBAL\Driver\PDOPgSql\Driver:
$this->driver = 'pgsql'; $this->driver = 'pgsql';
break; break;
case 'oci8': case $driver instanceof \Doctrine\DBAL\Driver\OCI8\Driver:
case 'pdo_oracle': case $driver instanceof \Doctrine\DBAL\Driver\PDOOracle\Driver:
$this->driver = 'oci'; $this->driver = 'oci';
break; break;
case 'pdo_sqlsrv': case $driver instanceof \Doctrine\DBAL\Driver\SQLSrv\Driver:
$this->driver = 'sqlsrv'; $this->driver = 'sqlsrv';
break; break;
default:
$this->driver = \get_class($driver);
break;
} }
} }
} }