48 $ret =
$conn->query( $sql, MYSQLI_USE_RESULT );
61 # Avoid suppressed fatal error, which is very hard to track down
62 if ( !function_exists(
'mysqli_init' ) ) {
64 .
" have you compiled PHP with the --with-mysqli option?\n" );
74 $realServer = $hostAndPort[0];
75 if ( $hostAndPort[1] ) {
76 $port = $hostAndPort[1];
78 } elseif ( substr_count( $realServer,
':' ) == 1 ) {
81 list( $realServer, $socket ) = explode(
':', $realServer, 2 );
84 $mysqli = mysqli_init();
87 if ( $this->flags & self::DBO_SSL ) {
88 $connFlags |= MYSQLI_CLIENT_SSL;
97 if ( $this->flags & self::DBO_COMPRESS ) {
98 $connFlags |= MYSQLI_CLIENT_COMPRESS;
100 if ( $this->flags & self::DBO_PERSISTENT ) {
101 $realServer =
'p:' . $realServer;
104 if ( $this->utf8Mode ) {
107 $mysqli->options( MYSQLI_SET_CHARSET_NAME,
'utf8' );
109 $mysqli->options( MYSQLI_SET_CHARSET_NAME,
'binary' );
111 $mysqli->options( MYSQLI_OPT_CONNECT_TIMEOUT, 3 );
113 if ( $mysqli->real_connect(
140 return $conn->set_charset( $charset );
149 return $conn->close();
158 return (
int)
$conn->insert_id;
165 if ( $this->conn instanceof mysqli ) {
166 return $this->conn->errno;
168 return mysqli_connect_errno();
178 return $conn->affected_rows;
196 $object =
$res->fetch_object();
197 if ( $object ===
null ) {
209 $array =
$res->fetch_array();
210 if ( $array ===
null ) {
222 return $res->num_rows;
230 return $res->field_count;
239 $field =
$res->fetch_field_direct( $n );
243 $field->not_null = $field->flags & MYSQLI_NOT_NULL_FLAG;
244 $field->primary_key = $field->flags & MYSQLI_PRI_KEY_FLAG;
245 $field->unique_key = $field->flags & MYSQLI_UNIQUE_KEY_FLAG;
246 $field->multiple_key = $field->flags & MYSQLI_MULTIPLE_KEY_FLAG;
247 $field->binary = $field->flags & MYSQLI_BINARY_FLAG;
248 $field->numeric = $field->flags & MYSQLI_NUM_FLAG;
249 $field->blob = $field->flags & MYSQLI_BLOB_FLAG;
250 $field->unsigned = $field->flags & MYSQLI_UNSIGNED_FLAG;
251 $field->zerofill = $field->flags & MYSQLI_ZEROFILL_FLAG;
262 $field =
$res->fetch_field_direct( $n );
273 $field =
$res->fetch_field_direct( $n );
284 return $res->data_seek( $row );
292 if (
$conn ===
null ) {
293 return mysqli_connect_error();
307 return $conn->real_escape_string( (
string)
$s );
317 if ( $this->conn instanceof mysqli ) {
318 return (
string)$this->conn->thread_id;
329 return parent::getBindingHandle();
336class_alias( DatabaseMysqli::class,
'DatabaseMysqli' );
Apache License January AND DISTRIBUTION Definitions License shall mean the terms and conditions for use
A collection of public static functions to play with IP address and IP ranges.
static splitHostAndPort( $both)
Given a host/port string, like one might find in the host part of a URL per RFC 2732,...
deferred txt A few of the database updates required by various functions here can be deferred until after the result page is displayed to the user For updating the view updating the linked to tables after a etc PHP does not yet have any way to tell the server to actually return and disconnect while still running these but it might have such a feature in the future We handle these by creating a deferred update object and putting those objects on a global list
null means default in associative array with keys and values unescaped Should be merged with default with a value of false meaning to suppress the attribute in associative array with keys and values unescaped noclasses & $ret
injection txt This is an overview of how MediaWiki makes use of dependency injection The design described here grew from the discussion of RFC T384 The term dependency this means that anything an object needs to operate should be injected from the the object itself should only know narrow no concrete implementation of the logic it relies on The requirement to inject everything typically results in an architecture that based on two main types of and essentially stateless service objects that use other service objects to operate on the value objects As of the beginning MediaWiki is only starting to use the DI approach Much of the code still relies on global state or direct resulting in a highly cyclical dependency which acts as the top level factory for services in MediaWiki which can be used to gain access to default instances of various services MediaWikiServices however also allows new services to be defined and default services to be redefined Services are defined or redefined by providing a callback the instantiator that will return a new instance of the service When it will create an instance of MediaWikiServices and populate it with the services defined in the files listed by thereby bootstrapping the DI framework Per $wgServiceWiringFiles lists includes ServiceWiring php