not sure why my transaction isn't producing the desired results
posted 2 years ago
Please consider the following code. Since, my main question revolves around the usage of transaction, I haven't bothered to include full code here. The following code just gives an overwiew of what I am doing and what results I am getting after running the program. If you would like to look at an actual code, please take a look here. However, I feel that the following code snippet is sufficient for understanding my question. Thanks
So, I have something like the following inside the try block:
- DTSId_int is a field that exists in the MySQL table for all the IP addresses above. IT's a primary key and set to autoincrement.
- DTSStatusType_ti is initially set to 1 in test.selectiontable and then getting updated to 3
When I check the results of prepared statement, I get the following, when the for loop runs for the first time:
When for loop runs for the second time, I get the following results:
**Problem I am facing:**
The problem here is, the first 10 values in `test.selectiontable` is getting updated three times at a time. Eventually, it get's updated with the most recent value, which is 18.104.22.1684.
I want something like following results which makes sense:
Please let me know what am I doing wrong in my transaction related code.
What are you doing? You are supposed to be reading this tiny ad!
the new thread boost feature brings a LOT of attention to your favorite threads