From: Marcus Boerger Date: Fri, 7 Oct 2005 23:23:00 +0000 (+0000) Subject: - Add new test X-Git-Tag: RELEASE_0_9_1~197 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=babb2d5337b4fa78725def2e5b9a667544a9b682;p=php - Add new test --- diff --git a/ext/pdo/tests/pdo_031.phpt b/ext/pdo/tests/pdo_031.phpt new file mode 100755 index 0000000000..3baaf03217 --- /dev/null +++ b/ext/pdo/tests/pdo_031.phpt @@ -0,0 +1,63 @@ +--TEST-- +PDO Common: PDOStatement SPL iterator +--SKIPIF-- + +--FILE-- +exec('CREATE TABLE test(id INT NOT NULL PRIMARY KEY, val VARCHAR(10), val2 VARCHAR(16))'); + +$stmt = $db->prepare("INSERT INTO test VALUES(?, ?, ?)"); +foreach ($data as $row) { + $stmt->execute($row); +} + +unset($stmt); + +echo "===QUERY===\n"; + +$stmt = $db->query('SELECT * FROM test'); + +foreach(new RecursiveTreeIterator(new RecursiveArrayIterator($stmt->fetchAll(PDO::FETCH_ASSOC)), RecursiveIteratorIterator::SELF_FIRST) as $c=>$v) +{ + echo "$v [$c]\n"; +} + +echo "===DONE===\n"; +exit(0); +?> +--EXPECT-- +===QUERY=== +|-Array [0] +| |-10 [id] +| |-Abc [val] +| \-zxy [val2] +|-Array [1] +| |-20 [id] +| |-Def [val] +| \-wvu [val2] +\-Array [2] + |-30 [id] + |-Ghi [val] + \-tsr [val2] +===DONE===