1
0
mirror of https://git.tt-rss.org/git/tt-rss.git synced 2025-12-13 15:25:59 +00:00

db updates, remove init_connection()

This commit is contained in:
Andrew Dolgov
2013-04-17 14:23:35 +04:00
parent 9594791782
commit ba68b6815a
21 changed files with 47 additions and 51 deletions

View File

@@ -16,6 +16,7 @@ class Db implements IDb {
}
$this->adapter->connect(DB_HOST, DB_USER, DB_PASS, DB_NAME, DB_PORT);
$this->adapter->init();
}
private function __clone() {
@@ -33,6 +34,10 @@ class Db implements IDb {
return("'$str'");
}
function init() {
//
}
function connect($host, $user, $pass, $db, $port) {
//return $this->adapter->connect($host, $user, $pass, $db, $port);
}

View File

@@ -55,5 +55,15 @@ class Db_Mysql implements IDb {
return mysql_affected_rows($this->link);
}
function init() {
$this->query("SET time_zone = '+0:0'");
if (defined('MYSQL_CHARSET') && MYSQL_CHARSET) {
$this->query("SET NAMES " . MYSQL_CHARSET);
}
return true;
}
}
?>

View File

@@ -69,5 +69,13 @@ class Db_Pgsql implements IDb {
return pg_last_error($this->link);
}
function init() {
$this->query("set client_encoding = 'UTF-8'");
pg_set_client_encoding("UNICODE");
$this->query("set datestyle = 'ISO, european'");
$this->query("set TIME ZONE 0");
return true;
}
}
?>

View File

@@ -1,6 +1,7 @@
<?php
interface IDb {
function connect($host, $user, $pass, $db, $port);
function init();
function escape_string($s, $strip_tags = true);
function query($query, $die_on_error = true);
function fetch_assoc($result);