mirror of
https://gitlab.com/ruany/litebans-php.git
synced 2025-05-24 00:42:43 +00:00
Add pgsql support
This commit is contained in:
parent
ad7b4b70de
commit
edea8056fa
@ -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';");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user