Fix issues identified by SpaceBeforeSingleLineComment sniff
[lhc/web/wiklou.git] / includes / db / Database.php
index 4d1b1c0..d442e4b 100644 (file)
@@ -58,7 +58,6 @@ abstract class DatabaseBase implements IDatabase {
        protected $mSchema;
        protected $mFlags;
        protected $mForeign;
-       protected $mErrorCount = 0;
        protected $mLBInfo = array();
        protected $mDefaultBigSelects = null;
        protected $mSchemaVars = false;
@@ -259,15 +258,6 @@ abstract class DatabaseBase implements IDatabase {
                return $this->mTrxLevel ? $this->mTrxTimestamp : null;
        }
 
-       /**
-        * Get/set the number of errors logged. Only useful when errors are ignored
-        * @param int $count The count to set, or omitted to leave it unchanged.
-        * @return int The error count
-        */
-       public function errorCount( $count = null ) {
-               return wfSetVar( $this->mErrorCount, $count );
-       }
-
        /**
         * Get/set the table prefix.
         * @param string $prefix The table prefix to set, or omitted to leave it unchanged.
@@ -1111,8 +1101,6 @@ abstract class DatabaseBase implements IDatabase {
         * @throws DBQueryError
         */
        public function reportQueryError( $error, $errno, $sql, $fname, $tempIgnore = false ) {
-               ++$this->mErrorCount;
-
                if ( $this->ignoreErrors() || $tempIgnore ) {
                        wfDebug( "SQL ERROR (ignored): $error\n" );
                } else {
@@ -1359,9 +1347,9 @@ abstract class DatabaseBase implements IDatabase {
                $preLimitTail .= $this->makeOrderBy( $options );
 
                // if (isset($options['LIMIT'])) {
-               //      $tailOpts .= $this->limitResult('', $options['LIMIT'],
-               //              isset($options['OFFSET']) ? $options['OFFSET']
-               //              : false);
+               //      $tailOpts .= $this->limitResult('', $options['LIMIT'],
+               //              isset($options['OFFSET']) ? $options['OFFSET']
+               //              : false);
                // }
 
                if ( isset( $noKeyOptions['FOR UPDATE'] ) ) {
@@ -2449,7 +2437,7 @@ abstract class DatabaseBase implements IDatabase {
                if ( !$alias || (string)$alias === (string)$name ) {
                        return $name;
                } else {
-                       return $name . ' AS ' . $alias; //PostgreSQL needs AS
+                       return $name . ' AS ' . $alias; // PostgreSQL needs AS
                }
        }
 
@@ -3238,9 +3226,6 @@ abstract class DatabaseBase implements IDatabase {
                                $retVal = call_user_func_array( $function, $args );
                                break;
                        } catch ( DBQueryError $e ) {
-                               $error = $this->lastError();
-                               $errno = $this->lastErrno();
-                               $sql = $this->lastQuery();
                                if ( $this->wasDeadlock() ) {
                                        // Retry after a randomized delay
                                        usleep( mt_rand( self::DEADLOCK_DELAY_MIN, self::DEADLOCK_DELAY_MAX ) );
@@ -3781,14 +3766,13 @@ abstract class DatabaseBase implements IDatabase {
         * Once upon a time, DatabaseBase::query() returned a bare MySQL result
         * resource, and it was necessary to call this function to convert it to
         * a wrapper. Nowadays, raw database objects are never exposed to external
-        * callers, so this is unnecessary in external code. For compatibility with
-        * old code, ResultWrapper objects are passed through unaltered.
+        * callers, so this is unnecessary in external code.
         *
-        * @param bool|ResultWrapper|resource $result
+        * @param bool|ResultWrapper|resource|object $result
         * @return bool|ResultWrapper
         */
-       public function resultObject( $result ) {
-               if ( empty( $result ) ) {
+       protected function resultObject( $result ) {
+               if ( !$result ) {
                        return false;
                } elseif ( $result instanceof ResultWrapper ) {
                        return $result;