>>>>> "Matt" == Matt Greenwood <ljessup@stripped> writes:
Matt> Hi,
Matt> I'm attempting to determine for a given select statement which database
Matt> and table each of the returned fields is associated with. My reason for
Matt> asking this question is I have written a "select" function in Perl using
Matt> DBI/DBD. The routine "sub select { ... }" will have no knowledge of the
Matt> select statement until it is sent.
Matt> Therefore simple select statements such as:
Matt> SELECT *
Matt> FROM blarg, foo, bar;
Matt> or
Matt> SELECT *
Matt> FROM foo NATURAL LEFT JOIN bar;
Matt> etc...
Matt> will bring into question which fields belong to which table and
Matt> potentially the associated database.
Matt> Aside from either parsing the select statement myself, or limiting the
Matt> robustness of this routine is there a way to expose this information
Matt> through either DBI or mySQL?
Matt> Thanks,
Matt> Matt
The MySQL C API can be used to get the table name for each column, but
I don't know if you can get this through DBI/DBD (I scanned through
'perldoc DBI', but couldn't find anything specific); Maybe someone on
the msql-mysql-modules lists knows something about this...
Regards,
Monty