* [ADD] Unit testing. Work in progress.

* [MOD] Added some connection options to MySQL handler
This commit is contained in:
nuxsmin
2018-06-02 22:26:25 +02:00
parent 0dd5cea67f
commit 61f4f2315a

View File

@@ -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(