On Mon, 4 Apr 2011, LacaK wrote:
Michael Van Canneyt wrote / napĂsal(a):
On Mon, 4 Apr 2011, LacaK wrote:
Hi,
This fix
http://svn.freepascal.org/cgi-bin/viewvc.cgi/trunk/packages/fcl-db/src/base/fields.inc?r1=17199&r2=17220
fixes mising call to TField.Validate (before data are written into record
buffer) and adds also call to TField.DataChanged (after data are written)
But It seems to me, that DataChanged is now called 2 times
First in TDataSet descendants in SetFieldData method (see bufdataset.pas,
dbf.pas, paradox.pp, meds.pp) and second in above mentioned place.
So it would be good remove this call from TDataSet descendants. For
example for bufdataset.pas:
1860 if not (State in [dsCalcFields, dsFilter, dsNewValue]) then
1861 DataEvent(deFieldChange, Ptrint(Field));
Hm. No, we'll remove the call from TField.
There may be other descendants (AnyDac, Zeos and whatnot) that also call
DataEvent
and OnValidate, and we cannot apply this change on them.
Yes it seems, that we must do it in this way.
(Although I do not understand why Borland introduces this strange behavior)
Then please move approprate code at least into TCustomBufDataset.SetFieldData
Thanks
This code was already there.
Should the 'Validate' code be moved there too ?
Michael.
_______________________________________________
fpc-devel maillist - fpc-devel@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-devel