Browse Source

init pdo connection

Andrew Dolgov 2 years ago
parent
commit
002bd07c17
2 changed files with 6 additions and 0 deletions
  1. 1 0
      backend.php
  2. 5 0
      classes/db.php

+ 1 - 0
backend.php

@@ -27,6 +27,7 @@
 	require_once "users.php";
 
 	$link = db_connect(DB_HOST, DB_USER, DB_PASS, DB_NAME);
+	$dbh = DB::get();
 
 	init_connection($link);
 

+ 5 - 0
classes/db.php

@@ -10,6 +10,11 @@ class DB {
 		$this->dbh = new PDO('pgsql:dbname='.DB_NAME.';host='.DB_HOST.';port='.DB_PORT,
 			DB_USER,
 			DB_PASS);
+
+		$this->dbh->query("set client_encoding = 'UTF-8'");
+		$this->dbh->query("set datestyle = 'ISO, european'");
+		$this->dbh->query("set time zone '".DB_TIMEZONE."'");
+
 	}
 
 	private function __clone() {