dépôts
/
lhc
/
web
/
wiklou.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Merge "Improve docs for Title::getInternalURL/getCanonicalURL"
[lhc/web/wiklou.git]
/
includes
/
libs
/
rdbms
/
database
/
DatabaseMysqli.php
diff --git
a/includes/libs/rdbms/database/DatabaseMysqli.php
b/includes/libs/rdbms/database/DatabaseMysqli.php
index
6d9dabd
..
1a5cdab
100644
(file)
--- a/
includes/libs/rdbms/database/DatabaseMysqli.php
+++ b/
includes/libs/rdbms/database/DatabaseMysqli.php
@@
-37,7
+37,7
@@
use stdClass;
class DatabaseMysqli extends DatabaseMysqlBase {
/**
* @param string $sql
class DatabaseMysqli extends DatabaseMysqlBase {
/**
* @param string $sql
- * @return mysqli_result
+ * @return mysqli_result
|bool
*/
protected function doQuery( $sql ) {
$conn = $this->getBindingHandle();
*/
protected function doQuery( $sql ) {
$conn = $this->getBindingHandle();
@@
-53,10
+53,11
@@
class DatabaseMysqli extends DatabaseMysqlBase {
/**
* @param string $realServer
/**
* @param string $realServer
+ * @param string|null $dbName
* @return bool|mysqli
* @throws DBConnectionError
*/
* @return bool|mysqli
* @throws DBConnectionError
*/
- protected function mysqlConnect( $realServer ) {
+ protected function mysqlConnect( $realServer
, $dbName
) {
# Avoid suppressed fatal error, which is very hard to track down
if ( !function_exists( 'mysqli_init' ) ) {
throw new DBConnectionError( $this, "MySQLi functions missing,"
# Avoid suppressed fatal error, which is very hard to track down
if ( !function_exists( 'mysqli_init' ) ) {
throw new DBConnectionError( $this, "MySQLi functions missing,"
@@
-77,9
+78,7
@@
class DatabaseMysqli extends DatabaseMysqlBase {
} 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
} 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();
}
$mysqli = mysqli_init();
@@
-111,9
+110,15
@@
class DatabaseMysqli extends DatabaseMysqlBase {
}
$mysqli->options( MYSQLI_OPT_CONNECT_TIMEOUT, 3 );
}
$mysqli->options( MYSQLI_OPT_CONNECT_TIMEOUT, 3 );
- if ( $mysqli->real_connect( $realServer, $this->user,
- $this->password, $this->dbName, $port, $socket, $connFlags )
- ) {
+ if ( $mysqli->real_connect(
+ $realServer,
+ $this->user,
+ $this->password,
+ $dbName,
+ $port,
+ $socket,
+ $connFlags
+ ) ) {
return $mysqli;
}
return $mysqli;
}
@@
-132,11
+137,7
@@
class DatabaseMysqli extends DatabaseMysqlBase {
protected function mysqlSetCharset( $charset ) {
$conn = $this->getBindingHandle();
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 );
}
/**
}
/**
@@
-177,18
+178,6
@@
class DatabaseMysqli extends DatabaseMysqlBase {
return $conn->affected_rows;
}
return $conn->affected_rows;
}
- /**
- * @param string $db
- * @return bool
- */
- function selectDB( $db ) {
- $conn = $this->getBindingHandle();
-
- $this->dbName = $db;
-
- return $conn->select_db( $db );
- }
-
/**
* @param mysqli_result $res
* @return bool
/**
* @param mysqli_result $res
* @return bool