#49856 [Fbk->Opn]: SHOW COLUMNS FROM... return weird result set

From: Date: Wed, 04 Nov 2009 17:22:21 +0000
Subject: #49856 [Fbk->Opn]: SHOW COLUMNS FROM... return weird result set
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-144267@lists.php.net to get a copy of this message
ID: 49856 User updated by: joao at jjmf dot com Reported By: joao at jjmf dot com -Status: Feedback +Status: Open Bug Type: PDO related Operating System: CentOS 5.3 PHP Version: 5.3.0 New Comment: Mysql version is 5.0.77-3.el5 Previous Comments: ------------------------------------------------------------------------ [2009-11-04 17:09:06] uw@php.net What MySQL version are you using? ------------------------------------------------------------------------ [2009-10-13 02:23:02] joao at jjmf dot com Description: ------------ When executing the query "SHOW COLUMNS FROM table" it returns weird results. Database: MySQL. I think it's something related to CentOS 5.3 since I got this problem after migrating from Ubuntu. This never happened in Ubuntu. Reproduce code: --------------- --- From manual page: pdostatement.fetch#Descrição --- $pdo = new PDO( 'mysql:host=localhost;dbname=MYDB', 'MYUSER', 'MYPASS', array(PDO::MYSQL_ATTR_INIT_COMMAND => "SET NAMES utf8") ); $sql = "SHOW COLUMNS FROM tablename"; $sth = $pdo->prepare($sql); $sth->execute(); /* Exercise PDOStatement::fetch styles */ print("PDO::FETCH_ASSOC: "); print("Return next row as an array indexed by column name\n"); $result = $sth->fetch(PDO::FETCH_ASSOC); print_r($result); print("\n"); Expected result: ---------------- For each column an array like: [Field] => 'id_user' [Type] => 'int(11) unsigned' [Null] => 'NO' [Key] => 'PRI' [Default] => null [Extra] => 'auto_increment' Actual result: -------------- For each column an array like: [Field] => id_user [COLUMN_TYPE] => int(11) unsigned [COLUMNS] => NO [] => [def] => auto_increment ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=49856&edit=1

« previous php.bugs (#144267) next »