54 $qsByStatementId = [];
56 $conn = $this->getBindingHandle();
58 while ( $conn->more_results() && $conn->next_result() ) {
59 $mysqliResult = $conn->store_result();
60 $mysqliResult->free();
63 $combinedSql = implode(
";\n", $sqls );
64 $conn->multi_query( $combinedSql );
69 $mysqliResult = $conn->store_result();
70 $statementId = key( $sqls );
71 if ( $statementId !==
null ) {
73 if ( $mysqliResult ===
false ) {
74 $res = ( $conn->errno === 0 );
75 } elseif ( $mysqliResult instanceof mysqli_result ) {
76 $res =
new MysqliResultWrapper( $this, $mysqliResult );
80 $qsByStatementId[$statementId] =
new QueryStatus(
88 if ( $conn->more_results() ) {
95 while ( ( $statementId = key( $sqls ) ) !==
null ) {
96 $qsByStatementId[$statementId] =
new QueryStatus(
false, 0,
'Query aborted', 0 );
100 return $qsByStatementId;
112 if ( !function_exists(
'mysqli_init' ) ) {
113 throw $this->newExceptionAfterConnectError(
114 "MySQLi functions missing, have you compiled PHP with the --with-mysqli option?"
119 mysqli_report( MYSQLI_REPORT_OFF );
131 $hostAndPort = IPUtils::splitHostAndPort( $server );
132 if ( $hostAndPort ) {
133 $realServer = $hostAndPort[0];
134 if ( $hostAndPort[1] ) {
135 $port = $hostAndPort[1];
137 } elseif ( substr_count( $server,
':/' ) == 1 ) {
140 list( $realServer, $socket ) = explode(
':', $server, 2 );
142 $realServer = $server;
145 $mysqli = mysqli_init();
149 $flags = MYSQLI_CLIENT_FOUND_ROWS;
151 $flags |= MYSQLI_CLIENT_SSL;
160 if ( $this->getFlag( self::DBO_COMPRESS ) ) {
161 $flags |= MYSQLI_CLIENT_COMPRESS;
163 if ( $this->getFlag( self::DBO_PERSISTENT ) ) {
164 $realServer =
'p:' . $realServer;
167 if ( $this->utf8Mode ) {
170 $mysqli->options( MYSQLI_SET_CHARSET_NAME,
'utf8' );
172 $mysqli->options( MYSQLI_SET_CHARSET_NAME,
'binary' );
174 $mysqli->options( MYSQLI_OPT_CONNECT_TIMEOUT, 3 );
177 $ok = $mysqli->real_connect( $realServer, $user, $password, $db, $port, $socket, $flags );
179 return $ok ? $mysqli :
null;