开发者

how to set a update warning for update too many rows

开发者 https://www.devze.com 2023-03-28 06:54 出处:网络
I wanna to stop these query which will update more than 10k row at once. just like mysql workbench, if i update a table without where cond开发者_高级运维ition, it will give me a warning and stop exec

I wanna to stop these query which will update more than 10k row at once.

just like mysql workbench, if i update a table without where cond开发者_高级运维ition, it will give me a warning and stop execute the sql.


there is no built-in function for this

before you sending the update statement,
you will need to execute the filter condition (ie . SELECT COUNT(*) FROM TBL WHERE...
in order to get the count of matched rows

from there, you can determine whether it should prompt a warning or not

0

精彩评论

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