douxian4323 2014-12-04 23:36
浏览 28

从原始MySql查询获取表名的最佳方法

Lets say I have a general DB class with a query method that is used all over my source code and I want to find out table names that are used in my mysql queries.

The limitation is that I'm using MySql 5.5.36.

Also lets assume that we are talking about millions of tables that I'm using and that using the mysql information schema is not going to happen.

What I would like to know is there an easy way to get table names used?

Explain is obviously good for SELECT statments but since its MySql 5.5.36 I can't use it on replace,update,insert etc.

PDOStatement::getColumnMeta might help us with getting a table name, but it won't work with the queries that return result set.

Some kind of regexp for this might might be possible but I very much doubt that is a good solution for this, my queries are big have multiple JOINS etc. the regexp would be very complicated and probably fail fair percentage of time.

Any other ideas?

  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥20 易康econgnition精度验证
    • ¥15 线程问题判断多次进入
    • ¥15 msix packaging tool打包问题
    • ¥28 微信小程序开发页面布局没问题,真机调试的时候页面布局就乱了
    • ¥15 python的qt5界面
    • ¥15 无线电能传输系统MATLAB仿真问题
    • ¥50 如何用脚本实现输入法的热键设置
    • ¥20 我想使用一些网络协议或者部分协议也行,主要想实现类似于traceroute的一定步长内的路由拓扑功能
    • ¥30 深度学习,前后端连接
    • ¥15 孟德尔随机化结果不一致