DBF/CDX consistency
Posted: Thu Jul 05, 2018 7:34 am
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
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