mirror of
https://github.com/nuxsmin/sysPass.git
synced 2026-03-11 10:56:58 +01:00
* [ADD] Unit testing. Work in progress.
* [MOD] Added some connection options to MySQL handler
This commit is contained in:
@@ -39,7 +39,7 @@ class MySQLHandler implements DBStorageInterface
|
||||
const STATUS_OK = 0;
|
||||
const STATUS_KO = 1;
|
||||
const PDO_OPTS = [
|
||||
PDO::ATTR_EMULATE_PREPARES => true,
|
||||
PDO::ATTR_EMULATE_PREPARES => false,
|
||||
PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION,
|
||||
PDO::MYSQL_ATTR_FOUND_ROWS => true
|
||||
];
|
||||
@@ -107,6 +107,10 @@ class MySQLHandler implements DBStorageInterface
|
||||
self::PDO_OPTS
|
||||
);
|
||||
|
||||
// Set prepared statement emulation depending on server version
|
||||
$serverVersion = $this->db->getAttribute(PDO::ATTR_SERVER_VERSION);
|
||||
$this->db->setAttribute(PDO::ATTR_EMULATE_PREPARES, version_compare($serverVersion, '5.1.17', '<'));
|
||||
|
||||
$this->dbStatus = self::STATUS_OK;
|
||||
} catch (\Exception $e) {
|
||||
throw new SPException(
|
||||
|
||||
Reference in New Issue
Block a user