diff options
Diffstat (limited to 'phpBB/phpbb/db/driver/postgres.php')
-rw-r--r-- | phpBB/phpbb/db/driver/postgres.php | 55 |
1 files changed, 19 insertions, 36 deletions
diff --git a/phpBB/phpbb/db/driver/postgres.php b/phpBB/phpbb/db/driver/postgres.php index 14854d179d..9e091f0a5d 100644 --- a/phpBB/phpbb/db/driver/postgres.php +++ b/phpBB/phpbb/db/driver/postgres.php @@ -7,26 +7,20 @@ * */ -/** -* @ignore -*/ -if (!defined('IN_PHPBB')) -{ - exit; -} +namespace phpbb\db\driver; /** * PostgreSQL Database Abstraction Layer * Minimum Requirement is Version 7.3+ * @package dbal */ -class phpbb_db_driver_postgres extends phpbb_db_driver +class postgres extends \phpbb\db\driver\driver { var $last_query_text = ''; var $connect_error = ''; /** - * Connect to server + * {@inheritDoc} */ function sql_connect($sqlserver, $sqluser, $sqlpassword, $database, $port = false, $persistency = false, $new_link = false) { @@ -84,7 +78,7 @@ class phpbb_db_driver_postgres extends phpbb_db_driver $this->connect_error = 'pg_pconnect function does not exist, is pgsql extension installed?'; return $this->sql_error(''); } - $collector = new phpbb_error_collector; + $collector = new \phpbb\error_collector; $collector->install(); $this->db_connect_id = (!$new_link) ? @pg_pconnect($connect_string) : @pg_pconnect($connect_string, PGSQL_CONNECT_FORCE_NEW); } @@ -95,7 +89,7 @@ class phpbb_db_driver_postgres extends phpbb_db_driver $this->connect_error = 'pg_connect function does not exist, is pgsql extension installed?'; return $this->sql_error(''); } - $collector = new phpbb_error_collector; + $collector = new \phpbb\error_collector; $collector->install(); $this->db_connect_id = (!$new_link) ? @pg_connect($connect_string) : @pg_connect($connect_string, PGSQL_CONNECT_FORCE_NEW); } @@ -121,10 +115,7 @@ class phpbb_db_driver_postgres extends phpbb_db_driver } /** - * Version information about used database - * @param bool $raw if true, only return the fetched sql_server_version - * @param bool $use_cache If true, it is safe to retrieve the value from the cache - * @return string sql server version + * {@inheritDoc} */ function sql_server_info($raw = false, $use_cache = true) { @@ -172,13 +163,7 @@ class phpbb_db_driver_postgres extends phpbb_db_driver } /** - * Base query method - * - * @param string $query Contains the SQL query which shall be executed - * @param int $cache_ttl Either 0 to avoid caching or the time in seconds which the result shall be kept in cache - * @return mixed When casted to bool the returned value returns true on success and false on failure - * - * @access public + * {@inheritDoc} */ function sql_query($query = '', $cache_ttl = 0) { @@ -259,7 +244,7 @@ class phpbb_db_driver_postgres extends phpbb_db_driver } /** - * Return number of affected rows + * {@inheritDoc} */ function sql_affectedrows() { @@ -267,7 +252,7 @@ class phpbb_db_driver_postgres extends phpbb_db_driver } /** - * Fetch current row + * {@inheritDoc} */ function sql_fetchrow($query_id = false) { @@ -287,8 +272,7 @@ class phpbb_db_driver_postgres extends phpbb_db_driver } /** - * Seek to given row number - * rownum is zero-based + * {@inheritDoc} */ function sql_rowseek($rownum, &$query_id) { @@ -308,7 +292,7 @@ class phpbb_db_driver_postgres extends phpbb_db_driver } /** - * Get last inserted id after insert statement + * {@inheritDoc} */ function sql_nextid() { @@ -326,7 +310,7 @@ class phpbb_db_driver_postgres extends phpbb_db_driver return false; } - $temp_result = @pg_fetch_assoc($temp_q_id, NULL); + $temp_result = @pg_fetch_assoc($temp_q_id, null); @pg_free_result($query_id); return ($temp_result) ? $temp_result['last_value'] : false; @@ -337,7 +321,7 @@ class phpbb_db_driver_postgres extends phpbb_db_driver } /** - * Free sql result + * {@inheritDoc} */ function sql_freeresult($query_id = false) { @@ -348,7 +332,7 @@ class phpbb_db_driver_postgres extends phpbb_db_driver $query_id = $this->query_result; } - if ($cache && $cache->sql_exists($query_id)) + if ($cache && !is_object($query_id) && $cache->sql_exists($query_id)) { return $cache->sql_freeresult($query_id); } @@ -363,8 +347,7 @@ class phpbb_db_driver_postgres extends phpbb_db_driver } /** - * Escape string used in sql query - * Note: Do not use for bytea values if we may use them at a later stage + * {@inheritDoc} */ function sql_escape($msg) { @@ -381,7 +364,7 @@ class phpbb_db_driver_postgres extends phpbb_db_driver } /** - * @inheritdoc + * {@inheritDoc} */ function cast_expr_to_bigint($expression) { @@ -389,7 +372,7 @@ class phpbb_db_driver_postgres extends phpbb_db_driver } /** - * @inheritdoc + * {@inheritDoc} */ function cast_expr_to_string($expression) { @@ -454,7 +437,7 @@ class phpbb_db_driver_postgres extends phpbb_db_driver if ($result = @pg_query($this->db_connect_id, "EXPLAIN $explain_query")) { - while ($row = @pg_fetch_assoc($result, NULL)) + while ($row = @pg_fetch_assoc($result, null)) { $html_table = $this->sql_report('add_select_row', $query, $html_table, $row); } @@ -474,7 +457,7 @@ class phpbb_db_driver_postgres extends phpbb_db_driver $endtime = $endtime[0] + $endtime[1]; $result = @pg_query($this->db_connect_id, $query); - while ($void = @pg_fetch_assoc($result, NULL)) + while ($void = @pg_fetch_assoc($result, null)) { // Take the time spent on parsing rows into account } |