Remove a few method_exists() checks
[lhc/web/wiklou.git] / includes / libs / rdbms / database / DatabaseMysqli.php
index ad9b0a4..1c4ed56 100644 (file)
@@ -37,7 +37,7 @@ use stdClass;
 class DatabaseMysqli extends DatabaseMysqlBase {
        /**
         * @param string $sql
-        * @return mysqli_result
+        * @return mysqli_result|bool
         */
        protected function doQuery( $sql ) {
                $conn = $this->getBindingHandle();
@@ -139,11 +139,7 @@ class DatabaseMysqli extends DatabaseMysqlBase {
        protected function mysqlSetCharset( $charset ) {
                $conn = $this->getBindingHandle();
 
-               if ( method_exists( $conn, 'set_charset' ) ) {
-                       return $conn->set_charset( $charset );
-               } else {
-                       return $this->query( 'SET NAMES ' . $charset, __METHOD__ );
-               }
+               return $conn->set_charset( $charset );
        }
 
        /**
@@ -185,15 +181,16 @@ class DatabaseMysqli extends DatabaseMysqlBase {
        }
 
        function doSelectDomain( DatabaseDomain $domain ) {
-               $conn = $this->getBindingHandle();
-
                if ( $domain->getSchema() !== null ) {
                        throw new DBExpectedError( $this, __CLASS__ . ": domain schemas are not supported." );
                }
 
                $database = $domain->getDatabase();
-               if ( !$conn->select_db( $database ) ) {
-                       throw new DBExpectedError( $this, "Could not select database '$database'." );
+               if ( $database !== $this->getDBname() ) {
+                       $conn = $this->getBindingHandle();
+                       if ( !$conn->select_db( $database ) ) {
+                               throw new DBExpectedError( $this, "Could not select database '$database'." );
+                       }
                }
 
                // Update that domain fields on success (no exception thrown)