使用 ODBC 检测错误是否导致事务回滚
ODBC 中有没有办法查明错误是否导致当前事务自动回滚,而不是仅中止当前语句并使事务保持打开状态?行为因驱动程序而异,postgresql odbc 驱动程序甚至可以配置为连接选项(也许其他人也这样做,我不知道)。
一些上下文:我正在为脚本语言创建 ODBC 绑定,因此我不能依赖任何有关正在执行的语句、驱动程序或数据源配置的知识。如果我无法获取此信息,我心里有一个安全的选择——总是在每个错误上回滚——但如果可能的话,提供继续的选项会更好。
Is there a way in ODBC to find out if an error caused the current transaction to rollback automatically, as opposed to only aborting the current statement and leaving the transaction open? The behavior varies from driver to driver, and the postgresql odbc driver even makes configurable as a connection option (maybe others do too, I don't know).
Some context: I'm creating an ODBC binding for a scripting language, so I can't rely on any knowledge of the statements being executed, the drivers, or the data source configurations. I have a safe alternative in mind if I can't get this information---always rollback on every error---but it would be much nicer to provide the option to continue when possible.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论