MariaDB 5.5 and lockMode

Discussion of open issues, suggestions and bugs regarding MyDAC (Data Access Components for MySQL) for Delphi, C++Builder, Lazarus (and FPC)
Post Reply
Lemmy
Posts: 5
Joined: Wed 08 Oct 2014 07:40

MariaDB 5.5 and lockMode

Post by Lemmy » Tue 23 Jul 2019 10:15

We want to run a data import program ( lazarus + MyDac and Maria DB 5.5) parallel to different databases:

progA -> dbA
progB -> dbB
progC -> dbC

The Problem: All processes need to connect to a "master" db in which they must update / insert in 2 tables some data. Until now this is no problem, because they run one by one.

I try to produce a "lock problem" with a simple app:
Select * from TableX
while not EOF
INSERT / UPDATE into Table y
NEXT
end;

But I can run this app 2, 3 or 4 times an no lock error is shown (lockmode = lmOptimistic) - and I don't understand that point. Why no lock error is shown..?!?

Best regards
Wolfgang

ViktorV
Devart Team
Posts: 3168
Joined: Wed 30 Jul 2014 07:16

Re: MariaDB 5.5 and lockMode

Post by ViktorV » Tue 23 Jul 2019 13:44

If the TMyQuery.LockMode property has the value lmNone, the record blocking won't performed.
If you assign the value lmPessimistic to the LockMode property, the record that you're editing will be blocked when you call the Edit method.
If the value is set to lmOptimistic, the record will be blocked when the Post method is called. Only the changes made during the most recent call of the Post method will be saved on the server, regardless of what user was the first to edit the data.
You can see find a demo of using the TMyQuery.LockMode property in our MyDacDemo project in the 'MySQL-specific Demos\Lock' tab, which is located in the directory: %MyDACDemos%\MyDacDemo, where %MyDACDemos% is the path to the directory where MyDAC Demo projects are installed on your computer.

Lemmy
Posts: 5
Joined: Wed 08 Oct 2014 07:40

Re: MariaDB 5.5 and lockMode

Post by Lemmy » Tue 23 Jul 2019 15:27

ah... so if I only user Update/Insert SQL and no bidirectional DB-binding (TDBEdit) .lockMode has no effect...

Thanks!!

ViktorV
Devart Team
Posts: 3168
Joined: Wed 30 Jul 2014 07:16

Re: MariaDB 5.5 and lockMode

Post by ViktorV » Wed 24 Jul 2019 04:40

Thank you for your interest in our product.
If you have any questions about our products, don't hesitate to contact us - we will do our best to help you.

Post Reply