|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #46533 PDOStatement::getColumnMeta lacks some information regarding aliases
Submitted: 2008-11-10 10:09 UTC Modified: 2008-11-17 17:32 UTC
Avg. Score:4.7 ± 0.5
Reproduced:3 of 3 (100.0%)
Same Version:1 (33.3%)
Same OS:1 (33.3%)
From: taco at procurios dot nl Assigned: mysql (profile)
Status: Wont fix Package: PDO related
PHP Version: 5.2.6 OS: Linux
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
Block user comment
Status: Assign to:
Bug Type:
From: taco at procurios dot nl
New email:
PHP Version: OS:


 [2008-11-10 10:09 UTC] taco at procurios dot nl
When using aliases for tables and/or columns in a MySQL query. The method PDOStatement::getColumnMeta() will not tell you anything about the original table / column name. In the MySQLi extension the information about the original table / column name was represented as 'orgtable' and 'orgname' this would be a very nice addition to the PDO extension.

Reproduce code:
CREATE TABLE `foobar` (
  `bar` varchar(255) default NULL

  $PDO->query("SELECT as baz FROM foobar foo")

Expected result:
    [native_type] => VAR_STRING
    [flags] => Array

    [table] => foo
    [orgtable] => foobar
    [name] => baz
    [orgname] => bar
    [len] => 255
    [precision] => 0
    [pdo_type] => 2

Actual result:
    [native_type] => VAR_STRING
    [flags] => Array

    [table] => foo
    [name] => baz
    [len] => 255
    [precision] => 0
    [pdo_type] => 2


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2008-11-17 17:32 UTC]
This won't be fixed till we get a PDO2 (or whatever there will be in future) as there is no specification about naming of custom elements. Adding them randomly in one driver isn't good for an "abstraction layer".
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Wed Jun 19 08:01:31 2024 UTC