After the sub-table is saved, the transaction is not rolled back. The Master table still has a piece of data. solve the problem. thank you!
After the sub-table is saved, the transaction is not rolled back. The Master table still has a piece of data. solve the problem. thank you!
Reply content:
After the sub-table is saved, the transaction is not rolled back. The Master table still has a piece of data. solve the problem. thank you!
If your code logic is faulty, you will eventually call commit.
You should ensure that$ Transaction-> rollback ()Run the following code
$ T = \ Yii: $ app-> db-> beginTransaction (); try {if ($ orderModel-> save () {... if (! $ Re) {throw new Exception ('error information ');}...} $ t-> commit ();} catch (Excetption $ e) {$ t-> rollback (); throw new Exception ($ e-> getMessage ());}
Check whether the storage engine of your table is InnoDB.
Are you sure the code can run?
It seems that if there is no curly braces