Index: trunk/phase3/includes/search/SearchOracle.php |
— | — | @@ -254,9 +254,9 @@ |
255 | 255 | // ALTER SESSION SET CURRENT_SCHEMA = ... |
256 | 256 | // was used. |
257 | 257 | $dbw->query( "CALL ctx_ddl.sync_index(" . |
258 | | - $dbw->addQuotes( $dbw->getDBname() . '.' . trim( $dbw->tableName( 'si_text_idx' ), '"' ) ) . ")" ); |
| 258 | + $dbw->addQuotes( $dbw->getDBname() . '.' . $dbw->tableName( 'si_text_idx', false ) ) . ")" ); |
259 | 259 | $dbw->query( "CALL ctx_ddl.sync_index(" . |
260 | | - $dbw->addQuotes( $dbw->getDBname() . '.' . trim( $dbw->tableName( 'si_title_idx' ), '"' ) ) . ")" ); |
| 260 | + $dbw->addQuotes( $dbw->getDBname() . '.' . $dbw->tableName( 'si_title_idx', false ) ) . ")" ); |
261 | 261 | } |
262 | 262 | |
263 | 263 | /** |
Index: trunk/phase3/includes/db/DatabaseOracle.php |
— | — | @@ -463,7 +463,7 @@ |
464 | 464 | private function fieldBindStatement ( $table, $col, &$val, $includeCol = false ) { |
465 | 465 | $col_info = $this->fieldInfoMulti( $table, $col ); |
466 | 466 | $col_type = $col_info != false ? $col_info->type() : 'CONSTANT'; |
467 | | - |
| 467 | + |
468 | 468 | $bind = ''; |
469 | 469 | if ( is_numeric( $col ) ) { |
470 | 470 | $bind = $val; |
— | — | @@ -633,7 +633,7 @@ |
634 | 634 | return $retval; |
635 | 635 | } |
636 | 636 | |
637 | | - function tableName( $name, $quoted ) { |
| 637 | + function tableName( $name, $quoted = true ) { |
638 | 638 | /* |
639 | 639 | Replace reserved words with better ones |
640 | 640 | Using uppercase because that's the only way Oracle can handle |
— | — | @@ -877,7 +877,7 @@ |
878 | 878 | * Query whether a given table exists (in the given schema, or the default mw one if not given) |
879 | 879 | */ |
880 | 880 | function tableExists( $table ) { |
881 | | - $table = trim($this->tableName($table), '"'); |
| 881 | + $table = $this->removeIdentifierQuotes($table); |
882 | 882 | $SQL = "SELECT 1 FROM user_tables WHERE table_name='$table'"; |
883 | 883 | $res = $this->doQuery( $SQL ); |
884 | 884 | if ( $res ) { |
— | — | @@ -905,7 +905,7 @@ |
906 | 906 | $table = array_map( array( &$this, 'tableName' ), $table ); |
907 | 907 | $tableWhere = 'IN ('; |
908 | 908 | foreach( $table as &$singleTable ) { |
909 | | - $singleTable = strtoupper( trim( $singleTable, '"' ) ); |
| 909 | + $singleTable = $this->removeIdentifierQuotes($singleTable); |
910 | 910 | if ( isset( $this->mFieldInfoCache["$singleTable.$field"] ) ) { |
911 | 911 | return $this->mFieldInfoCache["$singleTable.$field"]; |
912 | 912 | } |
— | — | @@ -913,7 +913,7 @@ |
914 | 914 | } |
915 | 915 | $tableWhere = rtrim( $tableWhere, ',' ) . ')'; |
916 | 916 | } else { |
917 | | - $table = strtoupper( trim( $this->tableName( $table ), '"' ) ); |
| 917 | + $table = $this->removeIdentifierQuotes($table); |
918 | 918 | if ( isset( $this->mFieldInfoCache["$table.$field"] ) ) { |
919 | 919 | return $this->mFieldInfoCache["$table.$field"]; |
920 | 920 | } |
— | — | @@ -1078,18 +1078,20 @@ |
1079 | 1079 | } |
1080 | 1080 | |
1081 | 1081 | public function addIdentifierQuotes( $s ) { |
1082 | | - return parent::addIdentifierQuotes( $s ); |
1083 | | - |
1084 | | - /* Does this old code make any sense? |
1085 | | - * We could always use quoted identifier. |
1086 | | - * See http://download.oracle.com/docs/cd/B19306_01/server.102/b14200/sql_elements008.htm |
1087 | | - */ |
1088 | | - if ( !$this->mFlags & DBO_DDLMODE ) { |
1089 | | - $s = '"' . str_replace( '"', '""', $s ) . '"'; |
| 1082 | + if ( !$this->getFlag( DBO_DDLMODE ) ) { |
| 1083 | + $s = '/*Q*/' . $s; |
1090 | 1084 | } |
1091 | 1085 | return $s; |
1092 | 1086 | } |
1093 | 1087 | |
| 1088 | + public function removeIdentifierQuotes( $s ) { |
| 1089 | + return strpos($s, '/*Q*/') === FALSE ? $s : substr($s, 5); ; |
| 1090 | + } |
| 1091 | + |
| 1092 | + public function isQuotedIdentifier( $s ) { |
| 1093 | + return strpos($s, '/*Q*/') !== FALSE; |
| 1094 | + } |
| 1095 | + |
1094 | 1096 | function selectRow( $table, $vars, $conds, $fname = 'DatabaseOracle::selectRow', $options = array(), $join_conds = array() ) { |
1095 | 1097 | global $wgContLang; |
1096 | 1098 | |