How to check if MySQL query is valid without executing it?

前端 未结 5 2313
小蘑菇
小蘑菇 2021-02-20 06:24

I\'m making a simple tool that will get a string of MySQL commands and run it (on several DB servers sequentially). I trust the users to be sensible, but mistakes happen, and I\

5条回答
  •  遥遥无期
    2021-02-20 07:20

    Depending on your MySQL engine and settings, you could start a transaction, try the query, and then do a rollback. Assuming dirty reads are off, that should work.

提交回复
热议问题