aboutsummaryrefslogtreecommitdiffstats
path: root/phpBB/includes/db/postgres.php
diff options
context:
space:
mode:
Diffstat (limited to 'phpBB/includes/db/postgres.php')
-rw-r--r--phpBB/includes/db/postgres.php19
1 files changed, 17 insertions, 2 deletions
diff --git a/phpBB/includes/db/postgres.php b/phpBB/includes/db/postgres.php
index 3f0c97ce00..bdaab439ea 100644
--- a/phpBB/includes/db/postgres.php
+++ b/phpBB/includes/db/postgres.php
@@ -62,9 +62,15 @@ class dbal_postgres extends dbal
}
}
+ $schema = '';
+
if ($database)
{
$this->dbname = $database;
+ if (strpos($database, '.') !== false)
+ {
+ list($database, $schema) = explode('.', $database);
+ }
$connect_string .= "dbname=$database";
}
@@ -72,7 +78,16 @@ class dbal_postgres extends dbal
$this->db_connect_id = ($this->persistency) ? @pg_pconnect($connect_string, $new_link) : @pg_connect($connect_string, $new_link);
- return ($this->db_connect_id) ? $this->db_connect_id : $this->sql_error('');
+ if ($this->db_connect_id)
+ {
+ if ($schema !== '')
+ {
+ @pg_query($this->db_connect_id, 'SET search_path TO ' . $schema);
+ }
+ return $this->db_connect_id;
+ }
+
+ return $this->sql_error('');
}
/**
@@ -80,7 +95,7 @@ class dbal_postgres extends dbal
*/
function sql_server_info()
{
- if (version_compare(phpversion(), '5.0.0', '>='))
+ if (version_compare(PHP_VERSION, '5.0.0', '>='))
{
$version = @pg_version($this->db_connect_id);
return 'PostgreSQL' . ((!empty($version)) ? ' ' . $version['client'] : '');