} 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 );
}
/**
}
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)