diff options
author | David M <davidmj@users.sourceforge.net> | 2007-04-01 12:39:34 +0000 |
---|---|---|
committer | David M <davidmj@users.sourceforge.net> | 2007-04-01 12:39:34 +0000 |
commit | e7fcb3625ed5763c50861a64e3a00ee6f86f41e5 (patch) | |
tree | 89749d327eb9f17f93fb026d03bcd0e612e57d29 /phpBB/includes/db/postgres.php | |
parent | 060a00a8244f59b6169a0252206f07ee8c03c7ae (diff) | |
download | forums-e7fcb3625ed5763c50861a64e3a00ee6f86f41e5.tar forums-e7fcb3625ed5763c50861a64e3a00ee6f86f41e5.tar.gz forums-e7fcb3625ed5763c50861a64e3a00ee6f86f41e5.tar.bz2 forums-e7fcb3625ed5763c50861a64e3a00ee6f86f41e5.tar.xz forums-e7fcb3625ed5763c50861a64e3a00ee6f86f41e5.zip |
- PostgreSQL can now use schemas. During install, under database name, enter databasename.schema
- phpversion() to PHP_VERSION
git-svn-id: file:///svn/phpbb/trunk@7255 89ea8834-ac86-4346-8a33-228a782c2dd0
Diffstat (limited to 'phpBB/includes/db/postgres.php')
-rw-r--r-- | phpBB/includes/db/postgres.php | 19 |
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'] : ''); |