I need to build a monitor to list all the fields, tables and database every time they are queried.
I would then like to build a script that starting from a query like this:
select
table_a.field_1, table_a.field_2,
table_b.field_3
from
database_I.table_a
database_II.table_b
where
table_a.idx = table_b.idx
would get me this array
$objects = array(
'database_I.table_a.field_1',
'database_I.table_a.field_2',
'database_II.table_b.field_3'
)
Playing with ''mysql_field_table'' and ''mysql_field_name'' I can get the table and field name but not the database_name also.
Is there any way to get it just starting from the parsing of the SQL query (altohough it would be a SELECT, INSERT INTO, UPDATE or whatelse)?