From: Georg Richter Date: Wed, 22 Jun 2005 10:14:32 +0000 (+0000) Subject: added testcase for cursors (nested selects) X-Git-Tag: php-5.1.0b2~15 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=976be82fb97b22c6f625579f0a2f0fce96639724;p=php added testcase for cursors (nested selects) --- diff --git a/ext/mysqli/tests/067.phpt b/ext/mysqli/tests/067.phpt new file mode 100644 index 0000000000..d58d24cfee --- /dev/null +++ b/ext/mysqli/tests/067.phpt @@ -0,0 +1,51 @@ +--TEST-- +function test: nested selects (cursors) +--SKIPIF-- + +--FILE-- +prepare($query); + $stmt->attr_set(MYSQLI_STMT_ATTR_CURSOR_TYPE, MYSQLI_CURSOR_TYPE_READ_ONLY); + return $stmt; + } + + include "connect.inc"; + $a = array(); + + /*** test mysqli_connect 127.0.0.1 ***/ + $mysql = new mysqli($host, $user, $passwd, "test"); + + for ($i=0;$i < 3; $i++) { + $mysql->query("DROP TABLE IF EXISTS cursor$i"); + $mysql->query("CREATE TABLE cursor$i (a int not null)"); + $mysql->query("INSERT INTO cursor$i VALUES (1),(2),(3),(4),(5),(6)"); + $stmt[$i] = open_cursor($mysql, "SELECT a FROM cursor$i"); + $stmt[$i]->execute(); + $stmt[$i]->bind_result($a[$i]); + } + + + $cnt = 0; + while ($stmt[0]->fetch()) { + $stmt[1]->fetch(); + $stmt[2]->fetch(); + $cnt += $a[0] + $a[1] + $a[2]; + } + + for ($i=0; $i < 3; $i++) { + $stmt[$i]->close(); + } + + $mysql->close(); + var_dump($cnt); +?> +--EXPECT-- +int(63)