List:Commits« Previous MessageNext Message »
From:ahristov Date:February 22 2008 7:02pm
Subject:PHP mysqlnd svn commit: r1304 - trunk/tests/ext/mysqli
View as plain text  
Author: ahristov
Date: 2008-02-22 19:02:41 +0100 (Fri, 22 Feb 2008)
New Revision: 1304

Modified:
   trunk/tests/ext/mysqli/mysqli_async_query.phpt
Log:
Add a test case to async queries - getting an error from execution


Modified: trunk/tests/ext/mysqli/mysqli_async_query.phpt
===================================================================
--- trunk/tests/ext/mysqli/mysqli_async_query.phpt	2008-02-22 11:49:32 UTC (rev 1303)
+++ trunk/tests/ext/mysqli/mysqli_async_query.phpt	2008-02-22 18:02:41 UTC (rev 1304)
@@ -62,6 +62,50 @@
 		}
 	} while (count($all_links) > 0);
 
+	echo "Now checking errors\n";
+
+	$ok = mysqli_query($link1, 'ELECT 1', MYSQLI_USE_RESULT | MYSQLI_ASYNC);
+	if (true !== $ok)
+		printf("[008] Expecting boolean/true got %s/%s, [%d] %s\n",
+			gettype($ok), $ok,  mysqli_errno($link1), mysqli_error($link1));
+	
+	$ok = mysqli_query($link2, 'INSERT 1', MYSQLI_USE_RESULT | MYSQLI_ASYNC);
+	if (true !== $ok)
+		printf("[009] Expecting boolean/true got %s/%s, [%d] %s\n",
+			gettype($ok), $ok,  mysqli_errno($link2), mysqli_error($link2));
+
+	$all_links[$link1->thread_id] = $link1;
+	$all_links[$link2->thread_id] = $link2;
+
+	do {
+		foreach ($all_links as $link) {
+			$links_read[] = $link;
+			$links_err[] = $link;
+		}
+		$num_ready = mysqli_poll($links_read, NULL, $links_err, 1, 0);
+		if (count($links_read) + count($links_err) == 0) {
+			continue;
+		}
+		if (count($links_err)) {
+			echo "Error while reading from the links\n";
+			var_dump($links_err);
+			break(2);
+		}
+		foreach ($links_read as $k => $link) {
+			/*
+			  This should not happen, but if does, then it will break the
+			  test and we will see the data
+			*/
+			if ($res = mysqli_reap_async_query($link)) {
+				echo "Should not happen!\n";
+				break(2);
+			} else {
+				echo "Read error from link - ok\n";
+				unset($all_links[$link->thread_id]);			
+			}
+		}
+	} while (count($all_links) > 0);
+
 	print "done!";
 ?>
 --EXPECTF--
@@ -101,6 +145,9 @@
   ["label"]=>
   string(1) "c"
 }
+Now checking errors
+Read error from link - ok
+Read error from link - ok
 done!
 --UEXPECTF--
 array(2) {
@@ -139,4 +186,7 @@
   [u"label"]=>
   unicode(1) "c"
 }
+Now checking errors
+Read error from link - ok
+Read error from link - ok
 done!

Thread
PHP mysqlnd svn commit: r1304 - trunk/tests/ext/mysqliahristov22 Feb