Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

not sure why my transaction isn't producing the desired results

 
Jack Tauson
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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:




More information:

- 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



**My Question:**



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 44.44.4.444.

I want something like following results which makes sense:

Please let me know what am I doing wrong in my transaction related code.

Thanks

 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic