On Thu, 9 Jun 2011, LacaK wrote:
Hi *,
I have 2 questions, which I divide into 2 emails.
1st is about TField.OldValue and Delphi compatibility. Please look at small
attached program (for SQLite3).
In Delphi (with TClientDataSet and dbExpress) outputs:
1. Field.OnValidate: OldValue=N; Value=N; NewValue=N
2. Field.OnChange: OldValue=O; Value=N; NewValue=N
3. BeforePost: OldValue=O; Value=N; NewValue=N
4. AfterPost: OldValue=O; Value=N; NewValue=N
5. Before ApplyUpdates: OldValue=O; Value=N; NewValue=N
6. After ApplyUpdates: OldValue=N; Value=N; NewValue=N
In FPC:
1. Field.OnValidate: OldValue=N; Value=N; NewValue=N
2. Field.OnChange: OldValue=null; Value=N; NewValue=N
3. BeforePost: OldValue=null; Value=N; NewValue=N
4. AfterPost: OldValue=O; Value=N; NewValue=N
5. Before ApplyUpdates: OldValue=O; Value=N; NewValue=N
6. After ApplyUpdates: OldValue=null; Value=N; NewValue=N
As you can see, there are differences in 2,3,6, where in FPC OldValue is NULL
but in Delphi is it "old value".
Dou you think, that it is bug ? (at least it makes impossible compare
OldValue and Value in BeforePost event handler and take some action when some
field changes)
At least it is a bug in 2,3.
The OldValue should IMHO be available till the Post statement.
After that, it is subject to debate.
Michael.
_______________________________________________
fpc-devel maillist - [email protected]
http://lists.freepascal.org/mailman/listinfo/fpc-devel