如何在当前会话中锁定MySQL表?
我在MySQL中读到的有关表锁的只是涉及不同的会话,因此一个会话不会干扰另一个会话。但是,如果我想从相同会话中的多次交易是相互排斥的怎么办? 选择...更新
仅锁定某些行,但我希望整个表被锁定。
换句话说:如果特定的交易正在运行,则无论其来自哪个会话,都不应能够开始。当第一个交易结束时,第二笔交易应该开始。
All I read about table locks in MySQL concerns different sessions, so one session cannot interfere with another one. But what if I want multiple transactions from the same session to be mutually exclusive? SELECT ... FOR UPDATE
only locks certain rows but I want the whole table to be locked.
In other words: If a specific transaction is running, no other transaction should be able to start, no matter which session it is from. When the first transaction finishes, the second one should start.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论