From ebb1391939c69589d6fa329c9725af5fc8557015 Mon Sep 17 00:00:00 2001 From: Jure Kajzer Date: Fri, 30 Oct 2009 09:44:37 +0000 Subject: [PATCH] overloaded makeList in DatabaseOracle to handle CLOBs in WHERE clauses --- includes/db/DatabaseOracle.php | 33 ++++++++------------------------- 1 file changed, 8 insertions(+), 25 deletions(-) diff --git a/includes/db/DatabaseOracle.php b/includes/db/DatabaseOracle.php index 6ccf82d9f4..99dbe0585e 100644 --- a/includes/db/DatabaseOracle.php +++ b/includes/db/DatabaseOracle.php @@ -1012,39 +1012,22 @@ class DatabaseOracle extends DatabaseBase { return array( $startOpts, $useIndex, $preLimitTail, $postLimitTail ); } - /* redundand ... will remove after confirming bitwise operations functionality public function makeList( $a, $mode = LIST_COMMA ) { - if ( !is_array( $a ) ) { + if ( !is_array( $a ) ) { throw new DBUnexpectedError( $this, 'DatabaseOracle::makeList called with incorrect parameters' ); } + $a2 = array(); - foreach ($a as $key => $value) { - if (strpos($key, ' & ') !== FALSE) - $a2[preg_replace('/(.*)\s&\s(.*)/', 'BITAND($1, $2)', $key)] = $value; - elseif (strpos($key, ' | ') !== FALSE) - $a2[preg_replace('/(.*)\s|\s(.*)/', 'BITOR($1, $2)', $key)] = $value; - elseif (!is_array($value)) { - if (strpos($value, ' = ') !== FALSE) { - if (strpos($value, ' & ') !== FALSE) - $a2[$key] = preg_replace('/(.*)\s&\s(.*?)\s=\s(.*)/', 'BITAND($1, $2) = $3', $value); - elseif (strpos($value, ' | ') !== FALSE) - $a2[$key] = preg_replace('/(.*)\s|\s(.*?)\s=\s(.*)/', 'BITOR($1, $2) = $3', $value); - else $a2[$key] = $value; - } - elseif (strpos($value, ' & ') !== FALSE) - $a2[$key] = preg_replace('/(.*)\s&\s(.*)/', 'BITAND($1, $2)', $value); - elseif (strpos($value, ' | ') !== FALSE) - $a2[$key] = preg_replace('/(.*)\s|\s(.*)/', 'BITOR($1, $2)', $value); - else - $a2[$key] = $value; - } + foreach($a as $col=>$val) { + $col_type=$this->fieldInfo($this->tableName($table), $col)->type(); + if ($col_type == 'CLOB') + $a2['TO_CHAR('.$col.')'] = $val; else - $a2[$key] = $value; + $a2[$col] = $val; } - + return parent::makeList($a2, $mode); } - */ function bitNot($field) { //expecting bit-fields smaller than 4bytes -- 2.20.1