59 if ( !function_exists(
'mysqli_init' ) ) {
61 "MySQLi functions missing, have you compiled PHP with the --with-mysqli option?"
66 mysqli_report( MYSQLI_REPORT_OFF );
78 $hostAndPort = IPUtils::splitHostAndPort( $realServer );
80 $realServer = $hostAndPort[0];
81 if ( $hostAndPort[1] ) {
82 $port = $hostAndPort[1];
84 } elseif ( substr_count( $realServer,
':/' ) == 1 ) {
87 list( $realServer, $socket ) = explode(
':', $realServer, 2 );
90 $mysqli = mysqli_init();
94 $connFlags = MYSQLI_CLIENT_FOUND_ROWS;
95 if ( $this->
getFlag( self::DBO_SSL ) ) {
96 $connFlags |= MYSQLI_CLIENT_SSL;
105 if ( $this->
getFlag( self::DBO_COMPRESS ) ) {
106 $connFlags |= MYSQLI_CLIENT_COMPRESS;
108 if ( $this->
getFlag( self::DBO_PERSISTENT ) ) {
109 $realServer =
'p:' . $realServer;
112 if ( $this->utf8Mode ) {
115 $mysqli->options( MYSQLI_SET_CHARSET_NAME,
'utf8' );
117 $mysqli->options( MYSQLI_SET_CHARSET_NAME,
'binary' );
119 $mysqli->options( MYSQLI_OPT_CONNECT_TIMEOUT, 3 );
121 if ( $mysqli->real_connect(
232 $field =
$res->fetch_field_direct( $n );
236 $field->not_null = $field->flags & MYSQLI_NOT_NULL_FLAG;
237 $field->primary_key = $field->flags & MYSQLI_PRI_KEY_FLAG;
238 $field->unique_key = $field->flags & MYSQLI_UNIQUE_KEY_FLAG;
239 $field->multiple_key = $field->flags & MYSQLI_MULTIPLE_KEY_FLAG;
240 $field->binary = $field->flags & MYSQLI_BINARY_FLAG;
241 $field->numeric = $field->flags & MYSQLI_NUM_FLAG;
242 $field->blob = $field->flags & MYSQLI_BLOB_FLAG;
243 $field->unsigned = $field->flags & MYSQLI_UNSIGNED_FLAG;
244 $field->zerofill = $field->flags & MYSQLI_ZEROFILL_FLAG;