Page 1 of 1

Retrive DB Actual Value

Posted: Wed 28 Apr 2010 08:50
by Gianluca
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

Posted: Wed 28 Apr 2010 10:40
by bork
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.

Posted: Wed 28 Apr 2010 11:34
by Gianluca
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

Posted: Wed 28 Apr 2010 11:40
by Gianluca
to be onest lmLockImmediate it is not present on documentation.
TLockMode (lmNone, lmOptimistic, lmPessimistic)

Posted: Wed 28 Apr 2010 14:02
by bork
Sorry, you should set the property LockMode := lmPessimistic (the lmLockImmediate value is same but for ODAC components).

Posted: Wed 28 Apr 2010 16:33
by Gianluca
Thank you I will try.

The property TField.OldValue is available with the TUniQuery?

Posted: Fri 30 Apr 2010 12:24
by Dimon
Yes, this property is available.