- $db_port = defined(DB_PORT) ? ';port='.DB_PORT : '';
-
- $this->pdo = new PDO(DB_TYPE . ':dbname='.DB_NAME.';host='.DB_HOST.$db_port,
- DB_USER,
- DB_PASS);
-
- $this->pdo->setAttribute( PDO::ATTR_ERRMODE, PDO::ERRMODE_WARNING );
-
- if (!$this->pdo) {
- print("Error connecting via PDO.");
- 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);
- }
- }
-