Recent

Author Topic: MySQL connection read remote commit  (Read 1434 times)

xinyiman

  • Hero Member
  • *****
  • Posts: 2256
    • Lazarus and Free Pascal italian community
MySQL connection read remote commit
« on: November 29, 2019, 08:28:58 am »
Hello everybody. I have a small problem with the standard components of lazarus for connecting to MySQL. Example of the problem:
I have two clients (client A and client B) that access the same table on the database.
If I make a change to "Client A" then I do Query.ApplyUdates; and Transaction.CommitRetaing; and then on the "Client B" I close and reopen the query I don't see the updated result. I think it's an isolation level problem so I don't read remote commits. But how do I fix it?
Win10, Ubuntu and Mac
Lazarus: 2.1.0
FPC: 3.3.1

valdir.marcos

  • Hero Member
  • *****
  • Posts: 1106
Re: MySQL connection read remote commit
« Reply #1 on: November 30, 2019, 08:29:43 am »
Hello everybody. I have a small problem with the standard components of lazarus for connecting to MySQL. Example of the problem:
I have two clients (client A and client B) that access the same table on the database.
If I make a change to "Client A" then I do Query.ApplyUdates; and Transaction.CommitRetaing;
Use Commit instead of CommitRetaing.
Quote
and then on the "Client B" I close and reopen the query I don't see the updated result.
On "Client B", try commit [close] and reopen.
Quote
I think it's an isolation level problem so I don't read remote commits. But how do I fix it?
Transactions have numbers.
B must have a bigger number than A, so B can see what A did before, that's why you must commit B and reopen to see what A did before.
« Last Edit: November 30, 2019, 07:06:50 pm by valdir.marcos »

dogriz

  • Full Member
  • ***
  • Posts: 127
Re: MySQL connection read remote commit
« Reply #2 on: December 01, 2019, 12:12:40 pm »
If I make a change to "Client A" then I do Query.ApplyUdates; and Transaction.CommitRetaing; and then on the "Client B" I close and reopen the query I don't see the updated result.
Closing and opening Client B Query is not enough. Close and open B transaction too.
FPC 3.2.2
Lazarus 2.2.4
Debian x86_64, arm

 

TinyPortal © 2005-2018