Add pgsql support

This commit is contained in:
Ruan 2015-08-23 07:35:34 +02:00
parent ad7b4b70de
commit edea8056fa

View File

@ -47,13 +47,19 @@ final class Settings {
}
if ($connect) {
$dsn = "$driver:dbname=$database;host=$host;port=$port;charset=utf8";
$dsn = "$driver:dbname=$database;host=$host;port=$port";
if ($driver === 'mysql') {
$dsn .= ';charset=utf8';
}
try {
$this->conn = new PDO($dsn, $username, $password);
} catch (PDOException $e) {
echo 'Connection failed: ' . $e->getMessage();
}
if ($driver === 'pgsql') {
$this->conn->query("SET NAMES 'UTF8';");
}
}
}
}