DBI begin_work doesn't work with stored procedure calls

ε祈祈猫儿з 提交于 2019-12-02 02:18:19

Make sure you explicitly finish() every executed prepared procedure CALL before you explicitly commit() the transaction. E.g.,

$sth->finish;
$sth->commit();

This appears to be a bug to me, given the typical semantics of finish(). Multiple result sets, calling more_results, etc. did not matter.

DBD 1.616, DBD::mysql 4.020 and MySQL 5.5.19.

If you are using AutoCommit => 0, then you don't need begin_work(). Everything is in a transaction until you commit() or rollback(). Then a new transaction begins.

Actually, you should connect with RaiseError => 1, because you should get an error on begin_work() when AutoCommit is 0. From the fine docs:

If AutoCommit is already off when begin_work is called then it does nothing except return an error. If the driver does not support transactions then when begin_work attempts to set AutoCommit off the driver will trigger a fatal error.

Also, what version of DBD::mysql are you using? I think the latest version does implement AutoCommit.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!