diff options
author | Wez Furlong <wez@php.net> | 2005-07-06 06:07:26 +0000 |
---|---|---|
committer | Wez Furlong <wez@php.net> | 2005-07-06 06:07:26 +0000 |
commit | 14dbb2dfe9495e07f1e1f57eb640723665750fc0 (patch) | |
tree | 62bd45b83403e9c92464992b16d7974d9b959895 /ext/pdo/tests/pdo_019.phpt | |
parent | 5b84ae26abe572381b1fdf9248c75a2af4226f45 (diff) | |
download | php-git-14dbb2dfe9495e07f1e1f57eb640723665750fc0.tar.gz |
Add tests that can be redirected to with new test harness feature.
Diffstat (limited to 'ext/pdo/tests/pdo_019.phpt')
-rw-r--r-- | ext/pdo/tests/pdo_019.phpt | 67 |
1 files changed, 67 insertions, 0 deletions
diff --git a/ext/pdo/tests/pdo_019.phpt b/ext/pdo/tests/pdo_019.phpt new file mode 100644 index 0000000000..c7af4f1d28 --- /dev/null +++ b/ext/pdo/tests/pdo_019.phpt @@ -0,0 +1,67 @@ +--TEST-- +PDO Common: fetch() and while() +--SKIPIF-- +<?php # vim:ft=php +if (!extension_loaded('pdo')) print 'skip'; +if (false == getenv('REDIR_TEST_DIR')) print 'skip no driver'; +?> +--FILE-- +<?php +require getenv('REDIR_TEST_DIR') . 'pdo_test.php'; +$db = PDOTest::factory(); + +$db->exec('CREATE TABLE test(idx int NOT NULL PRIMARY KEY, txt VARCHAR(20))'); +$db->exec('INSERT INTO test VALUES(0, \'String0\')'); +$db->exec('INSERT INTO test VALUES(1, \'String1\')'); +$db->exec('INSERT INTO test VALUES(2, \'String2\')'); +$db->exec('INSERT INTO test VALUES(3, \'String3\')'); + + +var_dump($db->query('SELECT COUNT(*) FROM test')->fetchColumn()); + +$stmt = $db->prepare('SELECT idx, txt FROM test ORDER by idx'); + +$stmt->execute(); +$cont = $stmt->fetchAll(PDO_FETCH_COLUMN|PDO_FETCH_UNIQUE); +var_dump($cont); + +echo "===WHILE===\n"; + +$stmt->bindColumn('idx', $idx); +$stmt->bindColumn('txt', $txt); +$stmt->execute(); + +while($stmt->fetch(PDO_FETCH_BOUND)) { + var_dump(array($idx=>$txt)); +} + +?> +--EXPECT-- +string(1) "4" +array(4) { + [0]=> + string(7) "String0" + [1]=> + string(7) "String1" + [2]=> + string(7) "String2" + [3]=> + string(7) "String3" +} +===WHILE=== +array(1) { + [0]=> + string(7) "String0" +} +array(1) { + [1]=> + string(7) "String1" +} +array(1) { + [2]=> + string(7) "String2" +} +array(1) { + [3]=> + string(7) "String3" +} |