summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorchriskl2004-12-06 02:48:34 +0000
committerchriskl2004-12-06 02:48:34 +0000
commitcd9b34b63b5c6a0aba65199ce7c375cb811abbcc (patch)
tree0a633a0f05e6c74b1c7c36ce6a7509531be81618
parent553dbd06f5b4505c29b92a7135b5c8cade477fcf (diff)
fixes for search paths
-rw-r--r--classes/database/ADODB_base.php4
-rw-r--r--classes/database/Postgres73.php9
2 files changed, 10 insertions, 3 deletions
diff --git a/classes/database/ADODB_base.php b/classes/database/ADODB_base.php
index 1a232d59..5a0beff7 100644
--- a/classes/database/ADODB_base.php
+++ b/classes/database/ADODB_base.php
@@ -3,7 +3,7 @@
/*
* Parent class of all ADODB objects.
*
- * $Id: ADODB_base.php,v 1.19 2004/07/19 03:01:53 chriskl Exp $
+ * $Id: ADODB_base.php,v 1.20 2004/12/06 02:48:34 chriskl Exp $
*/
include_once('./libraries/errorhandler.inc.php');
@@ -310,6 +310,8 @@ class ADODB_base {
* @return A PHP array
*/
function phpArray($arr) {
+ if ($arr == '{}') return array();
+
$temp = explode(',', substr($arr, 1, strlen($arr) - 2));
// Remove any quoting
for ($i = 0; $i < sizeof($temp); $i++) {
diff --git a/classes/database/Postgres73.php b/classes/database/Postgres73.php
index 99d1c87a..14f3b9bd 100644
--- a/classes/database/Postgres73.php
+++ b/classes/database/Postgres73.php
@@ -4,7 +4,7 @@
* A class that implements the DB interface for Postgres
* Note: This class uses ADODB and returns RecordSets.
*
- * $Id: Postgres73.php,v 1.141 2004/11/29 01:48:38 chriskl Exp $
+ * $Id: Postgres73.php,v 1.142 2004/12/06 02:48:34 chriskl Exp $
*/
// @@@ THOUGHT: What about inherits? ie. use of ONLY???
@@ -89,7 +89,11 @@ class Postgres73 extends Postgres72 {
*/
function setSearchPath($paths) {
if (!is_array($paths)) return -1;
- elseif (sizeof($paths) == 0) return -2;
+ elseif (sizeof($paths) == 0) return -2;
+ elseif (sizeof($paths) == 1 && $paths[0] == '') {
+ // Need to handle empty paths in some cases
+ $paths[0] = 'pg_catalog';
+ }
$this->fieldArrayClean($paths);
$sql = 'SET SEARCH_PATH TO "' . implode('","', $paths) . '"';
@@ -103,6 +107,7 @@ class Postgres73 extends Postgres72 {
*/
function getSearchPath() {
$sql = 'SELECT current_schemas(false) AS search_path';
+
return $this->phpArray($this->selectField($sql, 'search_path'));
}