Annotation of embedaddon/php/ext/pdo/tests/bug_42917.phpt, revision 1.1.1.1
1.1 misho 1: --TEST--
2: PDO Common: Bug #42917 (PDO::FETCH_KEY_PAIR doesn't work with setFetchMode)
3: --SKIPIF--
4: <?php # vim:ft=php
5: if (!extension_loaded('pdo')) die('skip');
6: $dir = getenv('REDIR_TEST_DIR');
7: if (false == $dir) die('skip no driver');
8: require_once $dir . 'pdo_test.inc';
9: PDOTest::skip();
10: ?>
11: --FILE--
12: <?php
13: if (getenv('REDIR_TEST_DIR') === false) putenv('REDIR_TEST_DIR='.dirname(__FILE__) . '/../../pdo/tests/');
14: require_once getenv('REDIR_TEST_DIR') . 'pdo_test.inc';
15: $db = PDOTest::factory();
16:
17: $db->exec("CREATE TABLE test (a varchar(100), b varchar(100), c varchar(100))");
18:
19: for ($i = 0; $i < 5; $i++) {
20: $db->exec("INSERT INTO test (a,b,c) VALUES('test".$i."','".$i."','".$i."')");
21: }
22:
23: $res = $db->query("SELECT a,b FROM test");
24: $res->setFetchMode(PDO::FETCH_KEY_PAIR);
25: var_dump($res->fetchAll());
26:
27: ?>
28: --EXPECT--
29: array(5) {
30: ["test0"]=>
31: string(1) "0"
32: ["test1"]=>
33: string(1) "1"
34: ["test2"]=>
35: string(1) "2"
36: ["test3"]=>
37: string(1) "3"
38: ["test4"]=>
39: string(1) "4"
40: }
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>