Page 1 of 1

DBF/CDX consistency

Posted: Thu Jul 05, 2018 7:34 am
by Victorio
Hi,
How can I determine, if CDX is actual for DBF file (VFP type) ?
I want determine date and time, but I see, that time of cdx is different that dbf (about 2 seconds in my example).
This look, that first save CDX file and then DBF.
In dbf header is only last update - only date, cdx header do not know what is in it.

I can determine only date, and time calculate to permision difference several seconds, but his is not very clear solution.

A reason is , because program can open DBF in "classic old mode " DBF with CDX , or with ODBC driver. When opened with ODBC driver, CDX files is not updated. When again open with CDX, need reindex.

this issue is temporary because the ODBC version is in testing, and then only this one is allowed, but also later can some user run old version of program and I need to notify them

* I try this, max difference set to 30 seconds...
subord:=cestaolp+ozndbf+".DBF"
suborc:=cestaolp+ozndbf+".CDX"
if konfex(subord)=.T. .and. konfex(suborc)=.T.
if filedate(subord)=filedate(suborc) .and. ;
(timetosec(filetime(subord))-timetosec(filetime(suborc)))<30
return 1 // ok
else
return 2 // inconsitency
endif
else
return(0) // cannot open
endif

Re: DBF/CDX consistency

Posted: Mon Jul 23, 2018 3:05 pm
by Auge_Ohr
Victorio wrote:This look, that first save CDX file and then DBF.
Xbase++ DATA Component have Cache
FOXDBE (DATA-Komponente)
FOXDBE_LIFETIME a 50 N Lifetime of records in local cache

DBFDBE (DATA-Komponente)
DBFDBE_LIFETIME a 50 N Verweildauer von Records im lokalen Cache
while ORDER Component do not to have Property "LIFE_TIME" so Index is 1st

Re: DBF/CDX consistency

Posted: Mon Jul 23, 2018 3:54 pm
by rdonnay
Do you do a dbCommit() after your dbAppend() ?

Re: DBF/CDX consistency

Posted: Mon Jul 23, 2018 10:23 pm
by Victorio
Roger, no, I have only append, on same places I have also commit but in this no, I will try it
Jimmy I searched what parameter in dbesys can miss or be wrong, I will look for as you advice
Thank's