FOXCDX seek problem

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

FOXCDX seek problem

#1 Post by Victorio »

Hi,

Is some new about problems with CDX indexes ? I read about it in other thread from december 2015.

Now I have same problem with indexes if CDX was created with Visual Foxpro 6 version.

Same databases after REINDEX in my app works good.

Without reindex do not work seek, then crash listing in table. Also after change set order is listing in database blocked.

Because Visual FoxPro applications are main app in organization (my application is supplement with other functions), and are running on many places in out office in country, I can not REINDEX without risk some problem in this Foxpro applications.
Also no all clients have full access to databases, some have only "read only".

I tryed SEEK, DBSEEK, but no effect.

This looks, to some differencies between CDX created with VFP and Alaska.

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

Re: FOXCDX seek problem

#2 Post by rdonnay »

This is from the Xbase++ help file:

CDXDBE_MODE

The CDX DatabaseEngine is designed to be 100% Visual FoxPro compatible. Concurrent usage of CDX files created and maintained by Xbase++ and Visual FoxPro is guaranteed. However a derivation of the Visual FoxPro CDX index format is also used by various Clipper RDDs such as Comix or Six. Using the CDXDBE_MODE constant the CDX DatabaseEngine can be configured to behave excatly as the Comix or DBFCDX RDD. This way concurrent usage of new Xbase++ applications and old Clipper applications in a network is guaranteed.

The following table lists all possible defines to control compatiblity of the CDX DatabaseEngine:

Constants for DbeInfo(COMPONENT_ORDER,CDXDBE_MODE,)

Constant Description

CDXDBE_VFOXPRO Visual FoxPro 5.x and higher

CDXDBE_COMIX Comix for Clipper RDD

CDXDBE_SIX Six for Clipper RDD

CDXDBE_FOXPRO2X FoxPro 2.x compatiblity

*) ro=READONLY , a=ASSIGNABLE

CDXDBE_VFOXPRO
Using the constant CDXDBE_VFOXPRO the CDX DatabaseEngine operates in a Visual FoxPro compatiblity mode. Concurrent usage of CDX files between Xbase++ and Visual FoxPro in a network environment is guaranteed. A specific feature of the Visual FoxPro mode of operation is the ability of the CDX DatabaseEngine to compress keys. Compression does reduce the size of the index file and hence increases performance. This mode should be the preferred mode when creating new applications.

Collation tables are case insensitive and follow the collating rules of Visual FoxPro. The collation table itself is stored with each tag of the CDX file. This makes the collation table usage by the CDX DatabaseEngine completely independent of collation table specific runtime settings. Furthermore, by storing each collation table with its tag, the CDX DatabaseEngine enables different collations per table.
CDXDBE_COMIX
This constant used at DbeInfo(), the CDX DatabaseEngine operates in Comix mode. This mode is guaranteed to be Clipper 5.3 and Comix RDD compatible. Keys are not compressed in this CDX file format, leading to a typically larger file size compared to the Visual FoxPro mode. Additionally, original Clipper collation tables are used. However this CDX file format will not store collation tables within the CDX file. Collation table management depends entirely on the Xbase++ runtime settings, such as it was the case with Clipper and Comix.

CDXDBE_SIX
Reserved for future use, currently identical to CDXDBE_COMIX.
CDXDBE_FOXPRO2X
Reserved for future use, currently identical to CDXDBE_COMIX.
The eXpress train is coming - and it has more cars.

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

Re: FOXCDX seek problem

#3 Post by Victorio »

Roger, Thank you for info.

But this not help me, I examine many variants, but problem must be in some other.
I used function LAT_IBM, that converting national characters to ascii , also other developer who work in VIsual Foxpro use LAT_IBM function. I programmed my function as function identical by some test module programmed in Foxpro, I have not source. In DOS version Foxpro 2.0 this works, but now developer must some change in source, :think:
I have DBF header analyze utility,(in attach) but I do not know, how analyze CDX file.
Attachments
Forum.zip
(36.29 KiB) Downloaded 885 times

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

Re: FOXCDX seek problem

#4 Post by Auge_Ohr »

Victorio wrote:I have DBF header analyze utility,(in attach) but I do not know, how analyze CDX file.
i do not have "your" DBF to test it ...

try Express++ FUNCTION DC_DbeType( cDbf )

while i´m still a Express+ Newbie i'm not sure ... but FUNCTION DC_LoadRdds() seems me to use "Comix/SixDrive" FOXDBE_CREATE_2X
greetings by OHR
Jimmy

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

Re: FOXCDX seek problem

#5 Post by Victorio »

I cannot put here database because it contain personal data :think:
I must prepare some part without it...

I will look DC_Dbetype... what do it.

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

Re: FOXCDX seek problem

#6 Post by Auge_Ohr »

Victorio wrote:I cannot put here database because it contain personal data :think:
I must prepare some part without it...
it must not contain any data ... just the DBF header is what i want to see ( with HEX Editor )
Victorio wrote:I will look DC_Dbetype... what do it.
the function may say what type your DBF is but you still have to set "right" DBEINFO.
as Express+ Newbie i do not know how to use own DBESYS with Express++ ( instead of DC_LoadRdds() )
greetings by OHR
Jimmy

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

Re: FOXCDX seek problem

#7 Post by Victorio »

Hi Jimmy,
I sent you database via mail.

Here are indexes used in database, so on sended database is more indexes, I used index 6
index on KN_CLV tag KN_CLV eval progress() every lastrec()/100
index on KN_CLV*10000+KN_PCS tag KN_CVL eval progress() every lastrec()/100
index on KN_ICO tag KN_ICO eval progress() every lastrec()/100
index on KN_RCI tag KN_RCI eval progress() every lastrec()/100
index on (LEFT(KN_VLA,30)) tag KN_VLA eval progress() every lastrec()/100
index on UPPER(LAT_IBM(LEFT(KN_VLA,30))) tag KN_AVL eval progress() every lastrec()/100
index on OSC tag OSC eval progress() every lastrec()/100
index on UPPER((LEFT(KN_VLA,30)))+STR(KN_ICO)+STR(KN_RCI) tag KN_OSC eval progress() every lastrec()/100

!!! in sended database is index UPPER(LAT_IBM(LEFT(KN_VLA,30))) tag KN_AVL on 7.th position,
but before seek I set order to 7
and then
pomvla=rtrim(upper(lat_ibm(left(pomvla,30))))
SEEK pomvla

Also without seek if I switch to order 7, and browsing database, rows still stay on one row, or two rows repeat,
picture 1 - here is set order 1, before switch to 7
picture 2 - here is after switch to order 7
picture 3 - here is after move in table, records cannot listing, only first row change
picture 4 - here is after REINDEX, without clear cdx, only REINDEX, and now works all fine.
Attachments
picture3.gif
picture3.gif (84.79 KiB) Viewed 22113 times
picture2.gif
picture2.gif (82.7 KiB) Viewed 22113 times
picture1.gif
picture1.gif (62.16 KiB) Viewed 22113 times

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

Re: FOXCDX seek problem

#8 Post by Victorio »

here is picture 4

Jimmy, if you have little time, look at this, thank you very much.

I am not sure, if problem is function LAT_IBM (this function converting national characters from ascii table 128 - 255 to ASCII characters, for example á -> a, č -> c, and also UPPERSIZE to A, C,...)
because sorting not work also with only this index : (LEFT(KN_VLA,30)) tag KN_VLA

I examine change order FOXPRO2X and VFOXPRO, but still same problem.

PS: FUNCTION DC_DbeType( cDbf ), super !!!, how I do not saw it ? :oops: today I programmed several hours own utility for this :)
Attachments
picture4.gif
picture4.gif (78.91 KiB) Viewed 22114 times

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

Re: FOXCDX seek problem

#9 Post by Auge_Ohr »

Victorio wrote:Hi Jimmy,
I sent you database via mail.
got it ...
please send me your DBESYS()
greetings by OHR
Jimmy

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

Re: FOXCDX seek problem

#10 Post by Victorio »

****************************
PROCEDURE DbeSys()
****************************
_LoadDbes()

RETURN

****************************************
STATIC FUNCTION _LoadDbes()
****************************************
LOCAL i, aDbeList := DbeList(), cDbeList := ''


IF Valtype(aDbeList) = 'A'
FOR i := 1 TO Len(aDbeList)
cDbeList += aDbeList[i,1] + ','
NEXT
ENDIF

aDbeList := cDbeList

IF !('DBFDBE'$aDbeList) .AND. !DbeLoad( "DBFDBE",.T.)
DC_WinAlert( "Database-Engine DBFDBE not loaded" )
ENDIF
IF !('NTXDBE'$aDbeList) .AND. !DbeLoad( "NTXDBE",.T.)
DC_WinAlert( "Database-Engine NTXDBE not loaded" )
ENDIF
IF !('DBFNTX'$aDbeList) .AND. !DbeBuild( "DBFNTX", "DBFDBE", "NTXDBE" )
DC_WinAlert( "DBFNTX Database-Engine, Could not build engine" )
ENDIF
IF !('CDXDBE'$aDbeList) .AND. !DbeLoad( "CDXDBE",.T.)
DC_WinAlert( "Database-Engine CDXDBE not loaded" )
ENDIF
IF !('DBFCDX'$aDbeList) .AND. !DbeBuild( "DBFCDX", "DBFDBE", "CDXDBE" )
DC_WinAlert( "DBFCDX Database-Engine, Could not build engine" )
ENDIF
IF !('FOXDBE'$aDbeList) .AND. !DbeLoad( "FOXDBE",.T.)
DC_WinAlert( "Database-Engine FOXDBE not loaded" )
ENDIF
IF !('FOXCDX'$aDbeList) .AND. !DbeBuild( "FOXCDX", "FOXDBE", "CDXDBE" )
DC_WinAlert( "FOXCDX Database-Engine, Could not build engine" )
ENDIF
IF !('DELDBE'$aDbeList) .AND. !DbeLoad( "DELDBE",.T.)
DC_WinAlert( "Database-Engine DELDBE not loaded" )
ENDIF

DbeSetDefault( "FOXCDX" )

RETURN .t.

Post Reply