Column names of a query

In PHP there exist the functions mysql_field_name and mysql_num_fields to retrieve the column names of a query.

Are these functions implemented in PDO, and how can i access them?

Yii::app()->db->schema->getTable($tableName)->columns should give you what you want.

Unfortunately, that's not what I'm looking for. The users can write their own queries in some sort of a database console, therefore I do not know which tables are concerned by the query (and of course, there can be multiple JOIN statements or subselects on other tables)

As mentioned before, PHP provides these functions for a special query like:



$result = mysql_query("SELECT * FROM t1 


INNER JOIN t2 ON (t1.f1 = t2.f1) 


ORDER BY f1 ASC");





for($i = 0; $i < mysql_num_fields($result); $i++) 


{


    echo mysql_field_name($result, $i);


}


Is there a similar way with PDO to get the column names?