PxPlus User Forum

Main Board => Discussions => Programming => Topic started by: Thomas Bock on November 16, 2018, 07:45:29 AM

Title: missing rollback on channel close
Post by: Thomas Bock on November 16, 2018, 07:45:29 AM
There seems to be a problem with [mysql] and pending transactions. If a [mysql] channel is closed with a pending transaction, then no rollback is performed. A [odb] channel behaves correctly. Is there an OPT-parameter to correct this?
Sample program attached.
Title: Re: missing rollback on channel close
Post by: Devon Austen on November 16, 2018, 09:13:29 AM
A took a quick look at the code that handles a [mysql] channel close and a [odb] channel close and it looks like by design the [mysql] interface will commit and pending transactions when closing the channel. While the [odb] interface just closes the channel.

As this is by design it is possible this behavior was desired and users may be relying on it. The only option we would have is to add a option to allow you to override the default behavior and have it not do a commit before closing the connection. This I believe would mean that the transaction would get rolled back by the mysql driver when closing the connection.

I will put adding this option for [mysql] onto our wish list for consideration. If others would benefit from this feature let us know here and this would make it more likely we do it and help us determine its priority.