阅读背景:

database / sql Tx - 检测提交或回滚

来源:互联网 

Using the database/sql and driver packages and Tx, it is not possible it appears to detect whether a transaction has been committed or rolled-back without attempting another and receiving an error as a result, and then examining the error to determine the type of error. I would like to be able to determine from the Tx object whether committed or not. Sure, I can define and set another variable in the function that uses Tx, but I have quite a number of them, and it is times 2 every time (variable and assignment). I also have a deferred function to do a Rollback if needed, and it needs to be passed the bool variable. Using the database/sql and driver packages and




你的当前访问异常,请进行认证后继续阅读剩余内容。

分享到: