DBF/CDX consistency

Xbase++ 2.0 Build 554 or later
Post Reply
Message
Author
Victorio
Posts: 620
Joined: Sun Jan 18, 2015 11:43 am
Location: Slovakia

DBF/CDX consistency

#1 Post 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

User avatar
Auge_Ohr
Posts: 1405
Joined: Wed Feb 24, 2010 3:44 pm

Re: DBF/CDX consistency

#2 Post 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
greetings by OHR
Jimmy

User avatar
rdonnay
Site Admin
Posts: 4722
Joined: Wed Jan 27, 2010 6:58 pm
Location: Boise, Idaho USA
Contact:

Re: DBF/CDX consistency

#3 Post by rdonnay »

Do you do a dbCommit() after your dbAppend() ?
The eXpress train is coming - and it has more cars.

Victorio
Posts: 620
Joined: Sun Jan 18, 2015 11:43 am
Location: Slovakia

Re: DBF/CDX consistency

#4 Post 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

Post Reply