DB::beginTransaction();$model = new UserWechat();$model->unionid = 'od13WwfNk64BQ9ME95S-bzuU7j8A';$model->save();DB::rollback();
The code is not rolled back as expected, and the data is inserted into the database.
Execute native SQL as follows, and expect the same!:
start transaction;insert into user_wechat (unionid) values('od13WwfNk64BQ9ME95S-bzuU7j8A');rollback;
Did I mistake for 10,000 years ...
Reply content:
DB::beginTransaction();$model = new UserWechat();$model->unionid = 'od13WwfNk64BQ9ME95S-bzuU7j8A';$model->save();DB::rollback();
The code is not rolled back as expected, and the data is inserted into the database.
Execute native SQL as follows, and expect the same!:
start transaction;insert into user_wechat (unionid) values('od13WwfNk64BQ9ME95S-bzuU7j8A');rollback;
Did I mistake for 10,000 years ...
Is your database engine InnoDB? Only InnoDB support the transaction, MyISAM is not supported Oh!