回滚存储过程调用不起作用

时间:2019-06-25 09:38:03

标签: php mysql stored-procedures

我正在尝试将存储过程调用嵌套到由PHP脚本创建的MySQL事务中,并回滚过程内部所做的修改,以防SP调用后我的php脚本中发生某些错误。

//Create a new transaction
$pdo->beginTransaction();

//Build and execute the procedure call request
$request = "CALL my_proc(...)";
$pdo->query($request);

//Rollback the transaction
$pdo->rollBack();

回滚后,我希望数据库中完成的所有更改都将被取消,但实际上所有更改都将提交。

0 个答案:

没有答案
相关问题