开发者

PHP: Check validity of SQL before process it to Mysql

开发者 https://www.devze.com 2023-04-03 04:50 出处:网络
Is there any class or library to ph开发者_开发百科p, for this task? Thanks ;)You could set up a local mySQL database with mock tables to have statement executed there first. This will take less resou

Is there any class or library to ph开发者_开发百科p, for this task?

Thanks ;)


You could set up a local mySQL database with mock tables to have statement executed there first. This will take less resources than the real request and you can then check for errors. You could write a thin wrapper for that.


If you want to check if query executes without errors you can call it within transaction and rollback in the end.


You can prepare the sql statement first using prepare() function. If it return false, then there are errors. Otherwise, you are good to go.

Good luck.

0

精彩评论

暂无评论...
验证码 换一张
取 消