diff options
Diffstat (limited to 'phpBB/includes/db/postgres.php')
-rw-r--r-- | phpBB/includes/db/postgres.php | 38 |
1 files changed, 24 insertions, 14 deletions
diff --git a/phpBB/includes/db/postgres.php b/phpBB/includes/db/postgres.php index bdaab439ea..94bc70fa6a 100644 --- a/phpBB/includes/db/postgres.php +++ b/phpBB/includes/db/postgres.php @@ -26,6 +26,7 @@ include_once($phpbb_root_path . 'includes/db/dbal.' . $phpEx); class dbal_postgres extends dbal { var $last_query_text = ''; + var $pgsql_version; /** * Connect to server @@ -80,6 +81,28 @@ class dbal_postgres extends dbal if ($this->db_connect_id) { + // determine what version of PostgreSQL is running, we can be more efficient if they are running 8.2+ + if (version_compare(PHP_VERSION, '5.0.0', '>=')) + { + $this->pgsql_version = @pg_parameter_status($this->db_connect_id, 'server_version'); + } + else + { + $query_id = @pg_query($this->db_connect_id, 'SELECT VERSION()'); + $row = @pg_fetch_assoc($query_id, null); + @pg_free_result($query_id); + + if (!empty($row['version'])) + { + $this->pgsql_version = substr($row['version'], 10); + } + } + + if (!empty($this->pgsql_version) && $this->pgsql_version[0] >= '8' && $this->pgsql_version[2] >= '2') + { + $this->multi_insert = true; + } + if ($schema !== '') { @pg_query($this->db_connect_id, 'SET search_path TO ' . $schema); @@ -95,20 +118,7 @@ class dbal_postgres extends dbal */ function sql_server_info() { - if (version_compare(PHP_VERSION, '5.0.0', '>=')) - { - $version = @pg_version($this->db_connect_id); - return 'PostgreSQL' . ((!empty($version)) ? ' ' . $version['client'] : ''); - } - else - { - $query_id = @pg_query($this->db_connect_id, 'select version()'); - $row = @pg_fetch_assoc($query_id, null); - @pg_free_result($query_id); - - $version = $row['version']; - return ((!empty($version)) ? ' ' . $version : ''); - } + return 'PostgreSQL ' . $this->pgsql_version; } /** |