From 5d42ce553faa3a3eb2a12d66c9b0870ad778c163 Mon Sep 17 00:00:00 2001 From: Andrew Dolgov Date: Mon, 15 Feb 2021 16:55:55 +0300 Subject: drop legacy DB interface and related sanity checks --- classes/db/pgsql.php | 91 ---------------------------------------------------- 1 file changed, 91 deletions(-) delete mode 100644 classes/db/pgsql.php (limited to 'classes/db/pgsql.php') diff --git a/classes/db/pgsql.php b/classes/db/pgsql.php deleted file mode 100644 index 98fab6bea..000000000 --- a/classes/db/pgsql.php +++ /dev/null @@ -1,91 +0,0 @@ - 0) { - $string = "$string port=" . $port; - } - - $this->link = pg_connect($string); - - if (!$this->link) { - print("Unable to connect to database (as $user to $host, database $db):" . pg_last_error()); - exit(102); - } - - $this->init(); - - return $this->link; - } - - function escape_string($s, $strip_tags = true) { - if ($strip_tags) $s = strip_tags($s); - - return pg_escape_string($s); - } - - function query($query, $die_on_error = true) { - $result = @pg_query($this->link, $query); - - if (!$result) { - $this->last_error = @pg_last_error($this->link); - - @pg_query($this->link, "ROLLBACK"); - $query = htmlspecialchars($query); // just in case - user_error("Query $query failed: " . ($this->link ? $this->last_error : "No connection"), - $die_on_error ? E_USER_ERROR : E_USER_WARNING); - } - return $result; - } - - function fetch_assoc($result) { - return pg_fetch_assoc($result); - } - - - function num_rows($result) { - return pg_num_rows($result); - } - - function fetch_result($result, $row, $param) { - return pg_fetch_result($result, $row, $param); - } - - function close() { - return pg_close($this->link); - } - - function affected_rows($result) { - return pg_affected_rows($result); - } - - function last_error() { - return pg_last_error($this->link); - } - - function last_query_error() { - return $this->last_error; - } - - 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"); - $this->query("set cpu_tuple_cost = 0.5"); - - return true; - } -} \ No newline at end of file -- cgit v1.2.3