From 92966e803fb5ccfe108a8e1fedf39a1832912b4b Mon Sep 17 00:00:00 2001 From: Leons Petrazickis Date: Tue, 12 Apr 2011 17:18:35 +0000 Subject: [PATCH] Addressing comments by Krinkle on r85885. Removing commented-out code. Verified that there is no more of it. --- includes/db/DatabaseIbm_db2.php | 33 ++++++++++--------------- includes/installer/Ibm_db2Installer.php | 7 +++--- 2 files changed, 16 insertions(+), 24 deletions(-) diff --git a/includes/db/DatabaseIbm_db2.php b/includes/db/DatabaseIbm_db2.php index 2f6b0ab4b8..e57ec44544 100644 --- a/includes/db/DatabaseIbm_db2.php +++ b/includes/db/DatabaseIbm_db2.php @@ -466,11 +466,8 @@ class DatabaseIbm_db2 extends DatabaseBase { $ret = db2_exec( $this->mConn, $sql, $this->mStmtOptions ); if( $ret == false ) { - //TODO: Remove commented-out debug code once done debugging - //echo '
ERROR
'; - //echo '
' . $sql . '
'; $error = db2_stmt_errormsg(); - //echo '
' . $error . '
'; + $this->installPrint( "
$sql
" ); $this->installPrint( $error ); throw new DBUnexpectedError( $this, 'SQL error: ' @@ -495,10 +492,7 @@ class DatabaseIbm_db2 extends DatabaseBase { */ public function tableExists( $table ) { $schema = $this->mSchema; - /*$sql = <<< EOF -SELECT COUNT( * ) FROM SYSIBM.SYSTABLES ST -WHERE ST.NAME = '$table' AND ST.CREATOR = '$schema' -EOF;*/ + $sql = "SELECT COUNT( * ) FROM SYSIBM.SYSTABLES ST WHERE ST.NAME = '" . strtoupper( $table ) . "' AND ST.CREATOR = '" . @@ -558,7 +552,7 @@ EOF;*/ . htmlspecialchars( $this->lastError() ) ); } return $row; - } + } return false; } @@ -977,11 +971,14 @@ EOF;*/ */ private function removeNullPrimaryKeys( $table, $args ) { $schema = $this->mSchema; + // find out the primary keys - /*$keyres = db2_primary_keys( $this->mConn, null, strtoupper( $schema ), - strtoupper( $table ) - );*/ - $keyres = $this->doQuery( "SELECT NAME FROM SYSIBM.SYSCOLUMNS WHERE TBNAME = '" . strtoupper( $table ) . "' AND TBCREATOR = '" . strtoupper( $schema ) . "' AND KEYSEQ > 0" ); + $keyres = $this->doQuery( "SELECT NAME FROM SYSIBM.SYSCOLUMNS WHERE TBNAME = '" + . strtoupper( $table ) + . "' AND TBCREATOR = '" + . strtoupper( $schema ) + . "' AND KEYSEQ > 0" ); + $keys = array(); for ( $row = $this->fetchRow( $keyres ); @@ -1123,12 +1120,8 @@ EOF;*/ $this->query( $sql, $fname ); } - $this->insert($table, $row); # Now insert the row - /*$sql = "INSERT INTO $table ( " - . $this->makeList( array_keys( $row ), LIST_NAMES ) - .' ) VALUES ( ' . $this->makeList( $row, LIST_COMMA ) . ' )'; - $this->query( $sql, $fname );*/ + $this->insert($table, $row); } } @@ -1507,7 +1500,7 @@ SQL; $sql = <<mConn, $sql, $this->mStmtOptions ); - return $stmt; + return $stmt; } /** diff --git a/includes/installer/Ibm_db2Installer.php b/includes/installer/Ibm_db2Installer.php index c4cd91d333..d2f916faea 100644 --- a/includes/installer/Ibm_db2Installer.php +++ b/includes/installer/Ibm_db2Installer.php @@ -79,7 +79,7 @@ class Ibm_db2Installer extends DatabaseInstaller { elseif ( !preg_match( '/^[a-zA-Z0-9_]*$/', $newValues['wgDBmwschema'] ) ) { $status->fatal( 'config-invalid-schema', $newValues['wgDBmwschema'] ); } - if ( !strlen( $newValues['wgDBport'] ) ) { + if ( !strlen( $newValues['wgDBport'] ) ) { $status->fatal( 'config-invalid-port' ); } elseif ( !preg_match( '/^[0-9_]*$/', $newValues['wgDBport'] ) ) { @@ -94,8 +94,8 @@ class Ibm_db2Installer extends DatabaseInstaller { return $status; } - global $wgDBport; - $wgDBport = $newValues['wgDBport']; + global $wgDBport; + $wgDBport = $newValues['wgDBport']; // Try to connect $status->merge( $this->getConnection() ); @@ -107,7 +107,6 @@ class Ibm_db2Installer extends DatabaseInstaller { $this->parent->setVar( 'wgDBpassword', $this->getVar( '_InstallPassword' ) ); return $status; - } /** -- 2.20.1