1--TEST-- 2PDO Common: PDO::FETCH_GROUP 3--EXTENSIONS-- 4pdo 5--SKIPIF-- 6<?php 7$dir = getenv('REDIR_TEST_DIR'); 8if (false == $dir) die('skip no driver'); 9require_once $dir . 'pdo_test.inc'; 10PDOTest::skip(); 11?> 12--FILE-- 13<?php 14if (getenv('REDIR_TEST_DIR') === false) putenv('REDIR_TEST_DIR='.__DIR__ . '/../../pdo/tests/'); 15require_once getenv('REDIR_TEST_DIR') . 'pdo_test.inc'; 16$db = PDOTest::factory(); 17 18$db->exec('CREATE TABLE test006(id int NOT NULL PRIMARY KEY, val VARCHAR(10))'); 19$db->exec("INSERT INTO test006 VALUES(1, 'A')"); 20$db->exec("INSERT INTO test006 VALUES(2, 'A')"); 21$db->exec("INSERT INTO test006 VALUES(3, 'C')"); 22 23$stmt = $db->prepare('SELECT val, id from test006'); 24 25$stmt->execute(); 26var_dump($stmt->fetchAll(PDO::FETCH_NUM|PDO::FETCH_GROUP)); 27 28$stmt->execute(); 29var_dump($stmt->fetchAll(PDO::FETCH_ASSOC|PDO::FETCH_GROUP)); 30 31?> 32--CLEAN-- 33<?php 34require_once getenv('REDIR_TEST_DIR') . 'pdo_test.inc'; 35$db = PDOTest::factory(); 36PDOTest::dropTableIfExists($db, "test006"); 37?> 38--EXPECT-- 39array(2) { 40 ["A"]=> 41 array(2) { 42 [0]=> 43 array(1) { 44 [0]=> 45 string(1) "1" 46 } 47 [1]=> 48 array(1) { 49 [0]=> 50 string(1) "2" 51 } 52 } 53 ["C"]=> 54 array(1) { 55 [0]=> 56 array(1) { 57 [0]=> 58 string(1) "3" 59 } 60 } 61} 62array(2) { 63 ["A"]=> 64 array(2) { 65 [0]=> 66 array(1) { 67 ["id"]=> 68 string(1) "1" 69 } 70 [1]=> 71 array(1) { 72 ["id"]=> 73 string(1) "2" 74 } 75 } 76 ["C"]=> 77 array(1) { 78 [0]=> 79 array(1) { 80 ["id"]=> 81 string(1) "3" 82 } 83 } 84} 85