xsharp.eu • X# slow - maybe the array handling ? - Page 3
Page 3 of 3

X# slow - maybe the array handling ?

Posted: Wed Nov 18, 2020 2:40 pm
by robert
Thomas,
mainhatten wrote:
robert wrote:However...
There is a 4 byte field in the DBF header (DBASE_LAN, only used by Dbase AFAIK) that we could use for a version counter:
https://github.com/X-Sharp/XSharpPublic ... er.prg#L31
We may be able to increment this field for every update to a DBF, so other stations can see that the file was updated.
That means that this page from the DBF should never be cached but all the other pages could be cached, as long as the version number in this location is unchanged.
If working reliably this could short-circuit CursorRefresh calls if vfp. But on heavy used tables a 4Byte integer might overflow and any schema to reset might have trouble with cursors explicitly set offline (unless they get special treatment in "Use Online")
Also concurrent use with VO or vfp, which will not set that counter, must be prohibited - new dbf type set in header?

regards
thomas
Overflowing is not an issue. What we want to detect is a change.
This flag will most certainly be ignored by VO (but VO is not caching data anyway, so there is no problem) and VFP.
I will have to investigate what vfp does, but I guess it will ignore the flag too.
Of course this means that we will not "see" that VO or VFP has changed the data.
If VO and/or VFP overwrites the flag with a 0 then we could detect changes made in VO and VFP if we make sure that we set the flag to a non-zero value when opening the file.

Robert

X# slow - maybe the array handling ?

Posted: Wed Nov 18, 2020 4:39 pm
by mainhatten
Yupp, overflow is not bad as it will still result in !=.
For vfp tables inside a database triggers modifying that counterflag could be added, then changes done via vfp would flag as well.
Even might read out the flag for vfp Cursorrefresh() as well - but for that insert and delete would also have to trigger, as records currently in cursor might have been deleted or records fulfilling where clause might have been added....

regards
thomas
robert wrote:Overflowing is not an issue. What we want to detect is a change.
This flag will most certainly be ignored by VO (but VO is not caching data anyway, so there is no problem) and VFP.
I will have to investigate what vfp does, but I guess it will ignore the flag too.
Of course this means that we will not "see" that VO or VFP has changed the data.
If VO and/or VFP overwrites the flag with a 0 then we could detect changes made in VO and VFP if we make sure that we set the flag to a non-zero value when opening the file.

Robert