r85896 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r85895‎ | r85896 | r85897 >
Date:17:18, 12 April 2011
Author:leonsp
Status:ok
Tags:
Comment:
Addressing comments by Krinkle on r85885. Removing commented-out code. Verified that there is no more of it.
Modified paths:
  • /trunk/phase3/includes/db/DatabaseIbm_db2.php (modified) (history)
  • /trunk/phase3/includes/installer/Ibm_db2Installer.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/db/DatabaseIbm_db2.php
@@ -466,11 +466,8 @@
467467
468468 $ret = db2_exec( $this->mConn, $sql, $this->mStmtOptions );
469469 if( $ret == false ) {
470 - //TODO: Remove commented-out debug code once done debugging
471 - //echo '<pre>ERROR</pre>';
472 - //echo '<pre>' . $sql . '</pre>';
473470 $error = db2_stmt_errormsg();
474 - //echo '<pre>' . $error . '</pre>';
 471+
475472 $this->installPrint( "<pre>$sql</pre>" );
476473 $this->installPrint( $error );
477474 throw new DBUnexpectedError( $this, 'SQL error: '
@@ -495,10 +492,7 @@
496493 */
497494 public function tableExists( $table ) {
498495 $schema = $this->mSchema;
499 - /*$sql = <<< EOF
500 -SELECT COUNT( * ) FROM SYSIBM.SYSTABLES ST
501 -WHERE ST.NAME = '$table' AND ST.CREATOR = '$schema'
502 -EOF;*/
 496+
503497 $sql = "SELECT COUNT( * ) FROM SYSIBM.SYSTABLES ST WHERE ST.NAME = '" .
504498 strtoupper( $table ) .
505499 "' AND ST.CREATOR = '" .
@@ -558,7 +552,7 @@
559553 . htmlspecialchars( $this->lastError() ) );
560554 }
561555 return $row;
562 - }
 556+ }
563557 return false;
564558 }
565559
@@ -977,11 +971,14 @@
978972 */
979973 private function removeNullPrimaryKeys( $table, $args ) {
980974 $schema = $this->mSchema;
 975+
981976 // find out the primary keys
982 - /*$keyres = db2_primary_keys( $this->mConn, null, strtoupper( $schema ),
983 - strtoupper( $table )
984 - );*/
985 - $keyres = $this->doQuery( "SELECT NAME FROM SYSIBM.SYSCOLUMNS WHERE TBNAME = '" . strtoupper( $table ) . "' AND TBCREATOR = '" . strtoupper( $schema ) . "' AND KEYSEQ > 0" );
 977+ $keyres = $this->doQuery( "SELECT NAME FROM SYSIBM.SYSCOLUMNS WHERE TBNAME = '"
 978+ . strtoupper( $table )
 979+ . "' AND TBCREATOR = '"
 980+ . strtoupper( $schema )
 981+ . "' AND KEYSEQ > 0" );
 982+
986983 $keys = array();
987984 for (
988985 $row = $this->fetchRow( $keyres );
@@ -1123,12 +1120,8 @@
11241121 $this->query( $sql, $fname );
11251122 }
11261123
1127 - $this->insert($table, $row);
11281124 # Now insert the row
1129 - /*$sql = "INSERT INTO $table ( "
1130 - . $this->makeList( array_keys( $row ), LIST_NAMES )
1131 - .' ) VALUES ( ' . $this->makeList( $row, LIST_COMMA ) . ' )';
1132 - $this->query( $sql, $fname );*/
 1125+ $this->insert($table, $row);
11331126 }
11341127 }
11351128
@@ -1507,7 +1500,7 @@
15081501 $sql = <<<SQL
15091502 DELETE FROM $delTable
15101503 WHERE $delVar IN (
1511 - SELECT $joinVar FROM $joinTable
 1504+ SELECT $joinVar FROM $joinTable
15121505
15131506 SQL;
15141507 if ( $conds != '*' ) {
@@ -1576,7 +1569,7 @@
15771570 */
15781571 public function prepare( $sql, $func = 'DB2::prepare' ) {
15791572 $stmt = db2_prepare( $this->mConn, $sql, $this->mStmtOptions );
1580 - return $stmt;
 1573+ return $stmt;
15811574 }
15821575
15831576 /**
Index: trunk/phase3/includes/installer/Ibm_db2Installer.php
@@ -79,7 +79,7 @@
8080 elseif ( !preg_match( '/^[a-zA-Z0-9_]*$/', $newValues['wgDBmwschema'] ) ) {
8181 $status->fatal( 'config-invalid-schema', $newValues['wgDBmwschema'] );
8282 }
83 - if ( !strlen( $newValues['wgDBport'] ) ) {
 83+ if ( !strlen( $newValues['wgDBport'] ) ) {
8484 $status->fatal( 'config-invalid-port' );
8585 }
8686 elseif ( !preg_match( '/^[0-9_]*$/', $newValues['wgDBport'] ) ) {
@@ -94,8 +94,8 @@
9595 return $status;
9696 }
9797
98 - global $wgDBport;
99 - $wgDBport = $newValues['wgDBport'];
 98+ global $wgDBport;
 99+ $wgDBport = $newValues['wgDBport'];
100100
101101 // Try to connect
102102 $status->merge( $this->getConnection() );
@@ -107,7 +107,6 @@
108108 $this->parent->setVar( 'wgDBpassword', $this->getVar( '_InstallPassword' ) );
109109
110110 return $status;
111 -
112111 }
113112
114113 /**

Sign-offs

UserFlagDate
Krinkleinspected17:21, 12 April 2011

Follow-up revisions

RevisionCommit summaryAuthorDate
r106480Fixes to DB2 support:...leonsp21:17, 16 December 2011

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r85885Fixes to DB2 support. DB2 support integration with 1.17 Installer and Updater...leonsp16:35, 12 April 2011

Status & tagging log