summaryrefslogtreecommitdiff
path: root/classes/db.php
diff options
context:
space:
mode:
authorAndrew Dolgov <[email protected]>2017-12-01 22:14:54 +0300
committerAndrew Dolgov <[email protected]>2017-12-01 22:14:54 +0300
commitdd90eefae18d75db703bc3d2ebd21501f12d3213 (patch)
tree7a3ca0054763ec41c0f19347a67637611293f530 /classes/db.php
parentaee3f0e6d95f58e89bef305c9c2e3fcbc91fe17d (diff)
PDO: set unicode for mysql and other connection params
Diffstat (limited to 'classes/db.php')
-rw-r--r--classes/db.php15
1 files changed, 15 insertions, 0 deletions
diff --git a/classes/db.php b/classes/db.php
index 94dec766e..aba249a50 100644
--- a/classes/db.php
+++ b/classes/db.php
@@ -38,6 +38,21 @@ class Db implements IDb {
exit(101);
}
+ if (DB_TYPE == "pgsql") {
+
+ $this->pdo->query("set client_encoding = 'UTF-8'");
+ $this->pdo->query("set datestyle = 'ISO, european'");
+ $this->pdo->query("set TIME ZONE 0");
+ $this->pdo->query("set cpu_tuple_cost = 0.5");
+
+ } else if (DB_TYPE == "mysql") {
+ $this->pdo->query("SET time_zone = '+0:0'");
+
+ if (defined('MYSQL_CHARSET') && MYSQL_CHARSET) {
+ $this->pdo->query("SET NAMES " . MYSQL_CHARSET);
+ }
+ }
+
$this->link = $this->adapter->connect(DB_HOST, DB_USER, DB_PASS, DB_NAME, defined('DB_PORT') ? DB_PORT : "");
if (!$this->link) {