©
このドキュメントでは、 php中国語ネットマニュアル リリース
(PHP 5 >= 5.3.0)
mysqli::reap_async_query -- mysqli_reap_async_query — Get result from async query
面向对象风格
过程化风格
$link
)Get result from async query. 仅可用于 mysqlnd。
link
仅以过程化样式:由 mysqli_connect() 或 mysqli_init() 返回的链接标识。
Returns mysqli_result in success, FALSE
otherwise.
[#1] eric dot caron at gmail dot com [2010-05-06 23:05:02]
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++;
}
}
?>