Question: I found that when the transaction has no commit or rollback, it will automatically rollback after the http request ends
Code example:
<code>$this->db->begin(); // 这时候user表这条记录就已经被锁住了。。。 $user = \Users::findFirst($id); $user->name = '写锁啊!'; sleep(15); $user->save(); return ; </code>
But when this request ends, the record in the database can be edited again. . .
I want to ask whether it is nginx, fpm or phalcon that automatically calls PDO->rollback(); ??????
Question: I found that when the transaction has no commit or rollback, it will automatically rollback after the http request ends
Code example:
<code>$this->db->begin(); // 这时候user表这条记录就已经被锁住了。。。 $user = \Users::findFirst($id); $user->name = '写锁啊!'; sleep(15); $user->save(); return ; </code>
But when this request ends, the record in the database can be edited again. . .
I want to ask whether it is nginx, fpm or phalcon that automatically calls PDO->rollback(); ??????
MySQL's AUTOCOMMIT automatic submission parameter is turned on by default. It will only be submitted when a commit command is encountered in the transaction.
If it is operated through a MySQL driver in other languages, the MySQL driver will automatically ROLLBACK has no processed transactions.