Index: trunk/phase3/includes/db/DatabaseOracle.php |
— | — | @@ -276,9 +276,9 @@ |
277 | 277 | |
278 | 278 | function doQuery($sql) { |
279 | 279 | wfDebug("SQL: [$sql]\n"); |
280 | | -// if (!mb_check_encoding($sql)) { |
281 | | -// throw new MWException("SQL encoding is invalid\n$sql"); |
282 | | -// } |
| 280 | + if (!mb_check_encoding($sql)) { |
| 281 | + throw new MWException("SQL encoding is invalid\n$sql"); |
| 282 | + } |
283 | 283 | |
284 | 284 | //handle some oracle specifics |
285 | 285 | //remove AS column/table/subquery namings |
— | — | @@ -653,6 +653,11 @@ |
654 | 654 | foreach( $rows as $row ) { |
655 | 655 | # Delete rows which collide |
656 | 656 | if ( $uniqueIndexes ) { |
| 657 | + $condsDelete = array(); |
| 658 | + foreach ( $uniqueIndexes as $index ) |
| 659 | + $condsDelete[$index] = $row[$index]; |
| 660 | + $this->delete( $table, $condsDelete, $fname); |
| 661 | +/* |
657 | 662 | $sql = "DELETE FROM $table WHERE "; |
658 | 663 | $first = true; |
659 | 664 | foreach ( $uniqueIndexes as $index ) { |
— | — | @@ -677,7 +682,9 @@ |
678 | 683 | } |
679 | 684 | } |
680 | 685 | $sql .= ')'; |
681 | | - $this->query( $sql, $fname ); |
| 686 | + |
| 687 | + $this->doQuery( $sql);//, $fname ); |
| 688 | +*/ |
682 | 689 | } |
683 | 690 | |
684 | 691 | if ($sequenceData !== false && !isset($row[$sequenceData['column']])) |
— | — | @@ -972,12 +979,24 @@ |
973 | 980 | } |
974 | 981 | |
975 | 982 | function selectRow( $table, $vars, $conds, $fname = 'DatabaseOracle::selectRow', $options = array(), $join_conds = array() ) { |
| 983 | + global $wgLang; |
| 984 | + |
| 985 | + $conds2 = array(); |
| 986 | + foreach($conds as $col=>$val) { |
| 987 | + $col_type=$this->fieldInfo($this->tableName($table), $col)->type(); |
| 988 | + if ($col_type == 'CLOB') |
| 989 | + $conds2['TO_CHAR('.$col.')'] = $wgLang->checkTitleEncoding($val); |
| 990 | + else |
| 991 | + $conds2[$col] = $wgLang->checkTitleEncoding($val); |
| 992 | + } |
| 993 | + |
976 | 994 | if (is_array($table)) |
977 | 995 | foreach ($table as $tab) |
978 | 996 | $tab = $this->tableName($tab); |
979 | 997 | else |
980 | 998 | $table = $this->tableName($table); |
981 | | - return parent::selectRow($table, $vars, $conds, $fname, $options, $join_conds); |
| 999 | + |
| 1000 | + return parent::selectRow($table, $vars, $conds2, $fname, $options, $join_conds); |
982 | 1001 | } |
983 | 1002 | |
984 | 1003 | /** |
— | — | @@ -1018,14 +1037,15 @@ |
1019 | 1038 | } |
1020 | 1039 | |
1021 | 1040 | public function delete( $table, $conds, $fname = 'DatabaseOracle::delete' ) { |
| 1041 | + global $wgLang; |
1022 | 1042 | |
1023 | 1043 | $conds2 = array(); |
1024 | 1044 | foreach($conds as $col=>$val) { |
1025 | 1045 | $col_type=$this->fieldInfo($this->tableName($table), $col)->type(); |
1026 | 1046 | if ($col_type == 'CLOB') |
1027 | | - $conds2['TO_CHAR('.$col.')'] = $val; |
| 1047 | + $conds2['TO_CHAR('.$col.')'] = $wgLang->checkTitleEncoding($val); |
1028 | 1048 | else |
1029 | | - $conds2[$col] = $val; |
| 1049 | + $conds2[$col] = $wgLang->checkTitleEncoding($val); |
1030 | 1050 | } |
1031 | 1051 | |
1032 | 1052 | return parent::delete( $table, $conds2, $fname ); |