We don’t allow questions seeking recommendations for software libraries, tutorials, tools, books, or other off-site resources. You can edit the question so it can be answered with facts and citations.
Closed 6 years ago.
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
接受
或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
发布评论
评论(3)
PHP SQL 解析器可能正是您要找的。正如您从链接中看到的,它将处理相当复杂的查询。从项目首页下载代码。唯一的缺点是它仅针对 MySQL。添加对 PostgreSQL 的支持应该不是什么大问题。
SQL解析还有一个更基本的解决方案:PHP SQL Tokenizer,但它确实除了选择/来自/哪里/顺序分离之外,不为您提供任何内容:没有字段名称、子查询提取等。
PHP SQL Parser might be what you're looking for. It'll handle fairly complex queries, as you can see from the link. Download the code from the projects front page. The only drawback is it targets MySQL only. Adding support for PostgreSQL should be no big problem.
There's also a more basic solution for SQL parsing: PHP SQL Tokenizer, but it does not offer you anything but select/from/where/order separation: no field names, subquery extraction, or such.
你可以尝试cbMySQL,我不太了解,但这可能就是您正在寻找的东西。
You might give cbMySQL a try, i do not know it very well, but it might be the thing you are looking for.
我最近尝试这样做
PHP-Light-SQL-Parser-Class 这更轻其他类
使用示例
I tried do this recently
PHP-Light-SQL-Parser-Class this is more light that the other classes
EXAMPLE USAGE