我想捕获一个MySQL死锁错误,然后重试失败的查询。但是,是必须重新执行事务启动后的每个查询,还是只重做try/catch中的查询?我不确定死锁错误是否会导致所有内容回滚。
这是在Python中使用原始mysql查询执行的。
insert into table_1 values...
insert_into_table_2 values ...
try:
delete from table_1 where ...
except: # set to catch deadlock error
# Can I just retry the delete statement, or do I also have to do the inserts again?
# commits at end发布于 2015-12-09 21:04:43
https://stackoverflow.com/questions/34188661
复制相似问题