var_dump($info2);
}
+ if (!is_array($info = $link->get_connection_stats()) || empty($info))
+ printf("[006] Expecting array/any_non_empty, got %s/%s\n", gettype($info), $info);
+
+ foreach ($info as $k => &$v) {
+ if (strpos($k, "mem_") === 0) {
+ $v = 0;
+ }
+ }
+
+ if ($info !== $info2) {
+ printf("[007] The hashes should be identical except of the memory related fields\n");
+ var_dump($info);
+ var_dump($info2);
+ }
+
mysqli_close($link);
include "table.inc";
if (!is_array($info = mysqli_get_connection_stats($link)) || empty($info))
- printf("[006] Expecting array/any_non_empty, got %s/%s\n", gettype($info), $info);
+ printf("[008] Expecting array/any_non_empty, got %s/%s\n", gettype($info), $info);
if (!is_array($info2 = mysqli_get_client_stats()) || empty($info2))
- printf("[007] Expecting array/any_non_empty, got %s/%s\n", gettype($info2), $info2);
+ printf("[009] Expecting array/any_non_empty, got %s/%s\n", gettype($info2), $info2);
// assuming the test is run in a plain-vanilla CLI environment
if ($info === $info2) {
- printf("[008] The hashes should not be identical\n");
+ printf("[010] The hashes should not be identical\n");
var_dump($info);
var_dump($info2);
}
printf("[009] Expecting int/0 got %s/%s\n", gettype($tmp), var_export($tmp, true));
- function poll_async($offset, $links, $errors, $reject, $exp_ready) {
-
- if ($exp_ready !== ($tmp = mysqli_poll($links, $errors, $reject, 0, 1000)))
- printf("[%03d + 1] There should be %d links ready to read from, %d ready\n",
- $exp_ready, $tmp);
+ function poll_async($offset, $link, $links, $errors, $reject, $exp_ready, $use_oo_syntax) {
+
+ if ($use_oo_syntax) {
+ if ($exp_ready !== ($tmp = $link->poll($links, $errors, $reject, 0, 1000)))
+ printf("[%03d + 1] There should be %d links ready to read from, %d ready\n",
+ $exp_ready, $tmp);
+ } else {
+ if ($exp_ready !== ($tmp = mysqli_poll($links, $errors, $reject, 0, 1000)))
+ printf("[%03d + 1] There should be %d links ready to read from, %d ready\n",
+ $exp_ready, $tmp);
+ }
foreach ($links as $mysqli) {
- if (is_object($res = mysqli_reap_async_query($mysqli))) {
+ if ($use_oo_syntax) {
+ $res = $mysqli->reap_async_query();
+ } else {
+ $res = mysqli_reap_async_query($mysqli);
+ }
+ if (is_object($res)) {
printf("[%03d + 2] Can fetch resultset although no query has been run!\n", $offset);
} else if (mysqli_errno($mysqli) > 0) {
printf("[%03d + 3] Error indicated through links array: %d/%s",
$links = array($link);
$errors = array($link);
$reject = array($link);
- poll_async(10, $links, $errors, $reject, 0);
+ poll_async(10, $link, $links, $errors, $reject, 0, false);
+ mysqli_close($link);
+
+ $link = get_connection();
+ $links = array($link);
+ $errors = array($link);
+ $reject = array($link);
+ poll_async(11, $link, $links, $errors, $reject, 0, true);
mysqli_close($link);
// Connections on which no query has been send - 2
$links = array($link, $link);
$errors = array($link, $link);
$reject = array();
- poll_async(11, $links, $errors, $reject, 0);
+ poll_async(12, $link, $links, $errors, $reject, 0, false);
// Connections on which no query has been send - 3
// Difference: pass two connections
$links = array($link, get_connection());
$errors = array($link, $link);
$reject = array();
- poll_async(12, $links, $errors, $reject, 0);
+ poll_async(13, $link, $links, $errors, $reject, 0, false);
// Reference mess...
$link = get_connection();
$errors = array($link);
$ref_errors =& $errors;
$reject = array();
- poll_async(13, $links, $ref_errors, $reject, 0);
+ poll_async(14, $link, $links, $ref_errors, $reject, 0, false);
print "done!";
?>
--EXPECTF--
[010 + 6] Rejecting thread %d: 0/
[011 + 6] Rejecting thread %d: 0/
-[011 + 6] Rejecting thread %d: 0/
[012 + 6] Rejecting thread %d: 0/
[012 + 6] Rejecting thread %d: 0/
[013 + 6] Rejecting thread %d: 0/
+[013 + 6] Rejecting thread %d: 0/
+[014 + 6] Rejecting thread %d: 0/
done!