A big lack in PHP PDO

It seems to me that none in the world needs to get meta-info from a query like this:

SELECT * FROM table1 JOIN table2 ON (table1.id=table2.id)

I need to know from which table are the returned columns from. That’s not possible. It was possible with some old PHP DB drivers (not for all and I can’t understand why) but it’s not possible with PDO (and also Zend_DB does strange things about that but it’s very limited).

Let’s look at the situation, PDO has the PDOStatement->getColumnMeta() method but:

  • This function is EXPERIMENTAL. The behaviour of this function, the name of this function, and anything else documented about this function may change without notice in a future release of PHP. Use this function at your own risk.
  • Not all PDO drivers support PDOStatement->getColumnMeta().
  • withit the returned data there isn’t the table name

I filled a bug some time ago and some developer add that feature for MySQL but they don’t understand that it’s needed for every DB adapter and it was already done by some old functions.

Maybe no PHP developer need such kind of abstraction.

Leave a Reply

Your email address will not be published. Required fields are marked *