使用 Nhibernate 如何获得“表锁”
我想做的是这样的:
TABLE LOCKS table1;
update counter= 1 + counter from table1 where id=1;
select counter from table1 where id=1;
UNLOCK TABLES;
最佳答案
只需在查询之前运行此命令即可:
var command = session.Connection.CreateCommand();
command.CommandText = "TABLE LOCKS table1";
command.ExecuteNonQuery();
然后相应的UNLOCK。
关于c# - 使用 Nhibernate 获取表锁 (MyIsam),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6647031/