mysqli::reap_async_query

mysqli_reap_async_query

(PHP 5 >= 5.3.0, PHP 7)

mysqli::reap_async_query -- mysqli_reap_async_queryGet result from async query

설명

객체 기반 형식

public mysqli_result mysqli::reap_async_query ( void )

절차식 형식

mysqli_result mysqli_reap_async_query ( mysqli $link )

Get result from async query. mysqlnd에서만 사용할 수 있습니다.

인수

link

순차 형식 전용: mysqli_connect()mysqli_init()가 반환한 연결 식별자.

반환값

Returns mysqli_result in success, FALSE otherwise.

참고

add a note add a note

User Contributed Notes 1 note

up
4
eric dot caron at gmail dot com
13 years ago
Keep in mind that mysqli::reap_async_query only returns mysqli_result on queries like SELECT. For queries where you may be interested in things like affected_rows or insert_id, you can't work off of the result of mysqli::reap_async_query as the example in mysqli::poll leads you to believe. For INSERT/UPDATE/DELETE queries, the data corresponding to the query can be accessed through the associated key to the first array in the mysqli::poll function.

So instead of
<?php
   
foreach ($links as $link) {
        if (
$result = $link->reap_async_query()) {
           
print_r($result->fetch_row());
           
mysqli_free_result($result);
           
$processed++;
        }
    }
?>

The data is accessible via:
<?php
   
foreach ($links as $link) {
        if (
$result = $link->reap_async_query()) {
           
//This works for SELECT
           
if(is_object($result)){
               
print_r($result->fetch_row());
               
mysqli_free_result($result);
            }
           
//This works for INSERT/UPDATE/DELETE
           
else {
               
print_r($link);
            }
           
$processed++;
        }
    }
?>
To Top