X-Git-Url: https://git.m6w6.name/?a=blobdiff_plain;f=tests%2Fasync009.phpt;fp=tests%2Fasync009.phpt;h=457899494b75e3adb4f13517301fe3e7c892706f;hb=7b61b6b19fea328ec2ccd767bf9dd4d4b3c0892f;hp=0000000000000000000000000000000000000000;hpb=56e9738f80aee54b362f90a42c724abad5378e31;p=m6w6%2Fext-pq diff --git a/tests/async009.phpt b/tests/async009.phpt new file mode 100644 index 0000000..4578994 --- /dev/null +++ b/tests/async009.phpt @@ -0,0 +1,53 @@ +--TEST-- +Deallocate and prepare statement async +--SKIPIF-- + +--FILE-- +busy) { + $r = array($c->socket); + $w = $e = null; + if (stream_select($r, $w, $e, null)) { + $c->poll(); + } + } + } while ($c->getResult()); +} + +$c = new pq\Connection(PQ_DSN); +$s = $c->prepareAsync("test1", "SELECT 'test' || \$1"); +complete($c); + +$r = $s->exec(array("ing")); +$r->fetchCol($d); +var_dump($d); + +$s->deallocateAsync(); +complete($c); + +try { + $s->exec(array("ing")); +} catch (pq\Exception\BadMethodCallException $e) { + echo "Caught exception\n"; +} + +$s->prepareAsync(); +complete($c); + +$r = $s->exec(array("ing")); +$r->fetchCol($d); +var_dump($d); + +?> +DONE +--EXPECT-- +Test +string(7) "testing" +Caught exception +string(7) "testing" +DONE