r59168 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r59167‎ | r59168 | r59169 >
Date:09:41, 17 November 2009
Author:freakolowsky
Status:ok
Tags:
Comment:
replaced charset definition to php var instead of forced env var
Modified paths:
  • /trunk/phase3/includes/db/DatabaseOracle.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/db/DatabaseOracle.php
@@ -178,6 +178,8 @@
179179 var $ignore_DUP_VAL_ON_INDEX = false;
180180 var $sequenceData = null;
181181
 182+ var $defaultCharset = 'AL32UTF8';
 183+
182184 function DatabaseOracle($server = false, $user = false, $password = false, $dbName = false,
183185 $failFunction = false, $flags = 0, $tablePrefix = 'get from global' )
184186 {
@@ -222,7 +224,7 @@
223225 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" );
224226 }
225227
226 - putenv("NLS_LANG=AMERICAN_AMERICA.AL32UTF8");
 228+ //putenv("NLS_LANG=AMERICAN_AMERICA.AL32UTF8");
227229
228230 $this->close();
229231 $this->mServer = $server;
@@ -234,12 +236,11 @@
235237 return;
236238 }
237239
238 - //error_reporting( E_ALL ); //whoever had this bright idea
239240 $session_mode = $this->mFlags & DBO_SYSDBA ? OCI_SYSDBA : OCI_DEFAULT;
240241 if ( $this->mFlags & DBO_DEFAULT )
241 - $this->mConn = oci_new_connect($user, $password, $dbName, null, $session_mode);
 242+ $this->mConn = oci_new_connect($user, $password, $dbName, $this->defaultCharset, $session_mode);
242243 else
243 - $this->mConn = oci_connect($user, $password, $dbName, null, $session_mode);
 244+ $this->mConn = oci_connect($user, $password, $dbName, $this->defaultCharset, $session_mode);
244245
245246 if ($this->mConn == false) {
246247 wfDebug("DB connection error\n");
@@ -253,7 +254,6 @@
254255 #removed putenv calls because they interfere with the system globaly
255256 $this->doQuery('ALTER SESSION SET NLS_TIMESTAMP_FORMAT=\'DD-MM-YYYY HH24:MI:SS.FF6\'');
256257 $this->doQuery('ALTER SESSION SET NLS_TIMESTAMP_TZ_FORMAT=\'DD-MM-YYYY HH24:MI:SS.FF6\'');
257 -
258258 return $this->mConn;
259259 }
260260
@@ -292,9 +292,12 @@
293293 $olderr = error_reporting(E_ERROR);
294294 $explain_id = date('dmYHis');
295295 error_reporting($olderr);
 296+
296297 $sql = preg_replace('/^EXPLAIN /', 'EXPLAIN PLAN SET STATEMENT_ID = \''.$explain_id.'\' FOR', $sql, 1, $explain_count);
297298
298299
 300+ $olderr = error_reporting(E_ERROR);
 301+
299302 if (($this->mLastResult = $stmt = oci_parse($this->mConn, $sql)) === false) {
300303 $e = oci_error($this->mConn);
301304 $this->reportQueryError($e['message'], $e['code'], $sql, __FUNCTION__);
@@ -772,12 +775,10 @@
773776 ++$this->mErrorCount;
774777
775778 if ($ignore || $tempIgnore) {
776 -//echo "error ignored! query = [$sql]\n";
777779 wfDebug("SQL ERROR (ignored): $error\n");
778780 $this->ignoreErrors( $ignore );
779781 }
780782 else {
781 -//echo "error!\n";
782783 $message = "A database error has occurred\n" .
783784 "Query: $sql\n" .
784785 "Function: $fname\n" .

Status & tagging log