does a transaction in a stored procedure do any locking to prevent others from updating tables?
also do i need to explicitly put in rollback logic or will the transaction automatically roll back if an error occurs because it never reaches the commit command.
When you perform some
DMLon anInnoDBtable, the rows affected get locked until the end of transaction (doesn’t matter is it inside a stored procedure or not).You can modify the locked rows inside the same transaction that locked it.
To explicitly lock some rows, issue:
Except for commiting or rolling back the transaction, there is no other way to unlock the rows
You’ll need to perform a rollback explicitly.