Fix major display regression for CSS 1 browsers like IE5 (see wikien-l).
[lhc/web/wiklou.git] / includes / DatabaseOracle.php
index 226bb4d..1a6f62f 100644 (file)
@@ -6,11 +6,6 @@
  * @package MediaWiki
  */
 
-/**
- * Depends on database
- */
-require_once( 'Database.php' );
-
 class OracleBlob extends DBObject {
        function isLOB() {
                return true;
@@ -52,7 +47,7 @@ class DatabaseOracle extends Database {
         */
        function open( $server, $user, $password, $dbName ) {
                if ( !function_exists( 'oci_connect' ) ) {
-                       wfDie( "Oracle functions missing, have you compiled PHP with the --with-oci8 option?\n" );
+                       throw new DBConnectionError( $this, "Oracle functions missing, have you compiled PHP with the --with-oci8 option?\n" );
                }
                $this->close();
                $this->mServer = $server;
@@ -60,9 +55,6 @@ class DatabaseOracle extends Database {
                $this->mPassword = $password;
                $this->mDBname = $dbName;
 
-               $success = false;
-
-               $hstring="";
                $this->mConn = oci_new_connect($user, $password, $dbName, "AL32UTF8");
                if ( $this->mConn === false ) {
                        wfDebug( "DB connection error\n" );
@@ -137,7 +129,7 @@ class DatabaseOracle extends Database {
 
        function freeResult( $res ) {
                if (!oci_free_statement($res)) {
-                       wfDebugDieBacktrace( "Unable to free Oracle result\n" );
+                       throw new DBUnexpectedError( $this, "Unable to free Oracle result\n" );
                }
                unset($this->mFetchID[$res]);
                unset($this->mFetchCache[$res]);
@@ -152,7 +144,6 @@ class DatabaseOracle extends Database {
 
                for ($i = 1; $i <= $this->mNcols[$res]; $i++) {
                        $name = $this->mFieldNames[$res][$i];
-                       $type = $this->mFieldTypes[$res][$i];
                        if (isset($this->mFetchCache[$res][$this->mFetchID[$res]][$name]))
                                $value = $this->mFetchCache[$res][$this->mFetchID[$res]][$name];
                        else    $value = NULL;
@@ -170,7 +161,7 @@ class DatabaseOracle extends Database {
                        return false;
                $i = 0;
                $ret = array();
-               foreach ($r as $key => $value) {
+               foreach ($r as $value) {
                        wfdebug("ret[$i]=[$value]\n");
                        $ret[$i++] = $value;
                }
@@ -206,14 +197,19 @@ class DatabaseOracle extends Database {
 
        function lastError() {
                if ($this->mErr === false) {
-                       if ($this->mLastResult !== false) $what = $this->mLastResult;
-                       else if ($this->mConn !== false) $what = $this->mConn;
-                       else $what = false;
+                       if ($this->mLastResult !== false) { 
+                               $what = $this->mLastResult;
+                       } else if ($this->mConn !== false) {
+                               $what = $this->mConn;
+                       } else {
+                               $what = false;
+                       }
                        $err = ($what !== false) ? oci_error($what) : oci_error();
-                       if ($err === false)
+                       if ($err === false) {
                                $this->mErr = 'no error';
-                       else
+                       } else {
                                $this->mErr = $err['message'];
+                       }
                }
                return str_replace("\n", '<br />', $this->mErr);
        }
@@ -244,6 +240,9 @@ class DatabaseOracle extends Database {
                $this->freeResult($res);
                $row->Non_unique = !$row->uniqueness;
                return $row;
+               
+               // BUG: !!!! This code needs to be synced up with database.php
+               
        }
 
        function indexUnique ($table, $index, $fname = 'indexUnique') {
@@ -385,7 +384,7 @@ class DatabaseOracle extends Database {
        # DELETE where the condition is a join
        function deleteJoin( $delTable, $joinTable, $delVar, $joinVar, $conds, $fname = "Database::deleteJoin" ) {
                if ( !$conds ) {
-                       wfDebugDieBacktrace( 'Database::deleteJoin() called with empty $conds' );
+                       throw new DBUnexpectedError( $this, 'Database::deleteJoin() called with empty $conds' );
                }
 
                $delTable = $this->tableName( $delTable );
@@ -467,7 +466,7 @@ class DatabaseOracle extends Database {
                        "Query: $sql\n" .
                        "Function: $fname\n" .
                        "Error: $errno $error\n";
-               wfDebugDieBacktrace($message);
+               throw new DBUnexpectedError($this, $message);
        }
 
        /**