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

From: Date: Wed, 04 Nov 2009 17:09:07 +0000
Subject: #49856 [Opn->Fbk]: SHOW COLUMNS FROM... return weird result set
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-144264@lists.php.net to get a copy of this message
ID: 49856 Updated by: uw@php.net Reported By: joao at jjmf dot com -Status: Open +Status: Feedback Bug Type: PDO related Operating System: CentOS 5.3 PHP Version: 5.3.0 New Comment: What MySQL version are you using? Previous Comments: ------------------------------------------------------------------------ [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 (#144264) next »