|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #41416 getColumnMeta() should also return table name
Submitted: 2007-05-17 13:25 UTC Modified: 2007-06-13 11:58 UTC
From: fabrizio dot balliano at crealabs dot it Assigned:
Status: Closed Package: Feature/Change Request
PHP Version: 5.2.2 OS:
Private report: No CVE-ID: None
 [2007-05-17 13:25 UTC] fabrizio dot balliano at crealabs dot it
if you run a query with joins is really useful to have the getcolumnmeta to return the table name thus I can understand from the resultset with field come from every table

now it's possible to do that with


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2007-05-17 14:10 UTC]
Thank you for this bug report. To properly diagnose the problem, we
need a short but complete example script to be able to reproduce
this bug ourselves. 

A proper reproducing script starts with <?php and ends with ?>,
is max. 10-20 lines long and does not require any external 
resources such as databases, etc. If the script requires a 
database to demonstrate the issue, please make sure it creates 
all necessary tables, stored procedures etc.

Please avoid embedding huge scripts into the report.

 [2007-05-17 14:16 UTC] fabrizio dot balliano at crealabs dot it
there's no need for test scripts, point just is that calling getColumnMeta() should return the table name of the column
 [2007-05-17 14:23 UTC]
I'm going to look into it and I would like to have a test script handy. I guess you already have one, please provide it, so that I wouldn't have to spend time on it.
Thank you.
 [2007-05-17 14:29 UTC] fabrizio dot balliano at crealabs dot it
actually i don't have a test script...

just run something like

select * from table1 join table2 on (

the resultset wouldn't allow me to know with field come from table1 or table2, thus you call eg:


and you should also get table_name=>table1 or table2 or whatever
 [2007-05-17 14:58 UTC]
Then please create one, I'll look into the feature request after that.
 [2007-05-17 15:03 UTC] fabrizio dot balliano at crealabs dot it
$select = $DB->query('SELECT * FROM table1 JOIN table2 ON ( =');
$colcount = $select->columnCount();

for ($i=0; $i<$colcount; $i++) {
  $meta = $select->getColumnMeta(0);
 [2007-05-17 15:12 UTC]
This bug has been fixed in CVS.

Snapshots of the sources are packaged every three hours; this change
will be in the next snapshot. You can grab the snapshot at
Thank you for the report, and for helping us make PHP better.

 [2007-05-17 15:21 UTC] fabrizio dot balliano at crealabs dot it
was it implemented for all drivers?
 [2007-05-17 15:29 UTC]
No idea if that's even possible for other drivers than MySQL.
 [2007-05-17 15:35 UTC] fabrizio dot balliano at crealabs dot it
it should, pgsql old driver already has it and i used it

if you look here:
you can find what old drivers already have that function
 [2007-06-13 11:58 UTC] fabrizio dot balliano at crealabs dot it
this should be added at least for:
fbsql: fbsql_field_table
msql: msql_field_table
pgsql: pg_field_table
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Jun 14 22:01:30 2024 UTC