r59958 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r59957‎ | r59958 | r59959 >
Date:18:23, 11 December 2009
Author:ashley
Status:ok
Tags:
Comment:
more coding style cleanup to DatabaseOracle.php
Modified paths:
  • /trunk/phase3/includes/db/DatabaseOracle.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/db/DatabaseOracle.php
@@ -83,8 +83,9 @@
8484 }
8585
8686 public function fetchObject() {
87 - if ( $this->cursor >= $this->nrows )
 87+ if ( $this->cursor >= $this->nrows ) {
8888 return false;
 89+ }
8990 $row = $this->rows[$this->cursor++];
9091 $ret = new stdClass();
9192 foreach ( $row as $k => $v ) {
@@ -96,8 +97,9 @@
9798 }
9899
99100 public function fetchRow() {
100 - if ( $this->cursor >= $this->nrows )
 101+ if ( $this->cursor >= $this->nrows ) {
101102 return false;
 103+ }
102104
103105 $row = $this->rows[$this->cursor++];
104106 $ret = array();
@@ -168,9 +170,9 @@
169171 * @ingroup Database
170172 */
171173 class DatabaseOracle extends DatabaseBase {
172 - var $mInsertId = NULL;
173 - var $mLastResult = NULL;
174 - var $numeric_version = NULL;
 174+ var $mInsertId = null;
 175+ var $mLastResult = null;
 176+ var $numeric_version = null;
175177 var $lastResult = null;
176178 var $cursor = 0;
177179 var $mAffectedRows;
@@ -180,7 +182,7 @@
181183
182184 var $defaultCharset = 'AL32UTF8';
183185
184 - function DatabaseOracle( $server = false, $user = false, $password = false, $dbName = false,
 186+ function __construct( $server = false, $user = false, $password = false, $dbName = false,
185187 $failFunction = false, $flags = 0, $tablePrefix = 'get from global' )
186188 {
187189 $tablePrefix = $tablePrefix == 'get from global' ? $tablePrefix : strtoupper( $tablePrefix );
@@ -223,8 +225,6 @@
224226 if ( !function_exists( 'oci_connect' ) ) {
225227 throw new DBConnectionError( $this, "Oracle functions missing, have you compiled PHP with the --with-oci8 option?\n (Note: if you recently installed PHP, you may need to restart your webserver and database)\n" );
226228 }
227 -
228 - // putenv("NLS_LANG=AMERICAN_AMERICA.AL32UTF8");
229229
230230 $this->close();
231231 $this->mServer = $server;
@@ -232,15 +232,16 @@
233233 $this->mPassword = $password;
234234 $this->mDBname = $dbName;
235235
236 - if ( !strlen( $user ) ) { # # e.g. the class is being loaded
237 - return;
 236+ if ( !strlen( $user ) ) { # e.g. the class is being loaded
 237+ return;
238238 }
239239
240240 $session_mode = $this->mFlags & DBO_SYSDBA ? OCI_SYSDBA : OCI_DEFAULT;
241 - if ( $this->mFlags & DBO_DEFAULT )
 241+ if ( $this->mFlags & DBO_DEFAULT ) {
242242 $this->mConn = oci_new_connect( $user, $password, $dbName, $this->defaultCharset, $session_mode );
243 - else
 243+ } else {
244244 $this->mConn = oci_connect( $user, $password, $dbName, $this->defaultCharset, $session_mode );
 245+ }
245246
246247 if ( $this->mConn == false ) {
247248 wfDebug( "DB connection error\n" );
@@ -282,8 +283,9 @@
283284
284285 // handle some oracle specifics
285286 // remove AS column/table/subquery namings
286 - if ( !defined( 'MEDIAWIKI_INSTALL' ) )
 287+ if ( !defined( 'MEDIAWIKI_INSTALL' ) ) {
287288 $sql = preg_replace( '/ as /i', ' ', $sql );
 289+ }
288290 // Oracle has issues with UNION clause if the statement includes LOB fields
289291 // So we do a UNION ALL and then filter the results array with array_unique
290292 $union_unique = ( preg_match( '/\/\* UNION_UNIQUE \*\/ /', $sql ) != 0 );
@@ -306,14 +308,15 @@
307309 $olderr = error_reporting( E_ERROR );
308310 if ( oci_execute( $stmt, $this->execFlags() ) == false ) {
309311 $e = oci_error( $stmt );
310 - if ( !$this->ignore_DUP_VAL_ON_INDEX || $e['code'] != '1' )
 312+ if ( !$this->ignore_DUP_VAL_ON_INDEX || $e['code'] != '1' ) {
311313 $this->reportQueryError( $e['message'], $e['code'], $sql, __FUNCTION__ );
 314+ }
312315 }
313316 error_reporting( $olderr );
314317
315318 if ( $explain_count > 0 ) {
316319 return $this->doQuery( 'SELECT id, cardinality "ROWS" FROM plan_table WHERE statement_id = \'' . $explain_id . '\'' );
317 - } elseif ( oci_statement_type( $stmt ) == "SELECT" ) {
 320+ } elseif ( oci_statement_type( $stmt ) == 'SELECT' ) {
318321 return new ORAResult( $this, $stmt, $union_unique );
319322 } else {
320323 $this->mAffectedRows = oci_num_rows( $stmt );
@@ -385,18 +388,20 @@
386389 }
387390
388391 function lastError() {
389 - if ( $this->mConn === false )
 392+ if ( $this->mConn === false ) {
390393 $e = oci_error();
391 - else
 394+ } else {
392395 $e = oci_error( $this->mConn );
 396+ }
393397 return $e['message'];
394398 }
395399
396400 function lastErrno() {
397 - if ( $this->mConn === false )
 401+ if ( $this->mConn === false ) {
398402 $e = oci_error();
399 - else
 403+ } else {
400404 $e = oci_error( $this->mConn );
 405+ }
401406 return $e['code'];
402407 }
403408
@@ -412,19 +417,22 @@
413418 return false;
414419 }
415420
416 - function indexUnique ( $table, $index, $fname = 'DatabaseOracle::indexUnique' ) {
 421+ function indexUnique( $table, $index, $fname = 'DatabaseOracle::indexUnique' ) {
417422 return false;
418423 }
419424
420425 function insert( $table, $a, $fname = 'DatabaseOracle::insert', $options = array() ) {
421 - if ( !count( $a ) )
 426+ if ( !count( $a ) ) {
422427 return true;
 428+ }
423429
424 - if ( !is_array( $options ) )
 430+ if ( !is_array( $options ) ) {
425431 $options = array( $options );
 432+ }
426433
427 - if ( in_array( 'IGNORE', $options ) )
 434+ if ( in_array( 'IGNORE', $options ) ) {
428435 $this->ignore_DUP_VAL_ON_INDEX = true;
 436+ }
429437
430438 if ( !is_array( reset( $a ) ) ) {
431439 $a = array( $a );
@@ -435,8 +443,9 @@
436444 }
437445 $retVal = true;
438446
439 - if ( in_array( 'IGNORE', $options ) )
 447+ if ( in_array( 'IGNORE', $options ) ) {
440448 $this->ignore_DUP_VAL_ON_INDEX = false;
 449+ }
441450
442451 return $retVal;
443452 }
@@ -451,38 +460,41 @@
452461 // for each value, append ":key"
453462 $first = true;
454463 foreach ( $row as $col => $val ) {
455 - if ( $first )
456 - $sql .= $val !== NULL ? ':' . $col : 'NULL';
457 - else
458 - $sql .= $val !== NULL ? ', :' . $col : ', NULL';
 464+ if ( $first ) {
 465+ $sql .= $val !== null ? ':' . $col : 'NULL';
 466+ } else {
 467+ $sql .= $val !== null ? ', :' . $col : ', NULL';
 468+ }
459469
460470 $first = false;
461471 }
462472 $sql .= ')';
463473
464 -
465474 $stmt = oci_parse( $this->mConn, $sql );
466475 foreach ( $row as $col => &$val ) {
467476 $col_type = $this->fieldInfo( $this->tableName( $table ), $col )->type();
468 -
469 - if ( $val === NULL ) {
 477+
 478+ if ( $val === null ) {
470479 // do nothing ... null was inserted in statement creation
471480 } elseif ( $col_type != 'BLOB' && $col_type != 'CLOB' ) {
472 - if ( is_object( $val ) )
 481+ if ( is_object( $val ) ) {
473482 $val = $val->getData();
474 -
475 - if ( preg_match( '/^timestamp.*/i', $col_type ) == 1 && strtolower( $val ) == 'infinity' )
 483+ }
 484+
 485+ if ( preg_match( '/^timestamp.*/i', $col_type ) == 1 && strtolower( $val ) == 'infinity' ) {
476486 $val = '31-12-2030 12:00:00.000000';
 487+ }
477488
478489 $val = ( $wgLang != null ) ? $wgLang->checkTitleEncoding( $val ) : $val;
479 - if ( oci_bind_by_name( $stmt, ":$col", $val ) === false )
 490+ if ( oci_bind_by_name( $stmt, ":$col", $val ) === false ) {
480491 $this->reportQueryError( $this->lastErrno(), $this->lastError(), $sql, __METHOD__ );
 492+ }
481493 } else {
482494 if ( ( $lob[$col] = oci_new_descriptor( $this->mConn, OCI_D_LOB ) ) === false ) {
483495 $e = oci_error( $stmt );
484496 throw new DBUnexpectedError( $this, "Cannot create LOB descriptor: " . $e['message'] );
485497 }
486 -
 498+
487499 if ( $col_type == 'BLOB' ) { // is_object($val)) {
488500 $lob[$col]->writeTemporary( $val ); // ->getData());
489501 oci_bind_by_name( $stmt, ":$col", $lob[$col], - 1, SQLT_BLOB );
@@ -497,12 +509,14 @@
498510 if ( oci_execute( $stmt, OCI_DEFAULT ) === false ) {
499511 $e = oci_error( $stmt );
500512
501 - if ( !$this->ignore_DUP_VAL_ON_INDEX || $e['code'] != '1' )
 513+ if ( !$this->ignore_DUP_VAL_ON_INDEX || $e['code'] != '1' ) {
502514 $this->reportQueryError( $e['message'], $e['code'], $sql, __METHOD__ );
503 - else
 515+ } else {
504516 $this->mAffectedRows = oci_num_rows( $stmt );
505 - } else
 517+ }
 518+ } else {
506519 $this->mAffectedRows = oci_num_rows( $stmt );
 520+ }
507521 error_reporting( $olderr );
508522
509523 if ( isset( $lob ) ) {
@@ -511,9 +525,10 @@
512526 }
513527 }
514528
515 - if ( !$this->mTrxLevel )
 529+ if ( !$this->mTrxLevel ) {
516530 oci_commit( $this->mConn );
517 -
 531+ }
 532+
518533 oci_free_statement( $stmt );
519534 }
520535
@@ -537,8 +552,9 @@
538553
539554 // count-alias subselect fields to avoid abigious definition errors
540555 $i = 0;
541 - foreach ( $varMap as $key => &$val )
 556+ foreach ( $varMap as $key => &$val ) {
542557 $val = $val . ' field' . ( $i++ );
 558+ }
543559
544560 $sql = "INSERT INTO $destTable (" . implode( ',', array_keys( $varMap ) ) . ')' .
545561 " SELECT $startOpts " . implode( ',', $varMap ) .
@@ -548,14 +564,16 @@
549565 }
550566 $sql .= " $tailOpts";
551567
552 - if ( in_array( 'IGNORE', $insertOptions ) )
 568+ if ( in_array( 'IGNORE', $insertOptions ) ) {
553569 $this->ignore_DUP_VAL_ON_INDEX = true;
 570+ }
554571
555572 $retval = $this->query( $sql, $fname );
556573
557 - if ( in_array( 'IGNORE', $insertOptions ) )
 574+ if ( in_array( 'IGNORE', $insertOptions ) ) {
558575 $this->ignore_DUP_VAL_ON_INDEX = false;
559 -
 576+ }
 577+
560578 return $retval;
561579 }
562580
@@ -563,46 +581,58 @@
564582 global $wgSharedDB, $wgSharedPrefix, $wgSharedTables;
565583 /*
566584 Replace reserved words with better ones
567 - Useing uppercase, because that's the only way oracle can handle
 585+ Using uppercase because that's the only way Oracle can handle
568586 quoted tablenames
569587 */
570588 switch( $name ) {
571589 case 'user':
572 - $name = 'MWUSER'; break;
 590+ $name = 'MWUSER';
 591+ break;
573592 case 'text':
574 - $name = 'PAGECONTENT'; break;
 593+ $name = 'PAGECONTENT';
 594+ break;
575595 }
576596
577597 /*
578598 The rest of procedure is equal to generic Databse class
579599 except for the quoting style
580600 */
581 - if ( $name[0] == '"' && substr( $name, - 1, 1 ) == '"' ) return $name;
 601+ if ( $name[0] == '"' && substr( $name, - 1, 1 ) == '"' ) {
 602+ return $name;
 603+ }
582604
583 - if ( preg_match( '/(^|\s)(DISTINCT|JOIN|ON|AS)(\s|$)/i', $name ) !== 0 ) return $name;
 605+ if ( preg_match( '/(^|\s)(DISTINCT|JOIN|ON|AS)(\s|$)/i', $name ) !== 0 ) {
 606+ return $name;
 607+ }
584608 $dbDetails = array_reverse( explode( '.', $name, 2 ) );
585 - if ( isset( $dbDetails[1] ) ) @list( $table, $database ) = $dbDetails;
586 - else @list( $table ) = $dbDetails;
587 -
 609+ if ( isset( $dbDetails[1] ) ) {
 610+ @list( $table, $database ) = $dbDetails;
 611+ } else {
 612+ @list( $table ) = $dbDetails;
 613+ }
 614+
588615 $prefix = $this->mTablePrefix;
589616
590 - if ( isset( $database ) ) $table = ( $table[0] == '`' ? $table : "`{$table}`" );
591 -
592 - if ( !isset( $database )
593 - && isset( $wgSharedDB )
594 - && $table[0] != '"'
595 - && isset( $wgSharedTables )
596 - && is_array( $wgSharedTables )
597 - && in_array( $table, $wgSharedTables ) ) {
 617+ if ( isset( $database ) ) {
 618+ $table = ( $table[0] == '`' ? $table : "`{$table}`" );
 619+ }
 620+
 621+ if ( !isset( $database ) && isset( $wgSharedDB ) && $table[0] != '"'
 622+ && isset( $wgSharedTables )
 623+ && is_array( $wgSharedTables )
 624+ && in_array( $table, $wgSharedTables )
 625+ ) {
598626 $database = $wgSharedDB;
599627 $prefix = isset( $wgSharedPrefix ) ? $wgSharedPrefix : $prefix;
600628 }
601 -
602 - if ( isset( $database ) ) $database = ( $database[0] == '"' ? $database : "\"{$database}\"" );
 629+
 630+ if ( isset( $database ) ) {
 631+ $database = ( $database[0] == '"' ? $database : "\"{$database}\"" );
 632+ }
603633 $table = ( $table[0] == '"' ? $table : "\"{$prefix}{$table}\"" );
604 -
 634+
605635 $tableName = ( isset( $database ) ? "{$database}.{$table}" : "{$table}" );
606 -
 636+
607637 return strtoupper( $tableName );
608638 }
609639
@@ -621,17 +651,20 @@
622652 * Return sequence_name if table has a sequence
623653 */
624654 function getSequenceData( $table ) {
625 - if ( $this->sequenceData == NULL ) {
 655+ if ( $this->sequenceData == null ) {
626656 $result = $this->query( "SELECT lower(us.sequence_name), lower(utc.table_name), lower(utc.column_name) from user_sequences us, user_tab_columns utc where us.sequence_name = utc.table_name||'_'||utc.column_name||'_SEQ'" );
627657
628 - while ( ( $row = $result->fetchRow() ) !== false )
629 - $this->sequenceData[$this->tableName( $row[1] )] = array( 'sequence' => $row[0], 'column' => $row[2] );
 658+ while ( ( $row = $result->fetchRow() ) !== false ) {
 659+ $this->sequenceData[$this->tableName( $row[1] )] = array(
 660+ 'sequence' => $row[0],
 661+ 'column' => $row[2]
 662+ );
 663+ }
630664 }
631 -
 665+
632666 return ( isset( $this->sequenceData[$table] ) ) ? $this->sequenceData[$table] : false;
633667 }
634668
635 -
636669 # REPLACE query wrapper
637670 # Oracle simulates this with a DELETE followed by INSERT
638671 # $row is the row to insert, an associative array
@@ -692,8 +725,9 @@
693726 */
694727 }
695728
696 - if ( $sequenceData !== false && !isset( $row[$sequenceData['column']] ) )
 729+ if ( $sequenceData !== false && !isset( $row[$sequenceData['column']] ) ) {
697730 $row[$sequenceData['column']] = $this->nextSequenceValue( $sequenceData['sequence'] );
 731+ }
698732
699733 # Now insert the row
700734 $this->insert( $table, $row, $fname );
@@ -736,8 +770,9 @@
737771 }
738772
739773 function limitResult( $sql, $limit, $offset = false ) {
740 - if ( $offset === false )
 774+ if ( $offset === false ) {
741775 $offset = 0;
 776+ }
742777 return "SELECT * FROM ($sql) WHERE rownum >= (1 + $offset) AND rownum < (1 + $limit + $offset)";
743778 }
744779
@@ -777,17 +812,16 @@
778813 if ( $ignore || $tempIgnore ) {
779814 wfDebug( "SQL ERROR (ignored): $error\n" );
780815 $this->ignoreErrors( $ignore );
 816+ } else {
 817+ throw new DBQueryError( $this, $error, $errno, $sql, $fname );
781818 }
782 - else {
783 - throw new DBQueryError($this, $error, $errno, $sql, $fname);
784 - }
785819 }
786820
787821 /**
788822 * @return string wikitext of a link to the server software's web site
789823 */
790824 function getSoftwareLink() {
791 - return "[http://www.oracle.com/ Oracle]";
 825+ return '[http://www.oracle.com/ Oracle]';
792826 }
793827
794828 /**
@@ -817,8 +851,9 @@
818852 * based on prebuilt table to simulate MySQL field info and keep query speed minimal
819853 */
820854 function fieldExists( $table, $field, $fname = 'DatabaseOracle::fieldExists' ) {
821 - if ( !isset( $this->fieldInfo_stmt ) )
 855+ if ( !isset( $this->fieldInfo_stmt ) ) {
822856 $this->fieldInfo_stmt = oci_parse( $this->mConn, 'SELECT * FROM wiki_field_info_full WHERE table_name = upper(:tab) and column_name = UPPER(:col)' );
 857+ }
823858
824859 oci_bind_by_name( $this->fieldInfo_stmt, ':tab', trim( $table, '"' ) );
825860 oci_bind_by_name( $this->fieldInfo_stmt, ':col', $field );
@@ -833,8 +868,9 @@
834869 }
835870
836871 function fieldInfo( $table, $field ) {
837 - if ( !isset( $this->fieldInfo_stmt ) )
 872+ if ( !isset( $this->fieldInfo_stmt ) ) {
838873 $this->fieldInfo_stmt = oci_parse( $this->mConn, 'SELECT * FROM wiki_field_info_full WHERE table_name = upper(:tab) and column_name = UPPER(:col)' );
 874+ }
839875
840876 $table = trim( $table, '"' );
841877 oci_bind_by_name( $this->fieldInfo_stmt, ':tab', $table );
@@ -852,9 +888,11 @@
853889 function begin( $fname = '' ) {
854890 $this->mTrxLevel = 1;
855891 }
 892+
856893 function immediateCommit( $fname = '' ) {
857894 return true;
858895 }
 896+
859897 function commit( $fname = '' ) {
860898 oci_commit( $this->mConn );
861899 $this->mTrxLevel = 0;
@@ -867,7 +905,7 @@
868906
869907 /* defines must comply with ^define\s*([^\s=]*)\s*=\s?'\{\$([^\}]*)\}'; */
870908 function sourceStream( $fp, $lineCallback = false, $resultCallback = false ) {
871 - $cmd = "";
 909+ $cmd = '';
872910 $done = false;
873911 $dollarquote = false;
874912
@@ -880,27 +918,31 @@
881919 $line = trim( fgets( $fp, 1024 ) );
882920 $sl = strlen( $line ) - 1;
883921
884 - if ( $sl < 0 ) { continue; }
885 - if ( '-' == $line { 0 } && '-' == $line { 1 } ) { continue; }
 922+ if ( $sl < 0 ) {
 923+ continue;
 924+ }
 925+ if ( '-' == $line { 0 } && '-' == $line { 1 } ) {
 926+ continue;
 927+ }
886928
887929 // Allow dollar quoting for function declarations
888930 if ( substr( $line, 0, 8 ) == '/*$mw$*/' ) {
889931 if ( $dollarquote ) {
890932 $dollarquote = false;
891933 $done = true;
892 - }
893 - else {
 934+ } else {
894935 $dollarquote = true;
895936 }
896 - }
897 - else if ( !$dollarquote ) {
 937+ } elseif ( !$dollarquote ) {
898938 if ( ';' == $line { $sl } && ( $sl < 2 || ';' != $line { $sl - 1 } ) ) {
899939 $done = true;
900940 $line = substr( $line, 0, $sl );
901941 }
902942 }
903943
904 - if ( '' != $cmd ) { $cmd .= ' '; }
 944+ if ( '' != $cmd ) {
 945+ $cmd .= ' ';
 946+ }
905947 $cmd .= "$line\n";
906948
907949 if ( $done ) {
@@ -919,7 +961,7 @@
920962 if ( $resultCallback ) {
921963 call_user_func( $resultCallback, $res, $this );
922964 }
923 -
 965+
924966 if ( false === $res ) {
925967 $err = $this->lastError();
926968 return "Query \"{$cmd}\" failed with error code \"$err\".\n";
@@ -935,20 +977,20 @@
936978
937979 function setup_database() {
938980 global $wgVersion, $wgDBmwschema, $wgDBts2schema, $wgDBport, $wgDBuser;
939 -
 981+
940982 echo "<li>Creating DB objects</li>\n";
941983 $res = $this->sourceFile( "../maintenance/ora/tables.sql" );
942 -
 984+
943985 // Avoid the non-standard "REPLACE INTO" syntax
944986 echo "<li>Populating table interwiki</li>\n";
945987 $f = fopen( "../maintenance/interwiki.sql", 'r' );
946988 if ( $f == false ) {
947989 dieout( "<li>Could not find the interwiki.sql file</li>" );
948990 }
949 -
 991+
950992 // do it like the postgres :D
951993 $SQL = "INSERT INTO interwiki(iw_prefix,iw_url,iw_local) VALUES ";
952 - while ( ! feof( $f ) ) {
 994+ while ( !feof( $f ) ) {
953995 $line = fgets( $f, 1024 );
954996 $matches = array();
955997 if ( !preg_match( '/^\s*(\(.+?),(\d)\)/', $line, $matches ) ) {
@@ -974,8 +1016,9 @@
9751017 */
9761018 function addQuotes( $s ) {
9771019 global $wgLang;
978 - if ( isset( $wgLang->mLoaded ) && $wgLang->mLoaded )
 1020+ if ( isset( $wgLang->mLoaded ) && $wgLang->mLoaded ) {
9791021 $s = $wgLang->checkTitleEncoding( $s );
 1022+ }
9801023 return "'" . $this->strencode( $s ) . "'";
9811024 }
9821025
@@ -989,20 +1032,22 @@
9901033 $conds2 = array();
9911034 foreach ( $conds as $col => $val ) {
9921035 $col_type = $this->fieldInfo( $this->tableName( $table ), $col )->type();
993 - if ( $col_type == 'CLOB' )
 1036+ if ( $col_type == 'CLOB' ) {
9941037 $conds2['TO_CHAR(' . $col . ')'] = $wgLang->checkTitleEncoding( $val );
995 - elseif ( $col_type == 'VARCHAR2' && !mb_check_encoding( $val ) ) {
 1038+ } elseif ( $col_type == 'VARCHAR2' && !mb_check_encoding( $val ) ) {
9961039 $conds2[$col] = $wgLang->checkTitleEncoding( $val );
9971040 } else {
9981041 $conds2[$col] = $val;
9991042 }
10001043 }
10011044
1002 - if ( is_array( $table ) )
1003 - foreach ( $table as $tab )
 1045+ if ( is_array( $table ) ) {
 1046+ foreach ( $table as $tab ) {
10041047 $tab = $this->tableName( $tab );
1005 - else
 1048+ }
 1049+ } else {
10061050 $table = $this->tableName( $table );
 1051+ }
10071052
10081053 return parent::selectRow( $table, $vars, $conds2, $fname, $options, $join_conds );
10091054 }
@@ -1028,12 +1073,18 @@
10291074 }
10301075 }
10311076
1032 - if ( isset( $options['GROUP BY'] ) ) $preLimitTail .= " GROUP BY {$options['GROUP BY']}";
1033 - if ( isset( $options['ORDER BY'] ) ) $preLimitTail .= " ORDER BY {$options['ORDER BY']}";
 1077+ if ( isset( $options['GROUP BY'] ) ) {
 1078+ $preLimitTail .= " GROUP BY {$options['GROUP BY']}";
 1079+ }
 1080+ if ( isset( $options['ORDER BY'] ) ) {
 1081+ $preLimitTail .= " ORDER BY {$options['ORDER BY']}";
 1082+ }
10341083
10351084 # if ( isset( $noKeyOptions['FOR UPDATE'] ) ) $tailOpts .= ' FOR UPDATE';
10361085 # if ( isset( $noKeyOptions['LOCK IN SHARE MODE'] ) ) $tailOpts .= ' LOCK IN SHARE MODE';
1037 - if ( isset( $noKeyOptions['DISTINCT'] ) || isset( $noKeyOptions['DISTINCTROW'] ) ) $startOpts .= 'DISTINCT';
 1086+ if ( isset( $noKeyOptions['DISTINCT'] ) || isset( $noKeyOptions['DISTINCTROW'] ) ) {
 1087+ $startOpts .= 'DISTINCT';
 1088+ }
10381089
10391090 if ( isset( $options['USE INDEX'] ) && ! is_array( $options['USE INDEX'] ) ) {
10401091 $useIndex = $this->useIndexClause( $options['USE INDEX'] );
@@ -1051,20 +1102,24 @@
10521103 $conds2 = array();
10531104 foreach ( $conds as $col => $val ) {
10541105 $col_type = $this->fieldInfo( $this->tableName( $table ), $col )->type();
1055 - if ( $col_type == 'CLOB' )
 1106+ if ( $col_type == 'CLOB' ) {
10561107 $conds2['TO_CHAR(' . $col . ')'] = $wgLang->checkTitleEncoding( $val );
1057 - else
 1108+ } else {
10581109 if ( is_array( $val ) ) {
10591110 $conds2[$col] = $val;
1060 - foreach ( $conds2[$col] as &$val2 )
 1111+ foreach ( $conds2[$col] as &$val2 ) {
10611112 $val2 = $wgLang->checkTitleEncoding( $val2 );
 1113+ }
10621114 } else {
10631115 $conds2[$col] = $wgLang->checkTitleEncoding( $val );
10641116 }
 1117+ }
10651118 }
1066 -
 1119+
10671120 return parent::delete( $table, $conds2, $fname );
1068 - } else return parent::delete( $table, $conds, $fname );
 1121+ } else {
 1122+ return parent::delete( $table, $conds, $fname );
 1123+ }
10691124 }
10701125
10711126 function bitNot( $field ) {
@@ -1122,6 +1177,6 @@
11231178 }
11241179
11251180 public function getSearchEngine() {
1126 - return "SearchOracle";
 1181+ return 'SearchOracle';
11271182 }
11281183 } // end DatabaseOracle class

Status & tagging log