r72233 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r72232‎ | r72233 | r72234 >
Date:21:43, 2 September 2010
Author:ashley
Status:ok
Tags:
Comment:
trim trailing whitespace
Modified paths:
  • /trunk/phase3/includes/db/DatabaseIbm_db2.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/db/DatabaseIbm_db2.php
@@ -21,7 +21,7 @@
2222 private $max_length = 0;
2323
2424 /**
25 - * Builder method for the class
 25+ * Builder method for the class
2626 * @param $db DatabaseIbm_db2: Database interface
2727 * @param $table String: table name
2828 * @param $field String: column name
@@ -93,7 +93,7 @@
9494 public function getData() {
9595 return $this->mData;
9696 }
97 -
 97+
9898 public function __toString()
9999 {
100100 return $this->mData;
@@ -122,7 +122,7 @@
123123 protected $mFakeSlaveLag = null, $mFakeMaster = false;
124124 *
125125 */
126 -
 126+
127127 /** Database server port */
128128 protected $mPort = null;
129129 /** Schema for tables, stored procedures, triggers */
@@ -135,37 +135,37 @@
136136 protected $mAffectedRows = null;
137137 /** Number of rows returned by last SELECT */
138138 protected $mNumRows = null;
139 -
 139+
140140 /** Connection config options - see constructor */
141141 public $mConnOptions = array();
142142 /** Statement config options -- see constructor */
143143 public $mStmtOptions = array();
144 -
 144+
145145 /** Default schema */
146146 const USE_GLOBAL = "mediawiki";
147 -
 147+
148148 /** Option that applies to nothing */
149149 const NONE_OPTION = 0x00;
150150 /** Option that applies to connection objects */
151151 const CONN_OPTION = 0x01;
152152 /** Option that applies to statement objects */
153153 const STMT_OPTION = 0x02;
154 -
 154+
155155 /** Regular operation mode -- minimal debug messages */
156156 const REGULAR_MODE = 'regular';
157157 /** Installation mode -- lots of debug messages */
158158 const INSTALL_MODE = 'install';
159 -
 159+
160160 /** Controls the level of debug message output */
161161 protected $mMode = self::REGULAR_MODE;
162 -
 162+
163163 /** Last sequence value used for a primary key */
164164 protected $mInsertId = null;
165 -
 165+
166166 ######################################
167167 # Getters and Setters
168168 ######################################
169 -
 169+
170170 /**
171171 * Returns true if this database supports (and uses) cascading deletes
172172 */
@@ -189,7 +189,7 @@
190190 function strictIPs() {
191191 return true;
192192 }
193 -
 193+
194194 /**
195195 * Returns true if this database uses timestamps rather than integers
196196 */
@@ -227,7 +227,7 @@
228228 function functionalIndexes() {
229229 return true;
230230 }
231 -
 231+
232232 /**
233233 * Returns a unique string representing the wiki on the server
234234 */
@@ -242,14 +242,14 @@
243243 function getType() {
244244 return 'ibm_db2';
245245 }
246 -
 246+
247247 ######################################
248248 # Setup
249249 ######################################
250 -
251 -
 250+
 251+
252252 /**
253 - *
 253+ *
254254 * @param $server String: hostname of database server
255255 * @param $user String: username
256256 * @param $password String: password
@@ -272,14 +272,14 @@
273273 $this->mOut =& $wgOut;
274274 $this->mFailFunction = $failFunction;
275275 $this->mFlags = DBO_TRX | $flags;
276 -
 276+
277277 if ( $schema == self::USE_GLOBAL ) {
278278 $this->mSchema = $wgDBmwschema;
279279 }
280280 else {
281281 $this->mSchema = $schema;
282282 }
283 -
 283+
284284 // configure the connection and statement objects
285285 $this->setDB2Option( 'db2_attr_case', 'DB2_CASE_LOWER',
286286 self::CONN_OPTION | self::STMT_OPTION );
@@ -287,10 +287,10 @@
288288 self::STMT_OPTION );
289289 $this->setDB2Option( 'rowcount', 'DB2_ROWCOUNT_PREFETCH_ON',
290290 self::STMT_OPTION );
291 -
 291+
292292 $this->open( $server, $user, $password, $dbName );
293293 }
294 -
 294+
295295 /**
296296 * Enables options only if the ibm_db2 extension version supports them
297297 * @param $name String: name of the option in the options array
@@ -311,7 +311,7 @@
312312 "$const is not defined. ibm_db2 version is likely too low." );
313313 }
314314 }
315 -
 315+
316316 /**
317317 * Outputs debug information in the appropriate place
318318 * @param $string String: the relevant debug message
@@ -321,9 +321,9 @@
322322 if ( $this->mMode == self::INSTALL_MODE ) {
323323 print "<li><pre>$string</pre></li>";
324324 flush();
325 - }
 325+ }
326326 }
327 -
 327+
328328 /**
329329 * Opens a database connection and returns it
330330 * Closes any existing connection
@@ -338,7 +338,7 @@
339339 // Load the port number
340340 global $wgDBport;
341341 wfProfileIn( __METHOD__ );
342 -
 342+
343343 // Load IBM DB2 driver if missing
344344 wfDl( 'ibm_db2' );
345345
@@ -355,7 +355,7 @@
356356 if ( strlen( $user ) < 1) {
357357 return null;
358358 }
359 -
 359+
360360 // Close existing connection
361361 $this->close();
362362 // Cache conn info
@@ -364,9 +364,9 @@
365365 $this->mUser = $user;
366366 $this->mPassword = $password;
367367 $this->mDBname = $dbName;
368 -
 368+
369369 $this->openUncataloged( $dbName, $user, $password, $server, $port );
370 -
 370+
371371 // Apply connection config
372372 db2_set_option( $this->mConn, $this->mConnOptions, 1 );
373373 // Some MediaWiki code is still transaction-less (?).
@@ -385,11 +385,11 @@
386386
387387 $this->mOpened = true;
388388 $this->applySchema();
389 -
 389+
390390 wfProfileOut( __METHOD__ );
391391 return $this->mConn;
392392 }
393 -
 393+
394394 /**
395395 * Opens a cataloged database connection, sets mConn
396396 */
@@ -397,7 +397,7 @@
398398 {
399399 @$this->mConn = db2_pconnect( $dbName, $user, $password );
400400 }
401 -
 401+
402402 /**
403403 * Opens an uncataloged database connection, sets mConn
404404 */
@@ -411,10 +411,10 @@
412412 $str .= "PROTOCOL=TCPIP;";
413413 $str .= "UID=$user;";
414414 $str .= "PWD=$password;";
415 -
 415+
416416 @$this->mConn = db2_pconnect( $str, $user, $password );
417417 }
418 -
 418+
419419 /**
420420 * Closes a database connection, if it is open
421421 * Returns success, true if already closed
@@ -431,7 +431,7 @@
432432 return true;
433433 }
434434 }
435 -
 435+
436436 /**
437437 * Returns a fresh instance of this class
438438 *
@@ -449,7 +449,7 @@
450450 return new DatabaseIbm_db2( $server, $user, $password, $dbName,
451451 $failFunction, $flags );
452452 }
453 -
 453+
454454 /**
455455 * Retrieves the most current database error
456456 * Forces a database rollback
@@ -465,10 +465,10 @@
466466 //$this->rollback();
467467 return $stmterr;
468468 }
469 -
 469+
470470 return false;
471471 }
472 -
 472+
473473 /**
474474 * Get the last error number
475475 * Return 0 if no error
@@ -485,13 +485,13 @@
486486 }
487487 return 0;
488488 }
489 -
 489+
490490 /**
491491 * Is a database connection open?
492 - * @return
 492+ * @return
493493 */
494494 public function isOpen() { return $this->mOpened; }
495 -
 495+
496496 /**
497497 * The DBMS-dependent part of query()
498498 * @param $sql String: SQL query.
@@ -501,7 +501,7 @@
502502 /*private*/
503503 public function doQuery( $sql ) {
504504 $this->applySchema();
505 -
 505+
506506 $ret = db2_exec( $this->mConn, $sql, $this->mStmtOptions );
507507 if( $ret == FALSE ) {
508508 $error = db2_stmt_errormsg();
@@ -514,7 +514,7 @@
515515 $this->mAffectedRows = null; // Not calculated until asked for
516516 return $ret;
517517 }
518 -
 518+
519519 /**
520520 * @return string Version information from the database
521521 */
@@ -522,7 +522,7 @@
523523 $info = db2_server_info( $this->mConn );
524524 return $info->DBMS_VER;
525525 }
526 -
 526+
527527 /**
528528 * Queries whether a given table exists
529529 * @return boolean
@@ -535,17 +535,17 @@
536536 EOF;
537537 $res = $this->query( $sql );
538538 if ( !$res ) return false;
539 -
 539+
540540 // If the table exists, there should be one of it
541541 @$row = $this->fetchRow( $res );
542542 $count = $row[0];
543543 if ( $count == '1' or $count == 1 ) {
544544 return true;
545545 }
546 -
 546+
547547 return false;
548548 }
549 -
 549+
550550 /**
551551 * Fetch the next row from the given result object, in object form.
552552 * Fields can be retrieved with $row->fieldname, with fields acting like
@@ -586,25 +586,25 @@
587587 }
588588 return $row;
589589 }
590 -
 590+
591591 /**
592592 * Override if introduced to base Database class
593593 */
594594 public function initial_setup() {
595595 // do nothing
596596 }
597 -
 597+
598598 /**
599599 * Create tables, stored procedures, and so on
600600 */
601601 public function setup_database() {
602602 try {
603603 // TODO: switch to root login if available
604 -
 604+
605605 // Switch into the correct namespace
606606 $this->applySchema();
607607 $this->begin();
608 -
 608+
609609 $res = $this->sourceFile( "../maintenance/ibm_db2/tables.sql" );
610610 if ( $res !== true ) {
611611 print " <b>FAILED</b>: " . htmlspecialchars( $res ) . "</li>";
@@ -618,16 +618,16 @@
619619 print "<li>Foreign keys done</li>";
620620 }
621621 $res = null;
622 -
 622+
623623 // TODO: populate interwiki links
624 -
 624+
625625 if ( $this->lastError() ) {
626626 $this->installPrint(
627627 "Errors encountered during table creation -- rolled back" );
628628 $this->installPrint( "Please install again" );
629629 $this->rollback();
630630 }
631 - else {
 631+ else {
632632 $this->commit();
633633 }
634634 }
@@ -660,7 +660,7 @@
661661 return "'$s'";
662662 }
663663 }
664 -
 664+
665665 /**
666666 * Verifies that a DB2 column/field type is numeric
667667 * @return bool true if numeric
@@ -680,7 +680,7 @@
681681 }
682682 return false;
683683 }
684 -
 684+
685685 /**
686686 * Alias for addQuotes()
687687 * @param $s String: string to escape
@@ -688,7 +688,7 @@
689689 */
690690 public function strencode( $s ) {
691691 // Bloody useless function
692 - // Prepends backslashes to \x00, \n, \r, \, ', " and \x1a.
 692+ // Prepends backslashes to \x00, \n, \r, \, ', " and \x1a.
693693 // But also necessary
694694 $s = db2_escape_string( $s );
695695 // Wide characters are evil -- some of them look like '
@@ -699,7 +699,7 @@
700700 $s = str_replace( $from, $to, $s ); // DB2 expects '', not \' escaping
701701 return $s;
702702 }
703 -
 703+
704704 /**
705705 * Switch into the database schema
706706 */
@@ -709,39 +709,39 @@
710710 $this->begin();
711711 $this->doQuery( "SET SCHEMA = $this->mSchema" );
712712 $this->commit();
713 - }
 713+ }
714714 }
715 -
 715+
716716 /**
717717 * Start a transaction (mandatory)
718718 */
719719 public function begin( $fname = 'DatabaseIbm_db2::begin' ) {
720720 // BEGIN is implicit for DB2
721721 // However, it requires that AutoCommit be off.
722 -
 722+
723723 // Some MediaWiki code is still transaction-less (?).
724724 // The strategy is to keep AutoCommit on for that code
725725 // but switch it off whenever a transaction is begun.
726726 db2_autocommit( $this->mConn, DB2_AUTOCOMMIT_OFF );
727 -
 727+
728728 $this->mTrxLevel = 1;
729729 }
730 -
 730+
731731 /**
732732 * End a transaction
733733 * Must have a preceding begin()
734734 */
735735 public function commit( $fname = 'DatabaseIbm_db2::commit' ) {
736736 db2_commit( $this->mConn );
737 -
 737+
738738 // Some MediaWiki code is still transaction-less (?).
739739 // The strategy is to keep AutoCommit on for that code
740740 // but switch it off whenever a transaction is begun.
741741 db2_autocommit( $this->mConn, DB2_AUTOCOMMIT_ON );
742 -
 742+
743743 $this->mTrxLevel = 0;
744744 }
745 -
 745+
746746 /**
747747 * Cancel a transaction
748748 */
@@ -752,7 +752,7 @@
753753 db2_autocommit( $this->mConn, DB2_AUTOCOMMIT_ON );
754754 $this->mTrxLevel = 0;
755755 }
756 -
 756+
757757 /**
758758 * Makes an encoded list of strings from an array
759759 * $mode:
@@ -768,7 +768,7 @@
769769 throw new DBUnexpectedError( $this,
770770 'DatabaseBase::makeList called with incorrect parameters' );
771771 }
772 -
 772+
773773 // if this is for a prepared UPDATE statement
774774 // (this should be promoted to the parent class
775775 // once other databases use prepared statements)
@@ -785,14 +785,14 @@
786786 }
787787 }
788788 $list .= '';
789 -
 789+
790790 return $list;
791791 }
792 -
 792+
793793 // otherwise, call the usual function
794794 return parent::makeList( $a, $mode );
795795 }
796 -
 796+
797797 /**
798798 * Construct a LIMIT query with optional offset
799799 * This is used for query pages
@@ -815,17 +815,17 @@
816816 }
817817 return "$sql FETCH FIRST $limit ROWS ONLY ";
818818 }
819 -
 819+
820820 /**
821821 * Handle reserved keyword replacement in table names
822 - * @return
 822+ * @return
823823 * @param $name Object
824824 */
825825 public function tableName( $name ) {
826826 // we want maximum compatibility with MySQL schema
827827 return $name;
828828 }
829 -
 829+
830830 /**
831831 * Generates a timestamp in an insertable format
832832 * @return string timestamp value
@@ -855,7 +855,7 @@
856856 */
857857 return null;
858858 }
859 -
 859+
860860 /**
861861 * This must be called after nextSequenceVal
862862 * @return Last sequence value used as a primary key
@@ -863,7 +863,7 @@
864864 public function insertId() {
865865 return $this->mInsertId;
866866 }
867 -
 867+
868868 /**
869869 * Updates the mInsertId property with the value of the last insert
870870 * into a generated column
@@ -877,7 +877,7 @@
878878 $this->mInsertId = db2_last_insert_id( $this->mConn );
879879 }
880880 }
881 -
 881+
882882 /**
883883 * INSERT wrapper, inserts an array into a table
884884 *
@@ -905,7 +905,7 @@
906906 if ( !( isset( $args[0] ) && is_array( $args[0] ) ) ) {
907907 $args = array( $args );
908908 }
909 -
 909+
910910 // prevent insertion of NULL into primary key columns
911911 list( $args, $primaryKeys ) = $this->removeNullPrimaryKeys( $table, $args );
912912 // if there's only one primary key
@@ -914,7 +914,7 @@
915915 if ( count( $primaryKeys ) == 1 ) {
916916 $primaryKey = $primaryKeys[0];
917917 }
918 -
 918+
919919 // get column names
920920 $keys = array_keys( $args[0] );
921921 $key_count = count( $keys );
@@ -939,7 +939,7 @@
940940 //$this->installPrint( "$sql" );
941941 //$this->installPrint( print_r( $args, true ));
942942 $stmt = $this->prepare( $sql );
943 -
 943+
944944 // start a transaction/enter transaction mode
945945 $this->begin();
946946
@@ -962,24 +962,24 @@
963963 // For future use, we may want to track the number of actual inserts
964964 // Right now, insert (all writes) simply return true/false
965965 $numrowsinserted = 0;
966 -
 966+
967967 // always return true
968968 $res = true;
969 -
 969+
970970 foreach ( $args as $row ) {
971971 $overhead = "SAVEPOINT $ignore ON ROLLBACK RETAIN CURSORS";
972972 db2_exec( $this->mConn, $overhead, $this->mStmtOptions );
973 -
974 -
 973+
 974+
975975 $this->execute( $stmt, $row );
976 -
 976+
977977 if ( !$res2 ) {
978978 $this->installPrint( "Last error:" );
979979 $this->installPrint( $this->lastError() );
980980 }
981981 // get the last inserted value into a generated column
982982 $this->calcInsertId( $table, $primaryKey, $stmt );
983 -
 983+
984984 $errNum = $this->lastErrno();
985985 if ( $errNum ) {
986986 db2_exec( $this->mConn, "ROLLBACK TO SAVEPOINT $ignore",
@@ -991,7 +991,7 @@
992992 $numrowsinserted++;
993993 }
994994 }
995 -
 995+
996996 $olde = error_reporting( $olde );
997997 // Set the affected row count for the whole operation
998998 $this->mAffectedRows = $numrowsinserted;
@@ -999,14 +999,14 @@
10001000 // commit either way
10011001 $this->commit();
10021002 $this->freePrepared( $stmt );
1003 -
 1003+
10041004 return $res;
10051005 }
1006 -
 1006+
10071007 /**
10081008 * Given a table name and a hash of columns with values
10091009 * Removes primary key columns from the hash where the value is NULL
1010 - *
 1010+ *
10111011 * @param $table String: name of the table
10121012 * @param $args Array of hashes of column names with values
10131013 * @return Array: tuple( filtered array of columns, array of primary keys )
@@ -1036,7 +1036,7 @@
10371037 // return modified hash
10381038 return array( $args, $keys );
10391039 }
1040 -
 1040+
10411041 /**
10421042 * UPDATE wrapper, takes a condition array and a SET array
10431043 *
@@ -1065,10 +1065,10 @@
10661066 // if not, convert to simple array first
10671067 $result = $this->execute( $stmt, $values );
10681068 $this->freePrepared( $stmt );
1069 -
 1069+
10701070 return $result;
10711071 }
1072 -
 1072+
10731073 /**
10741074 * DELETE query wrapper
10751075 *
@@ -1085,10 +1085,10 @@
10861086 $sql .= ' WHERE ' . $this->makeList( $conds, LIST_AND );
10871087 }
10881088 $result = $this->query( $sql, $fname );
1089 -
 1089+
10901090 return $result;
10911091 }
1092 -
 1092+
10931093 /**
10941094 * Returns the number of rows affected by the last query or 0
10951095 * @return Integer: the number of rows affected by the last query
@@ -1102,7 +1102,7 @@
11031103 return 0;
11041104 return db2_num_rows( $this->mLastResult );
11051105 }
1106 -
 1106+
11071107 /**
11081108 * Simulates REPLACE with a DELETE followed by INSERT
11091109 * @param $table Object
@@ -1162,7 +1162,7 @@
11631163 $this->query( $sql, $fname );
11641164 }
11651165 }
1166 -
 1166+
11671167 /**
11681168 * Returns the number of rows in the result set
11691169 * Has to be called right after the corresponding select query
@@ -1180,7 +1180,7 @@
11811181 return 0;
11821182 }
11831183 }
1184 -
 1184+
11851185 /**
11861186 * Moves the row pointer of the result set
11871187 * @param $res Object: result set
@@ -1193,11 +1193,11 @@
11941194 }
11951195 return db2_fetch_row( $res, $row );
11961196 }
1197 -
 1197+
11981198 ###
1199 - # Fix notices in Block.php
 1199+ # Fix notices in Block.php
12001200 ###
1201 -
 1201+
12021202 /**
12031203 * Frees memory associated with a statement resource
12041204 * @param $res Object: statement resource to free
@@ -1211,7 +1211,7 @@
12121212 throw new DBUnexpectedError( $this, "Unable to free DB2 result\n" );
12131213 }
12141214 }
1215 -
 1215+
12161216 /**
12171217 * Returns the number of columns in a resource
12181218 * @param $res Object: statement resource
@@ -1223,7 +1223,7 @@
12241224 }
12251225 return db2_num_fields( $res );
12261226 }
1227 -
 1227+
12281228 /**
12291229 * Returns the nth column name
12301230 * @param $res Object: statement resource
@@ -1236,7 +1236,7 @@
12371237 }
12381238 return db2_field_name( $res, $n );
12391239 }
1240 -
 1240+
12411241 /**
12421242 * SELECT wrapper
12431243 *
@@ -1259,7 +1259,7 @@
12601260 {
12611261 $res = parent::select( $table, $vars, $conds, $fname, $options,
12621262 $join_conds );
1263 -
 1263+
12641264 // We must adjust for offset
12651265 if ( isset( $options['LIMIT'] ) ) {
12661266 if ( isset ( $options['OFFSET'] ) ) {
@@ -1267,13 +1267,13 @@
12681268 $offset = $options['OFFSET'];
12691269 }
12701270 }
1271 -
1272 -
 1271+
 1272+
12731273 // DB2 does not have a proper num_rows() function yet, so we must emulate
12741274 // DB2 9.5.4 and the corresponding ibm_db2 driver will introduce
12751275 // a working one
12761276 // TODO: Yay!
1277 -
 1277+
12781278 // we want the count
12791279 $vars2 = array( 'count( * ) as num_rows' );
12801280 // respecting just the limit option
@@ -1285,20 +1285,20 @@
12861286 if ( isset( $options['GROUP BY'] ) ) {
12871287 return $res;
12881288 }
1289 -
 1289+
12901290 $res2 = parent::select( $table, $vars2, $conds, $fname, $options2,
12911291 $join_conds );
12921292 $obj = $this->fetchObject( $res2 );
12931293 $this->mNumRows = $obj->num_rows;
1294 -
1295 -
 1294+
 1295+
12961296 return $res;
12971297 }
1298 -
 1298+
12991299 /**
13001300 * Handles ordering, grouping, and having options ('GROUP BY' => colname)
13011301 * Has limited support for per-column options (colnum => 'DISTINCT')
1302 - *
 1302+ *
13031303 * @private
13041304 *
13051305 * @param $options Associative array of options to be turned into
@@ -1325,16 +1325,16 @@
13261326 if ( isset( $options['ORDER BY'] ) ) {
13271327 $preLimitTail .= " ORDER BY {$options['ORDER BY']}";
13281328 }
1329 -
 1329+
13301330 if ( isset( $noKeyOptions['DISTINCT'] )
13311331 || isset( $noKeyOptions['DISTINCTROW'] ) )
13321332 {
13331333 $startOpts .= 'DISTINCT';
13341334 }
1335 -
 1335+
13361336 return array( $startOpts, '', $preLimitTail, $postLimitTail );
13371337 }
1338 -
 1338+
13391339 /**
13401340 * Returns link to IBM DB2 free download
13411341 * @return string wikitext of a link to the server software's web site
@@ -1342,11 +1342,11 @@
13431343 public static function getSoftwareLink() {
13441344 return "[http://www.ibm.com/db2/express/ IBM DB2]";
13451345 }
1346 -
 1346+
13471347 /**
13481348 * Get search engine class. All subclasses of this
13491349 * need to implement this if they wish to use searching.
1350 - *
 1350+ *
13511351 * @return String
13521352 */
13531353 public function getSearchEngine() {
@@ -1370,7 +1370,7 @@
13711371 }
13721372 return false;
13731373 }
1374 -
 1374+
13751375 /**
13761376 * Ping the server and try to reconnect if it there is no connection
13771377 * The connection may be closed and reopened while this happens
@@ -1382,7 +1382,7 @@
13831383 $this->close();
13841384 $this->mConn = $this->openUncataloged( $this->mDBName, $this->mUser,
13851385 $this->mPassword, $this->mServer, $this->mPort );
1386 -
 1386+
13871387 return false;
13881388 }
13891389 ######################################
@@ -1399,12 +1399,12 @@
14001400 /**
14011401 * Not implemented
14021402 * @return string $sql
1403 - */
 1403+ */
14041404 public function limitResultForUpdate( $sql, $num ) {
14051405 $this->installPrint( 'Not implemented for DB2: limitResultForUpdate()' );
14061406 return $sql;
14071407 }
1408 -
 1408+
14091409 /**
14101410 * Only useful with fake prepare like in base Database class
14111411 * @return string
@@ -1413,11 +1413,11 @@
14141414 $this->installPrint( 'Not useful for DB2: fillPreparedArg()' );
14151415 return '';
14161416 }
1417 -
 1417+
14181418 ######################################
14191419 # Reflection
14201420 ######################################
1421 -
 1421+
14221422 /**
14231423 * Returns information about an index
14241424 * If errors are explicitly ignored, returns NULL on failure
@@ -1446,7 +1446,7 @@
14471447 }
14481448 else return false;
14491449 }
1450 -
 1450+
14511451 /**
14521452 * Returns an information object on a table column
14531453 * @param $table String: table name
@@ -1456,7 +1456,7 @@
14571457 public function fieldInfo( $table, $field ) {
14581458 return IBM_DB2Field::fromText( $this, $table, $field );
14591459 }
1460 -
 1460+
14611461 /**
14621462 * db2_field_type() wrapper
14631463 * @param $res Object: result of executed statement
@@ -1469,7 +1469,7 @@
14701470 }
14711471 return db2_field_type( $res, $index );
14721472 }
1473 -
 1473+
14741474 /**
14751475 * Verifies that an index was created as unique
14761476 * @param $table String: table name
@@ -1498,7 +1498,7 @@
14991499 return false;
15001500
15011501 }
1502 -
 1502+
15031503 /**
15041504 * Returns the size of a text field, or -1 for "unlimited"
15051505 * @param $table String: table name
@@ -1518,7 +1518,7 @@
15191519 $size = $row->size;
15201520 return $size;
15211521 }
1522 -
 1522+
15231523 /**
15241524 * DELETE where the condition is a join
15251525 * @param $delTable String: deleting from this table
@@ -1532,7 +1532,7 @@
15331533 $conds, $fname = "DatabaseIbm_db2::deleteJoin" )
15341534 {
15351535 if ( !$conds ) {
1536 - throw new DBUnexpectedError( $this,
 1536+ throw new DBUnexpectedError( $this,
15371537 'Database::deleteJoin() called with empty $conds' );
15381538 }
15391539
@@ -1541,8 +1541,8 @@
15421542 $sql = <<<SQL
15431543 DELETE FROM $delTable
15441544 WHERE $delVar IN (
1545 - SELECT $joinVar FROM $joinTable
1546 -
 1545+ SELECT $joinVar FROM $joinTable
 1546+
15471547 SQL;
15481548 if ( $conds != '*' ) {
15491549 $sql .= 'WHERE ' . $this->makeList( $conds, LIST_AND );
@@ -1560,7 +1560,7 @@
15611561 public function encodeBlob( $b ) {
15621562 return new IBM_DB2Blob( $b );
15631563 }
1564 -
 1564+
15651565 /**
15661566 * Description is left as an exercise for the reader
15671567 * @param $b IBM_DB2Blob: data to be decoded
@@ -1569,7 +1569,7 @@
15701570 public function decodeBlob( $b ) {
15711571 return "$b";
15721572 }
1573 -
 1573+
15741574 /**
15751575 * Convert into a list of string being concatenated
15761576 * @param $stringList Array: strings that need to be joined together
@@ -1581,7 +1581,7 @@
15821582 // Sample query: VALUES 'foo' CONCAT 'bar' CONCAT 'baz'
15831583 return implode( ' || ', $stringList );
15841584 }
1585 -
 1585+
15861586 /**
15871587 * Generates the SQL required to convert a DB2 timestamp into a Unix epoch
15881588 * @param $column String: name of timestamp column
@@ -1591,11 +1591,11 @@
15921592 // TODO
15931593 // see SpecialAncientpages
15941594 }
1595 -
 1595+
15961596 ######################################
15971597 # Prepared statements
15981598 ######################################
1599 -
 1599+
16001600 /**
16011601 * Intended to be compatible with the PEAR::DB wrapper functions.
16021602 * http://pear.php.net/manual/en/package.database.db.intro-execute.php
@@ -1669,14 +1669,14 @@
16701670 public function fillPrepared( $preparedQuery, $args ) {
16711671 reset( $args );
16721672 $this->preparedArgs =& $args;
1673 -
 1673+
16741674 foreach ( $args as $i => $arg ) {
16751675 db2_bind_param( $preparedQuery, $i+1, $args[$i] );
16761676 }
1677 -
 1677+
16781678 return $preparedQuery;
16791679 }
1680 -
 1680+
16811681 /**
16821682 * Switches module between regular and install modes
16831683 */
@@ -1685,7 +1685,7 @@
16861686 $this->mMode = $mode;
16871687 return $old;
16881688 }
1689 -
 1689+
16901690 /**
16911691 * Bitwise negation of a column or value in SQL
16921692 * Same as (~field) in C
@@ -1725,7 +1725,7 @@
17261726 if ( !is_array( $maybeArray ) ) {
17271727 return array( $maybeArray );
17281728 }
1729 -
 1729+
17301730 return $maybeArray;
17311731 }
17321732 }

Status & tagging log