From 287ec29135efd559e866d95eef65f6719522ad80 Mon Sep 17 00:00:00 2001 From: Jure Kajzer Date: Tue, 17 Nov 2009 09:41:26 +0000 Subject: [PATCH] replaced charset definition to php var instead of forced env var --- includes/db/DatabaseOracle.php | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/includes/db/DatabaseOracle.php b/includes/db/DatabaseOracle.php index 0bafb2ba5b..794186dd68 100644 --- a/includes/db/DatabaseOracle.php +++ b/includes/db/DatabaseOracle.php @@ -178,6 +178,8 @@ class DatabaseOracle extends DatabaseBase { var $ignore_DUP_VAL_ON_INDEX = false; var $sequenceData = null; + var $defaultCharset = 'AL32UTF8'; + function DatabaseOracle($server = false, $user = false, $password = false, $dbName = false, $failFunction = false, $flags = 0, $tablePrefix = 'get from global' ) { @@ -222,7 +224,7 @@ class DatabaseOracle extends DatabaseBase { 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" ); } - putenv("NLS_LANG=AMERICAN_AMERICA.AL32UTF8"); + //putenv("NLS_LANG=AMERICAN_AMERICA.AL32UTF8"); $this->close(); $this->mServer = $server; @@ -234,12 +236,11 @@ class DatabaseOracle extends DatabaseBase { return; } - //error_reporting( E_ALL ); //whoever had this bright idea $session_mode = $this->mFlags & DBO_SYSDBA ? OCI_SYSDBA : OCI_DEFAULT; if ( $this->mFlags & DBO_DEFAULT ) - $this->mConn = oci_new_connect($user, $password, $dbName, null, $session_mode); + $this->mConn = oci_new_connect($user, $password, $dbName, $this->defaultCharset, $session_mode); else - $this->mConn = oci_connect($user, $password, $dbName, null, $session_mode); + $this->mConn = oci_connect($user, $password, $dbName, $this->defaultCharset, $session_mode); if ($this->mConn == false) { wfDebug("DB connection error\n"); @@ -253,7 +254,6 @@ class DatabaseOracle extends DatabaseBase { #removed putenv calls because they interfere with the system globaly $this->doQuery('ALTER SESSION SET NLS_TIMESTAMP_FORMAT=\'DD-MM-YYYY HH24:MI:SS.FF6\''); $this->doQuery('ALTER SESSION SET NLS_TIMESTAMP_TZ_FORMAT=\'DD-MM-YYYY HH24:MI:SS.FF6\''); - return $this->mConn; } @@ -292,9 +292,12 @@ class DatabaseOracle extends DatabaseBase { $olderr = error_reporting(E_ERROR); $explain_id = date('dmYHis'); error_reporting($olderr); + $sql = preg_replace('/^EXPLAIN /', 'EXPLAIN PLAN SET STATEMENT_ID = \''.$explain_id.'\' FOR', $sql, 1, $explain_count); + $olderr = error_reporting(E_ERROR); + if (($this->mLastResult = $stmt = oci_parse($this->mConn, $sql)) === false) { $e = oci_error($this->mConn); $this->reportQueryError($e['message'], $e['code'], $sql, __FUNCTION__); @@ -772,12 +775,10 @@ class DatabaseOracle extends DatabaseBase { ++$this->mErrorCount; if ($ignore || $tempIgnore) { -//echo "error ignored! query = [$sql]\n"; wfDebug("SQL ERROR (ignored): $error\n"); $this->ignoreErrors( $ignore ); } else { -//echo "error!\n"; $message = "A database error has occurred\n" . "Query: $sql\n" . "Function: $fname\n" . -- 2.20.1