Index Overview

Chapter Updated 11/27/222


The objective of this chapter is to provide information regarding the basic concepts of index processing for the Xbase library.

Overview

The Xbase library is designed to support multiple index types simultaneously. Dbase, Clipper and Foxbase each had their own index formats and ultimately the goal is to provide support for all the legacy index file formats.

The 4.0.x rewrite includes the NDX and MDX formats. Earlier versions of the library included NTX and CDX formats which will be brought forward into the library rewrite at some point in the future.

Tags

Each index file contains one or more tags depending on the file type. Each tag is a sort order and has characteristics: Sort order (ASC or DESC), unique or not unique and some formats support filtering. Each open table (dbf file) has an "active tag" for database operations.

Index updates

The library automatically updates all tags in all open index files.

Index File Types

File
Type
SourceMax Tags
Per File
Auto OpenedSort OrderUnique Keys Reclaimed NodesFilter SupportStatus
NDXdBase
1
Optional
ASC only
Y
N
N
Available in 4.0.1
MDXdBase
47
Yes
ASC or DESC
Y
Y
Y
Available in 4.0.1
NTX Clipper
1
Optional
?
?
?
?
Pending upgrades
CDX Fox Pro
?
?
?
?
?
?
Pending upgrades
IDXFox ProUndeveloped


Index/Tag Methods

MethodDescription
xbDbf::CheckTagIntegrityChecks a tag for missing or duplicate entries. Available if XB_DEBUG_SUPPORT is on.
xbDbf::CreateTagCreate a new tag.
xbDbf::DeleteTagDelete existing tag.
xbDbf::FindFind key value for the active tag.
xbDbf::GetFirsKeyRetrieve the first key for the active tag.
xbDbf::GetLastKeyRetrieve the last key for the active tag.
xbDbf::GetNextKeyRetrieve the next key for the active tag.
xbDbf::GetPrevKeyRetrieve the previous key for the active tag.
xbDbf::GetCurTagRetrieve the tag name key for the active tag.
xbDbf::OpenIndexOpen an index file. Only used for index files that aren't automatically opened.
xbDbf::ReindexRebuild a tag. Available if XB_DEBUG_SUPPORT is on.
xbDbf::SetCurTagSet current tag.