如何防止 QTableModel 根据某些条件更新表
我有一个使用锁写机制的 mysql 表。锁可能会持续太长时间(我们这里讨论的是 1-2 分钟)。
我必须在更新完成之前检查该表是否正在使用(使用 beforeUpdate 信号),
但在检查并返回我的表正在使用之后,系统挂起,直到其他用户解锁该表。如果标志返回表正在使用中,是否可以阻止数据更新。, 我正在寻找更好的方法来处理这个问题,我不想重新实现 setData 方法,因为这样做很痛苦。或者如果你有一个很好的重新实现。这将会非常有帮助。
提前致谢
i have a mysql tables that uses lock-write mechanism. the lock might go for too long (we're talking about 1-2 minutes here).
i had to make a check if the table is in use or not before the update is done (using beforeUpdate signal)
but after checking and returning that my table is in use , system hang until the other user unlocks the table . is it possible to prevent data from updating if the flag returned that the table is in use.,
im searching for a better way to handle this i don't want to re-implement the setData method since doing this is a pain. or if you have a good re-implementation for it . it will be very helpfull.
thanks in advance
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
Python 线程:http://docs.python.org/library/thread.html可以创建等待表完成的线程,并且它在系统资源中应该可以忽略不计,而且您的最终用户也不必等待系统响应才能继续执行不同的任务。
Python threading: http://docs.python.org/library/thread.html You can create threads that wait until the table is finished and it should be negligible in system resources, also your end user wont have to wait for the system to respond to continue with a different task.