Move Blob class to Rdbms namespaces
[lhc/web/wiklou.git] / includes / db / DatabaseOracle.php
index f401058..4aab811 100644 (file)
@@ -20,6 +20,7 @@
  * @file
  * @ingroup Database
  */
+use Wikimedia\Rdbms\Blob;
 
 /**
  * The oci8 extension is fairly weak and doesn't support oci_num_rows, among
@@ -50,7 +51,7 @@ class ORAResult {
        }
 
        /**
-        * @param DatabaseBase $db
+        * @param IDatabase $db
         * @param resource $stmt A valid OCI statement identifier
         * @param bool $unique
         */
@@ -128,60 +129,6 @@ class ORAResult {
        }
 }
 
-/**
- * Utility class.
- * @ingroup Database
- */
-class ORAField implements Field {
-       private $name, $tablename, $default, $max_length, $nullable,
-               $is_pk, $is_unique, $is_multiple, $is_key, $type;
-
-       function __construct( $info ) {
-               $this->name = $info['column_name'];
-               $this->tablename = $info['table_name'];
-               $this->default = $info['data_default'];
-               $this->max_length = $info['data_length'];
-               $this->nullable = $info['not_null'];
-               $this->is_pk = isset( $info['prim'] ) && $info['prim'] == 1 ? 1 : 0;
-               $this->is_unique = isset( $info['uniq'] ) && $info['uniq'] == 1 ? 1 : 0;
-               $this->is_multiple = isset( $info['nonuniq'] ) && $info['nonuniq'] == 1 ? 1 : 0;
-               $this->is_key = ( $this->is_pk || $this->is_unique || $this->is_multiple );
-               $this->type = $info['data_type'];
-       }
-
-       function name() {
-               return $this->name;
-       }
-
-       function tableName() {
-               return $this->tablename;
-       }
-
-       function defaultValue() {
-               return $this->default;
-       }
-
-       function maxLength() {
-               return $this->max_length;
-       }
-
-       function isNullable() {
-               return $this->nullable;
-       }
-
-       function isKey() {
-               return $this->is_key;
-       }
-
-       function isMultipleKey() {
-               return $this->is_multiple;
-       }
-
-       function type() {
-               return $this->type;
-       }
-}
-
 /**
  * @ingroup Database
  */
@@ -230,22 +177,6 @@ class DatabaseOracle extends Database {
                return 'oracle';
        }
 
-       function cascadingDeletes() {
-               return true;
-       }
-
-       function cleanupTriggers() {
-               return true;
-       }
-
-       function strictIPs() {
-               return true;
-       }
-
-       function realTimestamps() {
-               return true;
-       }
-
        function implicitGroupby() {
                return false;
        }
@@ -254,10 +185,6 @@ class DatabaseOracle extends Database {
                return false;
        }
 
-       function searchableIPs() {
-               return true;
-       }
-
        /**
         * Usually aborts on failure
         * @param string $server
@@ -265,7 +192,7 @@ class DatabaseOracle extends Database {
         * @param string $password
         * @param string $dbName
         * @throws DBConnectionError
-        * @return DatabaseBase|null
+        * @return resource|null
         */
        function open( $server, $user, $password, $dbName ) {
                global $wgDBOracleDRCP;
@@ -742,7 +669,7 @@ class DatabaseOracle extends Database {
                list( $startOpts, $useIndex, $tailOpts, $ignoreIndex ) =
                        $this->makeSelectOptions( $selectOptions );
                if ( is_array( $srcTable ) ) {
-                       $srcTable = implode( ',', array_map( [ &$this, 'tableName' ], $srcTable ) );
+                       $srcTable = implode( ',', array_map( [ $this, 'tableName' ], $srcTable ) );
                } else {
                        $srcTable = $this->tableName( $srcTable );
                }
@@ -1067,12 +994,12 @@ class DatabaseOracle extends Database {
         *
         * @param array|string $table
         * @param string $field
-        * @return ORAField|ORAResult
+        * @return ORAField|ORAResult|false
         */
        private function fieldInfoMulti( $table, $field ) {
                $field = strtoupper( $field );
                if ( is_array( $table ) ) {
-                       $table = array_map( [ &$this, 'tableNameInternal' ], $table );
+                       $table = array_map( [ $this, 'tableNameInternal' ], $table );
                        $tableWhere = 'IN (';
                        foreach ( $table as &$singleTable ) {
                                $singleTable = $this->removeIdentifierQuotes( $singleTable );
@@ -1159,24 +1086,18 @@ class DatabaseOracle extends Database {
                }
        }
 
-       /**
-        * defines must comply with ^define\s*([^\s=]*)\s*=\s?'\{\$([^\}]*)\}';
-        *
-        * @param resource $fp
-        * @param bool|string $lineCallback
-        * @param bool|callable $resultCallback
-        * @param string $fname
-        * @param bool|callable $inputCallback
-        * @return bool|string
-        */
-       function sourceStream( $fp, $lineCallback = false, $resultCallback = false,
-               $fname = __METHOD__, $inputCallback = false ) {
+       function sourceStream(
+               $fp,
+               callable $lineCallback = null,
+               callable $resultCallback = null,
+               $fname = __METHOD__, callable $inputCallback = null
+       ) {
                $cmd = '';
                $done = false;
                $dollarquote = false;
 
                $replacements = [];
-
+               // Defines must comply with ^define\s*([^\s=]*)\s*=\s?'\{\$([^\}]*)\}';
                while ( !feof( $fp ) ) {
                        if ( $lineCallback ) {
                                call_user_func( $lineCallback );
@@ -1571,10 +1492,6 @@ class DatabaseOracle extends Database {
                return 'CAST ( ' . $field . ' AS VARCHAR2 )';
        }
 
-       public function getSearchEngine() {
-               return 'SearchOracle';
-       }
-
        public function getInfinity() {
                return '31-12-2030 12:00:00.000000';
        }