Getting Table Lock (MyIsam) using Nhibernate
Using Nhibernat开发者_高级运维e how can I get "TABLE LOCKS"
What I'd like to do is somwthing like this:
TABLE LOCKS table1;
update counter= 1 + counter from table1 where id=1;
select counter from table1 where id=1;
UNLOCK TABLES;
Just run this before your query:
var command = session.Connection.CreateCommand();
command.CommandText = "TABLE LOCKS table1";
command.ExecuteNonQuery();
And the corresponding UNLOCK afterwards.
精彩评论