class DatabaseMysqli extends DatabaseMysqlBase {
/**
* @param string $sql
- * @return mysqli_result
+ * @return mysqli_result|bool
*/
protected function doQuery( $sql ) {
$conn = $this->getBindingHandle();
} elseif ( substr_count( $realServer, ':' ) == 1 ) {
// If we have a colon and something that's not a port number
// inside the hostname, assume it's the socket location
- $hostAndSocket = explode( ':', $realServer, 2 );
- $realServer = $hostAndSocket[0];
- $socket = $hostAndSocket[1];
+ list( $realServer, $socket ) = explode( ':', $realServer, 2 );
}
$mysqli = mysqli_init();
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 );
}
/**
return $conn->affected_rows;
}
- 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'." );
- }
-
- // Update that domain fields on success (no exception thrown)
- $this->currentDomain = $domain;
-
- return true;
- }
-
/**
* @param mysqli_result $res
* @return bool