Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Function to return numeric position of record in index?
Message
From
02/04/2002 15:11:05
Hilmar Zonneveld
Independent Consultant
Cochabamba, Bolivia
 
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Miscellaneous
Thread ID:
00639744
Message ID:
00640065
Views:
29
>If I am not mistaken, the single-entry IDX file simply contains offsets into the data file. Simplistically, this means there's a look up table of some sort that says that the record having this particular value in the index is actually found at physical record number n. Or perhaps it contains an actual byte offset into the data file. This is, after all, what an index file is designed to accomplish: to "index" or order the data elements in a fashion other than their physical order.
>
>Now, this is what the IDX file does, and a CDX file is merely a collection of IDX files, so therefore you have to determine which of the tags within the CDX is the one you want, and then locate the particular entry within that tag that points to the particular record in question.
>
>It sounds a lot more complex than it is, but this is the functionality that is engaged when you perform the command
>SET ORDER TO [SOMETAGNAME], or (even better example but VFP7 only)
>INDEXSEEK("SOMEDATA","ALIASNAME","TAGNAME")
>
>You merely want to open this mechanism to find what physical record it is pointing at. To do this, you probably have to close the indices, and perform a low-level open of the CDX file using perhaps the FOPEN() function. Then you will have to locate the appropriate piece of data using FREAD().
>
>There used to be information detailing the internal structure of the IDX/CDX files somewhere. Does anyone know if it's still around?

The index structure is not linear like the DBF - it is some sort of tree-structure. Walking through this structure would require some sort of recursion.

Hilmar.
Difference in opinions hath cost many millions of lives: for instance, whether flesh be bread, or bread be flesh; whether whistling be a vice or a virtue; whether it be better to kiss a post, or throw it into the fire... (from Gulliver's Travels)
Previous
Reply
Map
View

Click here to load this message in the networking platform