diff options
| author | Marcus Boerger <helly@php.net> | 2005-02-19 23:48:47 +0000 |
|---|---|---|
| committer | Marcus Boerger <helly@php.net> | 2005-02-19 23:48:47 +0000 |
| commit | 6045a3a5e1ac4207b1f76471bc405ae791471a2e (patch) | |
| tree | 56ecc3f19b40b270c1d6c0d74bf645620ed9c90c /ext/pdo_sqlite/tests | |
| parent | b788dc9d2a22760967a0727139873eaf4253e81a (diff) | |
| download | php-git-6045a3a5e1ac4207b1f76471bc405ae791471a2e.tar.gz | |
- Add test
Diffstat (limited to 'ext/pdo_sqlite/tests')
| -rwxr-xr-x | ext/pdo_sqlite/tests/pdo_sqlite_007.phpt | 57 |
1 files changed, 57 insertions, 0 deletions
diff --git a/ext/pdo_sqlite/tests/pdo_sqlite_007.phpt b/ext/pdo_sqlite/tests/pdo_sqlite_007.phpt new file mode 100755 index 0000000000..66604b3b09 --- /dev/null +++ b/ext/pdo_sqlite/tests/pdo_sqlite_007.phpt @@ -0,0 +1,57 @@ +--TEST-- +PDO-SQLite: PDO_FETCH_UNIQUE +--SKIPIF-- +<?php # vim:ft=php +if (!extension_loaded("pdo_sqlite")) print "skip"; ?> +--FILE-- +<?php + +$db =new pdo('sqlite::memory:'); + +$db->exec('CREATE TABLE test(id CHAR(1) PRIMARY KEY, val VARCHAR(10))'); +$db->exec('INSERT INTO test VALUES("A", "A")'); +$db->exec('INSERT INTO test VALUES("B", "A")'); +$db->exec('INSERT INTO test VALUES("C", "C")'); + +var_dump($db->query('SELECT id, val FROM test')->fetchAll(PDO_FETCH_NUM|PDO_FETCH_UNIQUE)); +var_dump($db->query('SELECT id, val FROM test')->fetchAll(PDO_FETCH_ASSOC|PDO_FETCH_UNIQUE)); + +?> +===DONE=== +<?php exit(0); ?> +--EXPECTF-- +array(3) { + ["A"]=> + array(1) { + [0]=> + string(1) "A" + } + ["B"]=> + array(1) { + [0]=> + string(1) "A" + } + ["C"]=> + array(1) { + [0]=> + string(1) "C" + } +} +array(3) { + ["A"]=> + array(1) { + ["val"]=> + string(1) "A" + } + ["B"]=> + array(1) { + ["val"]=> + string(1) "A" + } + ["C"]=> + array(1) { + ["val"]=> + string(1) "C" + } +} +===DONE=== |
