1--TEST-- 2PDO::ATTR_FETCH_TABLE_NAMES 3--EXTENSIONS-- 4pdo_mysql 5--SKIPIF-- 6<?php 7require_once(__DIR__ . DIRECTORY_SEPARATOR . 'mysql_pdo_test.inc'); 8MySQLPDOTest::skip(); 9?> 10--FILE-- 11<?php 12 require_once(__DIR__ . DIRECTORY_SEPARATOR . 'mysql_pdo_test.inc'); 13 $db = MySQLPDOTest::factory(); 14 MySQLPDOTest::createTestTable($db); 15 16 $db->setAttribute(PDO::ATTR_FETCH_TABLE_NAMES, 1); 17 $stmt = $db->query('SELECT label FROM test LIMIT 1'); 18 var_dump($stmt->fetchAll(PDO::FETCH_ASSOC)); 19 $stmt->closeCursor(); 20 21 $db->setAttribute(PDO::ATTR_FETCH_TABLE_NAMES, 0); 22 $stmt = $db->query('SELECT label FROM test LIMIT 1'); 23 var_dump($stmt->fetchAll(PDO::FETCH_ASSOC)); 24 $stmt->closeCursor(); 25 26 print "done!"; 27?> 28--EXPECT-- 29array(1) { 30 [0]=> 31 array(1) { 32 ["test.label"]=> 33 string(1) "a" 34 } 35} 36array(1) { 37 [0]=> 38 array(1) { 39 ["label"]=> 40 string(1) "a" 41 } 42} 43done! 44