Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / fpc-devel / 2011-06

TField.OldValue

4 messages · 4 people · –

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

LacaK

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)

TIA
L.

Reply by email

Unknown author
to LacaK
LacaK wrote 27 lines
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.

Reply by email

Michael Van Canneyt
to Ladislav Karrach
Ladislav Karrach wrote
Thanks, I reported it in bug tracker http://bugs.freepascal.org/view.php?id=19542

Well, Joost is going to have a field day with those...

Michael.

Show quoted text 12 lines
-Laco. > 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 - > http://lists.freepascal.org/mailman/listinfo/fpc-devel

Reply by email