Browse Source

Use PDO::ATTR_CLIENT_VERSION when PDO::ATTR_DRIVER_VERSION does not exist (#7564)

pull/7815/head
Aleksander Machniak 5 years ago
parent
commit
343674d2fa
  1. 13
      program/lib/Roundcube/db/sqlsrv.php

13
program/lib/Roundcube/db/sqlsrv.php

@ -42,7 +42,18 @@ class rcube_db_sqlsrv extends rcube_db_mssql
}
if ($table) {
$driver_version = $this->dbh->getAttribute(PDO::ATTR_DRIVER_VERSION);
// For some unknown reason the constant described in the driver docs
// might not exist, we'll fallback to PDO::ATTR_CLIENT_VERSION (#7564)
if (defined('PDO::ATTR_DRIVER_VERSION')) {
$driver_version = $this->dbh->getAttribute(PDO::ATTR_DRIVER_VERSION);
}
else if (defined('PDO::ATTR_CLIENT_VERSION')) {
$client_version = $this->dbh->getAttribute(PDO::ATTR_CLIENT_VERSION);
$driver_version = $client_version['ExtensionVer'];
}
else {
$driver_version = 5;
}
// Starting from version 5 of the driver lastInsertId() method expects
// a sequence name instead of a table name. We'll unset the argument

Loading…
Cancel
Save