In Database::getLag(): Add some more I/O thread states.
[lhc/web/wiklou.git] / includes / db / DatabaseMssql.php
index da3b394..9521a1a 100644 (file)
@@ -10,7 +10,7 @@
 /**
  * @ingroup Database
  */
-class DatabaseMssql extends Database {
+class DatabaseMssql extends DatabaseBase {
 
        var $mAffectedRows;
        var $mLastResult;
@@ -105,7 +105,7 @@ class DatabaseMssql extends Database {
                                $success = @/**/mssql_select_db($dbName, $this->mConn);
                                if (!$success) {
                                        $error = "Error selecting database $dbName on server {$this->mServer} " .
-                                               "from client host {$wguname['nodename']}\n";
+                                               "from client host " . wfHostname() . "\n";
                                        wfLogDBError(" Error selecting database $dbName on server {$this->mServer} \n");
                                        wfDebug( $error );
                                }
@@ -154,9 +154,6 @@ class DatabaseMssql extends Database {
                return $ret;
        }
 
-       /**#@+
-        * @param mixed $res A SQL result
-        */
        /**
         * Free a result object
         */
@@ -225,6 +222,7 @@ class DatabaseMssql extends Database {
        /**
         * Get the number of fields in a result object
         * See documentation for mysql_num_fields()
+        * @param $res SQL result object as returned from Database::query(), etc.
         */
        function numFields( $res ) {
                if ( $res instanceof ResultWrapper ) {
@@ -237,6 +235,8 @@ class DatabaseMssql extends Database {
         * Get a field name in a result object
         * See documentation for mysql_field_name():
         * http://www.php.net/mysql_field_name
+        * @param $res SQL result object as returned from Database::query(), etc.
+        * @param $n Int
         */
        function fieldName( $res, $n ) {
                if ( $res instanceof ResultWrapper ) {
@@ -263,6 +263,8 @@ class DatabaseMssql extends Database {
        /**
         * Change the position of the cursor in a result object
         * See mysql_data_seek()
+        * @param $res SQL result object as returned from Database::query(), etc.
+        * @param $row Database row
         */
        function dataSeek( $res, $row ) {
                if ( $res instanceof ResultWrapper ) {
@@ -339,7 +341,7 @@ class DatabaseMssql extends Database {
         *
         * @private
         *
-        * @param array $options an associative array of options to be turned into
+        * @param $options Array: an associative array of options to be turned into
         *              an SQL query, valid keys are listed in the function.
         * @return array
         */
@@ -390,11 +392,11 @@ class DatabaseMssql extends Database {
        /**
         * SELECT wrapper
         *
-        * @param mixed  $table   Array or string, table name(s) (prefix auto-added)
-        * @param mixed  $vars    Array or string, field name(s) to be retrieved
-        * @param mixed  $conds   Array or string, condition(s) for WHERE
-        * @param string $fname   Calling function name (use __METHOD__) for logs/profiling
-        * @param array  $options Associative array of options (e.g. array('GROUP BY' => 'page_title')),
+        * @param $table   Mixed: Array or string, table name(s) (prefix auto-added)
+        * @param $vars    Mixed: Array or string, field name(s) to be retrieved
+        * @param $conds   Mixed: Array or string, condition(s) for WHERE
+        * @param $fname   String: Calling function name (use __METHOD__) for logs/profiling
+        * @param $options Array: Associative array of options (e.g. array('GROUP BY' => 'page_title')),
         *                        see Database::makeSelectOptions code for list of supported stuff
         * @return mixed Database result resource (feed to Database::fetchObject or whatever), or false on failure
         */
@@ -643,12 +645,12 @@ class DatabaseMssql extends Database {
        /**
         * UPDATE wrapper, takes a condition array and a SET array
         *
-        * @param string $table  The table to UPDATE
-        * @param array  $values An array of values to SET
-        * @param array  $conds  An array of conditions (WHERE). Use '*' to update all rows.
-        * @param string $fname  The Class::Function calling this function
-        *                       (for the log)
-        * @param array  $options An array of UPDATE options, can be one or
+        * @param $table   String: The table to UPDATE
+        * @param $values  Array: An array of values to SET
+        * @param $conds   Array: An array of conditions (WHERE). Use '*' to update all rows.
+        * @param $fname   String: The Class::Function calling this function
+        *                        (for the log)
+        * @param $options Array: An array of UPDATE options, can be one or
         *                        more of IGNORE, LOW_PRIORITY
         * @return bool
         */
@@ -666,7 +668,7 @@ class DatabaseMssql extends Database {
         * Make UPDATE options for the Database::update function
         *
         * @private
-        * @param array $options The options passed to Database::update
+        * @param $options Array: The options passed to Database::update
         * @return string
         */
        function makeUpdateOptions( $options ) {
@@ -698,20 +700,13 @@ class DatabaseMssql extends Database {
 
        /**
         * MSSQL doubles quotes instead of escaping them
-        * @param string $s String to be slashed.
+        * @param $s String to be slashed.
         * @return string slashed string.
         */
        function strencode($s) {
                return str_replace("'","''",$s);
        }
 
-       /**
-        * USE INDEX clause
-        */
-       function useIndexClause( $index ) {
-               return "";
-       }
-
        /**
         * REPLACE query wrapper
         * PostgreSQL simulates this with a DELETE followed by INSERT
@@ -755,11 +750,12 @@ class DatabaseMssql extends Database {
         *
         * DO NOT put the join condition in $conds
         *
-        * @param string $delTable The table to delete from.
-        * @param string $joinTable The other table.
-        * @param string $delVar The variable to join on, in the first table.
-        * @param string $joinVar The variable to join on, in the second table.
-        * @param array $conds Condition array of field names mapped to variables, ANDed together in the WHERE clause
+        * @param $delTable String: The table to delete from.
+        * @param $joinTable String: The other table.
+        * @param $delVar String: The variable to join on, in the first table.
+        * @param $joinVar String: The variable to join on, in the second table.
+        * @param $conds Array: Condition array of field names mapped to variables, ANDed together in the WHERE clause
+        * @param $fname String: Calling function name
         */
        function deleteJoin( $delTable, $joinTable, $delVar, $joinVar, $conds, $fname = 'Database::deleteJoin' ) {
                if ( !$conds ) {
@@ -854,18 +850,6 @@ class DatabaseMssql extends Database {
                return $sql;
        }
 
-       /**
-        * Returns an SQL expression for a simple conditional.
-        *
-        * @param string $cond SQL expression which will result in a boolean value
-        * @param string $trueVal SQL expression to return if true
-        * @param string $falseVal SQL expression to return if false
-        * @return string SQL fragment
-        */
-       function conditional( $cond, $trueVal, $falseVal ) {
-               return " (CASE WHEN $cond THEN $trueVal ELSE $falseVal END) ";
-       }
-
        /**
         * Should determine if the last failure was due to a deadlock
         * @return bool
@@ -915,6 +899,13 @@ class DatabaseMssql extends Database {
                return "[http://www.microsoft.com/sql/default.mspx Microsoft SQL Server 2005 Home]";
        }
 
+       /**
+        * @return String: Database type for use in messages
+       */
+       function getDBtypeForMsg() {
+               return 'Microsoft SQL Server';
+       }
+
        /**
         * @return string Version information from the database
         */
@@ -927,16 +918,6 @@ class DatabaseMssql extends Database {
                return $sql;
        }
 
-       /**
-        * not done
-        */
-       public function setTimeout($timeout) { return; }
-
-       function ping() {
-               wfDebug("Function ping() not written for MSSQL yet");
-               return true;
-       }
-
        /**
         * How lagged is this slave?
         */
@@ -998,20 +979,9 @@ class DatabaseMssql extends Database {
                }
        }
        
-       /** 
-        * No-op lock functions
-        */
-       public function lock( $lockName, $method ) {
-               return true;
-       }
-       public function unlock( $lockName, $method ) {
-               return true;
-       }
-       
        public function getSearchEngine() {
                return "SearchEngineDummy";
        }
-
 }
 
 /**