Merge "API: Use message-per-value for apihelp-query+allusers-param-prop"
[lhc/web/wiklou.git] / includes / db / DatabaseMysqlBase.php
index 4085fa9..be34242 100644 (file)
@@ -59,22 +59,16 @@ abstract class DatabaseMysqlBase extends DatabaseBase {
        function open( $server, $user, $password, $dbName ) {
                global $wgAllDBsAreLocalhost, $wgSQLMode;
 
-               # Debugging hack -- fake cluster
-               if ( $wgAllDBsAreLocalhost ) {
-                       $realServer = 'localhost';
-               } else {
-                       $realServer = $server;
-               }
+               # Close/unset connection handle
                $this->close();
+
+               # Debugging hack -- fake cluster
+               $realServer = $wgAllDBsAreLocalhost ? 'localhost' : $server;
                $this->mServer = $server;
                $this->mUser = $user;
                $this->mPassword = $password;
                $this->mDBname = $dbName;
 
-               # The kernel's default SYN retransmission period is far too slow for us,
-               # so we use a short timeout plus a manual retry. Retrying means that a small
-               # but finite rate of SYN packet loss won't cause user-visible errors.
-               $this->mConn = false;
                $this->installErrorHandler();
                try {
                        $this->mConn = $this->mysqlConnect( $realServer );
@@ -946,7 +940,7 @@ abstract class DatabaseMysqlBase extends DatabaseBase {
                                $value = $this->mDefaultBigSelects;
                        }
                } elseif ( $this->mDefaultBigSelects === null ) {
-                       $this->mDefaultBigSelects = (bool)$this->selectField( false, '@@sql_big_selects' );
+                       $this->mDefaultBigSelects = (bool)$this->selectField( false, '@@sql_big_selects', '', __METHOD__ );
                }
                $encValue = $value ? '1' : '0';
                $this->query( "SET sql_big_selects=$encValue", __METHOD__ );
@@ -1061,6 +1055,10 @@ abstract class DatabaseMysqlBase extends DatabaseBase {
                        ( $this->lastErrno() == 1290 && strpos( $this->lastError(), '--read-only' ) !== false );
        }
 
+       function wasConnectionError( $errno ) {
+               return $errno == 2013 || $errno == 2006;
+       }
+
        /**
         * Get the underlying binding handle, mConn
         *