} 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();
return false;
}
- protected function connectInitCharset() {
- // already done in mysqlConnect()
- return true;
- }
-
- /**
- * @param string $charset
- * @return bool
- */
- protected function mysqlSetCharset( $charset ) {
- $conn = $this->getBindingHandle();
-
- return $conn->set_charset( $charset );
- }
-
/**
* @return bool
*/
return $conn->affected_rows;
}
- function doSelectDomain( DatabaseDomain $domain ) {
- if ( $domain->getSchema() !== null ) {
- throw new DBExpectedError( $this, __CLASS__ . ": domain schemas are not supported." );
- }
-
- $database = $domain->getDatabase();
- 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)
- $this->currentDomain = $domain;
-
- return true;
- }
-
/**
* @param mysqli_result $res
* @return bool
/**
* @param mysqli_result $res
- * @return bool
+ * @return array|false
*/
protected function mysqlFetchArray( $res ) {
$array = $res->fetch_array();
return $conn->real_escape_string( (string)$s );
}
- /**
- * Give an id for the connection
- *
- * mysql driver used resource id, but mysqli objects cannot be cast to string.
- * @return string
- */
- public function __toString() {
- if ( $this->conn instanceof mysqli ) {
- return (string)$this->conn->thread_id;
- } else {
- // mConn might be false or something.
- return (string)$this->conn;
- }
- }
-
/**
* @return mysqli
*/