From caf6d694c247a3b9a9342f701dadec3e74c5b900 Mon Sep 17 00:00:00 2001 From: Ralf Becker Date: Sat, 11 Sep 2010 07:47:40 +0000 Subject: [PATCH] using qstr (quoting of strings) from ADOdb 5.11, it might fix problems reported by Anthony Messina --- phpgwapi/inc/adodb/drivers/adodb-postgres64.inc.php | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/phpgwapi/inc/adodb/drivers/adodb-postgres64.inc.php b/phpgwapi/inc/adodb/drivers/adodb-postgres64.inc.php index 84e944c592..12f8a31935 100644 --- a/phpgwapi/inc/adodb/drivers/adodb-postgres64.inc.php +++ b/phpgwapi/inc/adodb/drivers/adodb-postgres64.inc.php @@ -253,25 +253,28 @@ select viewname,'V' from pg_views where viewname like $mask"; return $ret; } - /* // if magic quotes disabled, use pg_escape_string() function qstr($s,$magic_quotes=false) { + if (is_bool($s)) return $s ? 'true' : 'false'; + if (!$magic_quotes) { + if (ADODB_PHPVER >= 0x5200) { + return "'".pg_escape_string($this->_connectionID,$s)."'"; + } if (ADODB_PHPVER >= 0x4200) { return "'".pg_escape_string($s)."'"; } if ($this->replaceQuote[0] == '\\'){ - $s = adodb_str_replace(array('\\',"\0"),array('\\\\',"\\\0"),$s); + $s = adodb_str_replace(array('\\',"\0"),array('\\\\',"\\\\000"),$s); } - return "'".str_replace("'",$this->replaceQuote,$s)."'"; + return "'".str_replace("'",$this->replaceQuote,$s)."'"; } - + // undo magic quotes for " $s = str_replace('\\"','"',$s); return "'$s'"; } - */ // Format date column in sql string given an input format that understands Y M D