How to lock a specific row for write or read purpose?

You are viewing an old version of this question. View the current version here.

Is there a way to lock a specific row for a specific connection for writing or reading purposes? Until release that lock or a specific time expire that row should have limited access for other connections. Is there a way to enforce this locking mechanism in MariaDB?

Answer

I believe this should be doable by executing a SELECT ... FOR UPDATE statement: https://mariadb.com/kb/en/mariadb/select/#lock-in-share-mode-and-for-update-clauses

Comments

Comments loading...
Content reproduced on this site is the property of its respective owners, and this content is not reviewed in advance by MariaDB. The views, information and opinions expressed by this content do not necessarily represent those of MariaDB or any other party.