problem description
Does the stored procedure ofmysql automatically start a transaction
the environmental background of the problems and what methods you have tried
the problem is that there is a piece of code that opens the transaction, and the whole request opens the transaction. A stored procedure is called in the transaction, that is, some data is updated, and the begin,end is finished if the open transaction is not shown in the stored procedure.
this transaction contains an updated piece of data. After execution, there is another operation in the code to update the same data that has just been updated in the stored procedure. Here, a lock wait timeout occurs.
what result do you expect? What is the error message actually seen?
what I want to ask is, if a stored procedure is called to execute, if there is no transaction opened in the stored procedure, will it automatically open a new transaction? And there is no automatic submission.
causes the lock not to be obtained when manipulating the same data later.
by looking at the locks and code tests of MySQL, I found that the stored procedure did open a new transaction and hung there all the time without committing after execution.