@@ -7,34 +7,34 @@ |
||
| 7 | 7 | |
| 8 | 8 | abstract class QueryManagerMysql extends QueryManager |
| 9 | 9 | { |
| 10 | - protected $mysqli; |
|
| 11 | - |
|
| 12 | - protected function __construct() |
|
| 13 | - { |
|
| 14 | - $this->mysqli = new \mysqli(SYS_DB_HOST, SYS_DB_USER, SYS_DB_PSWD, SYS_DB_NAME, SYS_DB_PORT); |
|
| 15 | - if ('' != $this->mysqli->connect_error) { |
|
| 16 | - header('Location:'.HOST_URL.'offline.html'); |
|
| 17 | - exit(); |
|
| 18 | - } |
|
| 19 | - $this->mysqli->set_charset('utf8'); |
|
| 20 | - |
|
| 21 | - if ('' != $this->mysqli->connect_error) { |
|
| 22 | - header('Location:'.HOST_URL.'offline.html'); |
|
| 23 | - exit(); |
|
| 24 | - } |
|
| 25 | - } |
|
| 26 | - |
|
| 27 | - public function __destruct() |
|
| 28 | - { |
|
| 29 | - $this->mysqli->close(); |
|
| 30 | - } |
|
| 31 | - |
|
| 32 | - ///////// |
|
| 33 | - // Misc |
|
| 34 | - ///////// |
|
| 35 | - |
|
| 36 | - public function getEcapedString($string) |
|
| 37 | - { |
|
| 38 | - return mysqli_real_escape_string($this->mysqli, $string); |
|
| 39 | - } |
|
| 10 | + protected $mysqli; |
|
| 11 | + |
|
| 12 | + protected function __construct() |
|
| 13 | + { |
|
| 14 | + $this->mysqli = new \mysqli(SYS_DB_HOST, SYS_DB_USER, SYS_DB_PSWD, SYS_DB_NAME, SYS_DB_PORT); |
|
| 15 | + if ('' != $this->mysqli->connect_error) { |
|
| 16 | + header('Location:'.HOST_URL.'offline.html'); |
|
| 17 | + exit(); |
|
| 18 | + } |
|
| 19 | + $this->mysqli->set_charset('utf8'); |
|
| 20 | + |
|
| 21 | + if ('' != $this->mysqli->connect_error) { |
|
| 22 | + header('Location:'.HOST_URL.'offline.html'); |
|
| 23 | + exit(); |
|
| 24 | + } |
|
| 25 | + } |
|
| 26 | + |
|
| 27 | + public function __destruct() |
|
| 28 | + { |
|
| 29 | + $this->mysqli->close(); |
|
| 30 | + } |
|
| 31 | + |
|
| 32 | + ///////// |
|
| 33 | + // Misc |
|
| 34 | + ///////// |
|
| 35 | + |
|
| 36 | + public function getEcapedString($string) |
|
| 37 | + { |
|
| 38 | + return mysqli_real_escape_string($this->mysqli, $string); |
|
| 39 | + } |
|
| 40 | 40 | } |
@@ -6,29 +6,29 @@ |
||
| 6 | 6 | |
| 7 | 7 | abstract class QueryManagerPostgresql extends QueryManager |
| 8 | 8 | { |
| 9 | - protected $db; |
|
| 10 | - |
|
| 11 | - protected function __construct() |
|
| 12 | - { |
|
| 13 | - $this->db = pg_connect('host='.SYS_DB_HOST.' port='.SYS_DB_PORT.' dbname='.SYS_DB_NAME.' user='.SYS_DB_USER.' password='.SYS_DB_PSWD); |
|
| 14 | - |
|
| 15 | - if (false === $this->db) { |
|
| 16 | - header('Location:'.HOST_URL.'offline.html'); |
|
| 17 | - exit(); |
|
| 18 | - } |
|
| 19 | - } |
|
| 20 | - |
|
| 21 | - public function __destruct() |
|
| 22 | - { |
|
| 23 | - pg_close($this->db); |
|
| 24 | - } |
|
| 25 | - |
|
| 26 | - ///////// |
|
| 27 | - // Misc |
|
| 28 | - ///////// |
|
| 29 | - |
|
| 30 | - public function getEcapedString($string) |
|
| 31 | - { |
|
| 32 | - return pg_escape_string($this->db, $string); |
|
| 33 | - } |
|
| 9 | + protected $db; |
|
| 10 | + |
|
| 11 | + protected function __construct() |
|
| 12 | + { |
|
| 13 | + $this->db = pg_connect('host='.SYS_DB_HOST.' port='.SYS_DB_PORT.' dbname='.SYS_DB_NAME.' user='.SYS_DB_USER.' password='.SYS_DB_PSWD); |
|
| 14 | + |
|
| 15 | + if (false === $this->db) { |
|
| 16 | + header('Location:'.HOST_URL.'offline.html'); |
|
| 17 | + exit(); |
|
| 18 | + } |
|
| 19 | + } |
|
| 20 | + |
|
| 21 | + public function __destruct() |
|
| 22 | + { |
|
| 23 | + pg_close($this->db); |
|
| 24 | + } |
|
| 25 | + |
|
| 26 | + ///////// |
|
| 27 | + // Misc |
|
| 28 | + ///////// |
|
| 29 | + |
|
| 30 | + public function getEcapedString($string) |
|
| 31 | + { |
|
| 32 | + return pg_escape_string($this->db, $string); |
|
| 33 | + } |
|
| 34 | 34 | } |