]> git.wh0rd.org Git - tt-rss.git/commitdiff
PDO: set unicode for mysql and other connection params
authorAndrew Dolgov <noreply@fakecake.org>
Fri, 1 Dec 2017 19:14:54 +0000 (22:14 +0300)
committerAndrew Dolgov <noreply@fakecake.org>
Fri, 1 Dec 2017 19:14:54 +0000 (22:14 +0300)
classes/db.php

index 94dec766e74c9bcb137087af8be8e7211841bf68..aba249a50b6779759a2b72fbb8648f7a08c8cc50 100644 (file)
@@ -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) {