Retrive DB Actual Value

Discussion of open issues, suggestions and bugs regarding UniDAC (Universal Data Access Components) for Delphi, C++Builder, Lazarus (and FPC)
Post Reply
Gianluca
Posts: 13
Joined: Wed 28 Apr 2010 08:31

Retrive DB Actual Value

Post by Gianluca » Wed 28 Apr 2010 08:50

I'm using TUniQuery (UniDac 3.0) to work with tables on my MySQL database.
I would like to know which is the best way to compare values before my changes, with the values on DB. (To inform the user).

Eg.
1. DB Value = A
2. Open Query: Field Value = A
3. I Modify the value on DBEdit Control = B
4. On the same time another user modify and confirm a new value = C
5. DB Value = C
6. I Confirm may change: I would like verify that the value on DB before my change was A and now is C.

Is it possible?

Thank you very much

bork
Devart Team
Posts: 649
Joined: Fri 12 Mar 2010 07:55

Post by bork » Wed 28 Apr 2010 10:40

Hello

You can set the RefreshOption.roBeforeEdit property to True and record will be refreshed before editing (but it can worsen performance of your application). Also you can set the LockMode property to lmLockImmediate to forbid record changing during editing.

Gianluca
Posts: 13
Joined: Wed 28 Apr 2010 08:31

Post by Gianluca » Wed 28 Apr 2010 11:34

Hi Bork,
roBeforeEdit works but in part, I mean after the update of value someone can modify values.

In this case maybe lmLockImmediate seems good. But what does it lock? the record? it is not clear on documentation.

Thank you

Gianluca
Posts: 13
Joined: Wed 28 Apr 2010 08:31

Post by Gianluca » Wed 28 Apr 2010 11:40

to be onest lmLockImmediate it is not present on documentation.
TLockMode (lmNone, lmOptimistic, lmPessimistic)

bork
Devart Team
Posts: 649
Joined: Fri 12 Mar 2010 07:55

Post by bork » Wed 28 Apr 2010 14:02

Sorry, you should set the property LockMode := lmPessimistic (the lmLockImmediate value is same but for ODAC components).

Gianluca
Posts: 13
Joined: Wed 28 Apr 2010 08:31

Post by Gianluca » Wed 28 Apr 2010 16:33

Thank you I will try.

The property TField.OldValue is available with the TUniQuery?

Dimon
Devart Team
Posts: 2910
Joined: Mon 05 Mar 2007 16:32

Post by Dimon » Fri 30 Apr 2010 12:24

Yes, this property is available.

Post Reply