39 $ret = mysql_query( $sql, $conn );
41 $ret = mysql_unbuffered_query( $sql, $conn );
53 # Avoid a suppressed fatal error, which is very hard to track down
54 if ( !extension_loaded(
'mysql' ) ) {
57 "MySQL functions missing, have you compiled PHP with the --with-mysql option?\n"
62 if ( $this->mFlags & self::DBO_SSL ) {
63 $connFlags |= MYSQL_CLIENT_SSL;
65 if ( $this->mFlags & self::DBO_COMPRESS ) {
66 $connFlags |= MYSQL_CLIENT_COMPRESS;
69 if ( ini_get(
'mysql.connect_timeout' ) <= 3 ) {
77 # The kernel's default SYN retransmission period is far too slow for us,
78 # so we use a short timeout plus a manual retry. Retrying means that a small
79 # but finite rate of SYN packet loss won't cause user-visible errors.
80 for ( $i = 0; $i < $numAttempts && !$conn; $i++ ) {
84 if ( $this->mFlags & self::DBO_PERSISTENT ) {
85 $conn = mysql_pconnect( $realServer, $this->mUser, $this->mPassword, $connFlags );
87 # Create a new connection...
88 $conn = mysql_connect( $realServer, $this->mUser, $this->mPassword,
true, $connFlags );
102 if ( function_exists(
'mysql_set_charset' ) ) {
103 return mysql_set_charset( $charset, $conn );
105 return $this->
query(
'SET NAMES ' . $charset, __METHOD__ );
115 return mysql_close( $conn );
124 return mysql_insert_id( $conn );
131 if ( $this->mConn ) {
132 return mysql_errno( $this->mConn );
134 return mysql_errno();
144 return mysql_affected_rows( $conn );
154 $this->mDBname = $db;
156 return mysql_select_db( $db, $conn );
160 return mysql_free_result(
$res );
164 return mysql_fetch_object(
$res );
168 return mysql_fetch_array(
$res );
172 return mysql_num_rows(
$res );
176 return mysql_num_fields(
$res );
180 return mysql_fetch_field(
$res, $n );
184 return mysql_field_name(
$res, $n );
188 return mysql_field_type(
$res, $n );
192 return mysql_data_seek(
$res, $row );
196 return ( $conn !==
null ) ? mysql_error( $conn ) : mysql_error();
202 return mysql_real_escape_string(
$s, $conn );
Database abstraction object for MySQL.
Database abstraction object for PHP extension mysql.
mysqlNumRows( $res)
Get number of rows in result.
mysqlDataSeek( $res, $row)
Move internal result pointer.
mysqlFetchField( $res, $n)
Get column information from a result.
mysqlError( $conn=null)
Returns the text of the error message from previous MySQL operation.
mysqlFreeResult( $res)
Free result memory.
mysqlSetCharset( $charset)
mysqlFieldType( $res, $n)
Get the type of the specified field in a result.
mysqlFieldName( $res, $n)
Get the name of the specified field in a result.
mysqlFetchObject( $res)
Fetch a result row as an object.
mysqlRealEscapeString( $s)
mysqlFetchArray( $res)
Fetch a result row as an associative and numeric array.
mysqlConnect( $realServer)
mysqlNumFields( $res)
Get number of fields in result.
bufferResults( $buffer=null)
Turns buffering of SQL result sets on (true) or off (false).
getBindingHandle()
Get the underlying binding handle, mConn.
query( $sql, $fname=__METHOD__, $tempIgnore=false)
Run an SQL query and return the result.
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