X# slow - maybe the array handling ?

This forum is meant for questions and discussions about the X# language and tools
User avatar
robert
Posts: 4261
Joined: Fri Aug 21, 2015 10:57 am
Location: Netherlands

X# slow - maybe the array handling ?

Post 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
XSharp Development Team
The Netherlands
robert@xsharp.eu
mainhatten
Posts: 200
Joined: Wed Oct 09, 2019 6:51 pm

X# slow - maybe the array handling ?

Post 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
Post Reply