Locking a table in a transaction

I would like to be able to lock the entire table to prevent any INSERT or UPDATE in it between the "beginTransaction" and the end of the "commit" or "rollback".

I know that starting a transaction leads to implicit UNLOCK TABLES and that the LOCK table leads to implicit COMMIT ... so is there a way to do what I want?

+3
source share
3 answers
select count(*) from table  

inside a transaction blocks a tag on msSQL 2000

+1
source

Why? You may have missed a transaction.

, , .. , . , /. , , - , .

, "", , , . , , .

+2

If you use PHP, so when a transaction occurs, you can set the SESSION variable to tell the script to do nothing with the database, i.e. $_SESSION['on_going_transaction'] = true.

When the transaction is complete, simply destroy the SESSION variable so that another transaction occurs. It is much simpler.

-1
source

All Articles