mirror of
https://git.tt-rss.org/git/tt-rss.git
synced 2025-12-13 13:55:55 +00:00
wip: initial for config object
This commit is contained in:
@@ -21,9 +21,9 @@ class Db
|
||||
$db_host = defined('DB_HOST') && DB_HOST ? ';host=' . DB_HOST : '';
|
||||
|
||||
try {
|
||||
$pdo = new PDO(DB_TYPE . ':dbname=' . DB_NAME . $db_host . $db_port,
|
||||
DB_USER,
|
||||
DB_PASS);
|
||||
$pdo = new PDO(Config::get(Config::DB_TYPE) . ':dbname=' . Config::get(Config::DB_NAME) . $db_host . $db_port,
|
||||
Config::get(Config::DB_USER),
|
||||
Config::get(Config::DB_PASS));
|
||||
} catch (Exception $e) {
|
||||
print "<pre>Exception while creating PDO object:" . $e->getMessage() . "</pre>";
|
||||
exit(101);
|
||||
@@ -31,14 +31,14 @@ class Db
|
||||
|
||||
$pdo->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
|
||||
|
||||
if (DB_TYPE == "pgsql") {
|
||||
if (Config::get(Config::DB_TYPE) == "pgsql") {
|
||||
|
||||
$pdo->query("set client_encoding = 'UTF-8'");
|
||||
$pdo->query("set datestyle = 'ISO, european'");
|
||||
$pdo->query("set TIME ZONE 0");
|
||||
$pdo->query("set cpu_tuple_cost = 0.5");
|
||||
|
||||
} else if (DB_TYPE == "mysql") {
|
||||
} else if (Config::get(Config::DB_TYPE) == "mysql") {
|
||||
$pdo->query("SET time_zone = '+0:0'");
|
||||
|
||||
if (defined('MYSQL_CHARSET') && MYSQL_CHARSET) {
|
||||
@@ -68,7 +68,7 @@ class Db
|
||||
}
|
||||
|
||||
public static function sql_random_function() {
|
||||
if (DB_TYPE == "mysql") {
|
||||
if (Config::get(Config::DB_TYPE) == "mysql") {
|
||||
return "RAND()";
|
||||
} else {
|
||||
return "RANDOM()";
|
||||
|
||||
Reference in New Issue
Block a user