r58602 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r58601‎ | r58602 | r58603 >
Date:20:04, 5 November 2009
Author:freakolowsky
Status:ok
Tags:
Comment:
added encoding handlin on delete() and selectRow(), switched manual delete in replace() with a function call
Modified paths:
  • /trunk/phase3/includes/db/DatabaseOracle.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/db/DatabaseOracle.php
@@ -276,9 +276,9 @@
277277
278278 function doQuery($sql) {
279279 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+ }
283283
284284 //handle some oracle specifics
285285 //remove AS column/table/subquery namings
@@ -653,6 +653,11 @@
654654 foreach( $rows as $row ) {
655655 # Delete rows which collide
656656 if ( $uniqueIndexes ) {
 657+ $condsDelete = array();
 658+ foreach ( $uniqueIndexes as $index )
 659+ $condsDelete[$index] = $row[$index];
 660+ $this->delete( $table, $condsDelete, $fname);
 661+/*
657662 $sql = "DELETE FROM $table WHERE ";
658663 $first = true;
659664 foreach ( $uniqueIndexes as $index ) {
@@ -677,7 +682,9 @@
678683 }
679684 }
680685 $sql .= ')';
681 - $this->query( $sql, $fname );
 686+
 687+ $this->doQuery( $sql);//, $fname );
 688+*/
682689 }
683690
684691 if ($sequenceData !== false && !isset($row[$sequenceData['column']]))
@@ -972,12 +979,24 @@
973980 }
974981
975982 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+
976994 if (is_array($table))
977995 foreach ($table as $tab)
978996 $tab = $this->tableName($tab);
979997 else
980998 $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);
9821001 }
9831002
9841003 /**
@@ -1018,14 +1037,15 @@
10191038 }
10201039
10211040 public function delete( $table, $conds, $fname = 'DatabaseOracle::delete' ) {
 1041+ global $wgLang;
10221042
10231043 $conds2 = array();
10241044 foreach($conds as $col=>$val) {
10251045 $col_type=$this->fieldInfo($this->tableName($table), $col)->type();
10261046 if ($col_type == 'CLOB')
1027 - $conds2['TO_CHAR('.$col.')'] = $val;
 1047+ $conds2['TO_CHAR('.$col.')'] = $wgLang->checkTitleEncoding($val);
10281048 else
1029 - $conds2[$col] = $val;
 1049+ $conds2[$col] = $wgLang->checkTitleEncoding($val);
10301050 }
10311051
10321052 return parent::delete( $table, $conds2, $fname );

Status & tagging log