Class xbDbf, xbDbf3, xbDbf4

Chapter Updated 04/28/23


This chapter documents the following classes:



  • Class xbDbf - Base class for handling DBF files.
  • Class xbDbf3 - Derived class for handling DBF version III files.
  • Class xbDbf4 - Derived class for handling DBF version IV files.


    Highlights

  • The xbDbf3 and xbDbf4 classes are used for accessing DBF data files.
  • In line with relational theory, a each DBF file can be considered as a table. The documentation uses the terms DBF and table interchangeably.
  • These classes contain methods for accessing and updating DBF files.
  • The class structure is designed to support additional database file layouts. To modify the library to support a new file type not currently supported, create a derived class using xbDbf as a base class and create/modify methods needed to support the new dbf file version.
  • Each open DBF file would have an associated instance of the approprate class. Each instance maintains a record buffer, an original record buffer (if changes applied) current reccord number, selected tag, lock status, record updated flag and other misc info.
  • The record updated flag tells the software to commit any updates to the data base automatically if the auto commit option is turned on (default setting is on).
  • To use a DBF data file, first open it or create it. When done, close it.
  • The first byte of each record is a deletion flag. Deleted records are marked for deletion and not physically removed from the DBF file. They and can be undeleted with xbDbf::UndeleteRecord(). To physically remove deleted records from the DBF file, use xbDbf::Pack().
  • The library will automatically post any updates if Auto Commit is turned on (default setting). If Auto Commit is not on, the application program will need to issue xbDbf::Commit() or xbDbf::Abort() commands to post updates.
  • The library automatically updates any open indices. MDX indices are opened automatically. For NDX style indices, early versions of DBase required the NDX files be explicitly opened in the application. More current versions of available DBase ODBC drivers automatically open NDX indices with the addition of an tablename.INF file. Xbase64 supports both scenarios.
  • Xbase64 handles all record and file locking automatically and is programmed to work the same as the original DBase products as far as locking goes. If auto locking is be turned off, the application is responsible for all locking activities in multi user environments.
  • All field related methods operate on the current record.
  • When accessing fields on a given record, processing fields by field number offers slightly better performance than processing by field name because the number has to be looked up if the name is used. The field number can be retrieved with xbDbf::FieldNo() when the application program is initializing.
  • Unless otherwise specified, the methods return either XB_NO_ERROR or an error as defined here: Error Codes



    Table Methods

    MethodDescriptionParms
    virtual xbInt16 Abort()Cancel any updates not already committed to the table.
    virtual xbInt16 AppendRecord()Append the record buffer to the end of the table.
    virtual xbInt16 BlankRecord()Blank the current record buffer.
    virtual xbInt16 Commit()Commit any updates to the DBF file/table.
    virtual xbInt16 Close()Close the DBF file/table.
    virtual xbInt16 CopyDbfStructure( xbDbf *dNewTable, const xbString &sTableName, const xbString &sTableAlias, xbInt16 iOverlay, xbInt16 iShareMode )Copy structure to new DBF file. dNewTable - Pointer to new xbDbf class
    sTableName - New Table name
    sTableAlias - Alias for new table
    iOverlay
  • xbTrue - Overlay if file exists
  • xbFalse - Don't overlay
    iShareMode
  • XB_SINGLE_USER
  • XB_MULTI_USER
  • virtual xbInt16 CreateTable( const xbString &sTableName, const xbString &sAlias, xbSchema *pSchema, xbInt16 iOverlay, xbInt16 iShareMode ) = 0Create new table / DBF file. sTableName - New Table name
    sAlias - Alias for new table
    pSchema - Pointer to field definition structure
    iOverlay
  • xbTrue - Overlay if file exists
  • xbFalse - Don't overlay
    iShareMode
  • XB_SINGLE_USER
  • XB_MULTI_USER
  • virtual xbInt16 DeleteTable()Delete table / DBF file and all associated indices and memo files.
    virtual xbInt16 DeleteAll( xbInt16 iOption )Set or remove delete flags for all records in the table. iOption
  • 0 - Set all delete flags
  • 1 - Remove all delete flags
  • virtual xbInt16 DeleteAllRecords()Set delete flags for all records in the table.
    virtual xbInt16 DeleteRecord()Delete the current record.
    virtual xbInt16 DumpHeader( xbInt16 iOption ) constDump DBF header information to the console. iOption
  • 1 = Print header only
  • 2 = Field data only
  • 3 = Header and Field data
  • 4 = Header, Field and Memo header data if applicable
  • virtual xbInt16 DumpRecord( xbUInt32 ulRecNo, xbInt16 iOutputDest = 0, xbInt16 iOutputFmt = 0 )Dump the contents of the specified record. ulRecNo - Record number of record to be dumped iOutputDest
  • 0 = stdout
  • 1 = Syslog
  • 2 = Both
    iOutputFmt
  • 0 = with field names
  • 1 = 1 line per rec, no field names
  • 2 = 1 line per rec, first line is a list of field names.
  • virtual xbInt16 GetAutoCommit() constGet the Auto Commit status.
    virtual xbInt16 GetAutoCommit( xbInt16 iOption ) constGet the Auto Commit status.iOption:
    0 = Table Status
    1 = System Status.
    virtual xbBool GetBof()Returns true if beginning of file.
    virtual xbUInt32 GetCurRecNo() constReturns the current record number.
    virtual xbInt16 GetDbfStatus() constReturns Status
  • 0 - Closed
  • 1 - Open
  • 2 - Updates Pending
  • virtual xbBool GetEof()Returns true if end of file.
    virtual xbInt32 GetFieldCnt() constReturns the number of fields in the table.
    virtual xbInt16 GetFirstRecord()Retrieve the first active (not deleted) record in the table.
    virtual xbInt16 GetFirstRecord( xbInt16 iOption )Retrieve the first record in the table. iOption
  • XB_ALL_RECS
  • XB_ACTIVE_RECS
  • XB_DELETED_RECS
  • virtual xbUInt16 GetHeaderLen() constReturns the length of the header portion within the DBF file.
    virtual xbInt16 GetLastRecord()Retrieve the last active (not deleted) record in the table.
    virtual xbInt16 GetLastRecord( xbInt16 iOption )Retrieve the last record in the table. iOption
  • XB_ALL_RECS
  • XB_ACTIVE_RECS
  • XB_DELETED_RECS
  • virtual xbInt16 GetNextRecord()Retrieve the next active (not deleted) record in the table.
    virtual xbInt16 GetNextRecord( xbInt16 iOption )Retrieve the next record in the table. iOption
  • XB_ALL_RECS
  • XB_ACTIVE_RECS
  • XB_DELETED_RECS
  • virtual xbInt16 GetNextRecord( xbInt16 iOption, xbUInt32 ulStartRec )Retrieve the next record in the table. iOption
  • XB_ALL_RECS
  • XB_ACTIVE_RECS
  • XB_DELETED_RECS
    ulStartRec is the position to start from.
  • virtual xbInt16 GetPrevRecord()Retrieve the previous active (not deleted) record in the table.
    virtual xbInt16 GetPrevRecord( xbInt16 iOption )Retrieve the previous record in the table. iOption
  • XB_ALL_RECS
  • XB_ACTIVE_RECS
  • XB_DELETED_RECS
  • virtual xbInt16 GetRecord( xbUInt32 ulRecNo )Retrieve record ulRecNo.ulRecNo - Record number to retrieve
    virtual xbInt16 GetRecordCnt( xbUInt32 & ulRecCnt )Returns record count in ulRecCnt. ulRecCnt - Output number of records in table
    virtual char * GetRecordBuf( xbInt16 iOpt = 0 ) constReturns pointer to record buffer. iOpt
  • 0 for RecBuf (current contents)
  • 1 for RecBuf2 (original contents)
  • virtual xbUInt16 GetRecordLen() constReturns the record length
    virtual const xbString &GetTblAlias() constReturns the table alias. Aliases can be used to manage multiple instances of the same open table.
    virtual xbInt16 GetVersion() const = 0Returns 3 for DBase III version files, returns 4 for DBase IV version files.
    virtual xbXBase *GetXbasePtr() constReturns the xbase pointer.
    virtual xbBool MemoFieldsExist() constReturns true if the table has any associated memo fields.
    virtual xbInt16 Open( const xbString &sTableName )Open a table (DBF file). sTableName - Table name
    virtual xbInt16 Open( const xbString &sTableName, const xbString &sAlias )Open a table (DBF file). sTableName - Table name
    sAlias - Alias name
    virtual xbInt16 Open( const xbString &sTableName, const xbString &sAlias, xbInt16 iOpenMode, xbInt16 iShareMode ) = 0Open a table (DBF file). sTableName - Table name
    sAlias - Alias name
    iOpenMode
  • XB_READ
  • XB_READ_WRITE
    iShareMode
  • XB_SINGLE_USER
  • XB_MULTI_USER
  • virtual xbInt16 Pack()Pack the table, physically remove any records flagged for deletion.
    virtual xbInt16 Pack( xbUInt32 &ulDeletedRecCnt )Pack the table, physically remove any records flagged for deletion.
    ulDeletedRecordCnt - Output - number of deleted records.
    virtual xbInt16 PutRecord()Write record buffer to current location
    virtual xbInt16 PutRecord( xbUInt32 ulRecNo )Write record buffer to record position ulRecNo. ulRecNo - Record number to write.
    virtual xbInt16 RecordDeleted( xbInt16 iOpt = 0 ) constReturns true if currect record is flagged for deletion, otherwise returns false. iOpt
  • 0 - check RecBuf (current contents)
  • 1 - check RecBuf2 (original contents)
  • virtual xbInt16 Rename( const xbString sNewName ) = 0Rename the table. sNewName - New tablename.
    virtual xbInt16 SetAutoCommit( xbInt16 iAutoCommit )Set table specific auto commit setting. iAutoCommit
  • 0 - Auto Commit off
  • 1 - Auto Commit on
  • virtual xbInt16 UndeleteAllRecords()Undelete all records in table flagged for deletion.
    virtual xbInt16 UndeleteRecord()Undelete the current record.
    virtual xbInt16 Zap()Initialize the table.



    Field Methods

    MethodDescriptionParms
    virtual xbInt16 GetField(xbInt16 iFieldNo, xbString &sFieldValue, xbInt16 iRecBufSw ) constGet string field. iFieldNo Input - Field number to retrieve
    sFieldValue Output string
    iRecBufSw Record buffer to pull data from.
  • 0 - current buffer
  • 1 - original buffer
  • virtual xbInt16 GetField(xbInt16 iFieldNo, xbString &sFieldValue) constGet string field. iFieldNo Input - Field number to retrieve
    sFieldValue Output string
    virtual xbInt16 GetField(const xbString &sFieldName, xbString &sFieldValue) constGet string field. sFieldName Input - Field name to retrieve
    sFieldValue Output string
    virtual xbInt16 GetFieldDecimal( xbInt16 iFieldNo, xbInt16 &iFieldDecimal ) constGet decimal field. iFieldNo Input - Field number to retrieve
    iFieldDecimal Output - Number of decimals defined for field
    virtual xbInt16 GetFieldDecimal( const xbString &sFieldName, xbInt16 &iFieldDecimal ) constGet decimal field. sFieldName Input - Field name to retrieve
    iFieldDecimal Output - Number of decimals defined for field
    virtual xbInt16 GetFieldLen( xbInt16 iFieldNo, xbInt16 &iFieldLen ) constGet field length. iFieldNo Input - Field number to retrieve
    iFieldLen Output - Field length of field
    virtual xbInt16 GetFieldLen( const xbString &sFieldName, xbInt16 &iFieldLen ) constGet field length. sFieldName Input - Field name to retrieve
    iFieldLen Output - Field length of field
    virtual xbInt16 GetFieldName( xbInt16 iFieldNo, xbString &sFieldName ) constGet field name. iFieldNo Input - Field number to retrieve
    sFieldName Output - Field name
    virtual xbInt16 GetFieldNo( const xbString &sFieldName, xbInt16 &iFieldNo ) constGet field number. sFieldName Input - Field name to retrieve
    iFieldNo Output - Field number
    virtual xbInt16 GetFieldNo( const xbString &sFieldName ) constReturns a field number for a given field name. sFieldName Input - Field name to retrieve
    virtual xbInt16 GetFieldType( xbInt16 iFieldNo, char &cFieldType ) constGet field type. iFieldNo Input - Field number to retrieve
    cFieldType Output - Field type
    virtual xbInt16 GetFieldType( const xbString &sFieldName, char &cFieldType ) constGet field type. sFieldName Input - Field name to retrieve
    cFieldType Output - Field type
    virtual xbInt16 PutField( const xbString &sFieldName, const xbString &sFieldData )Put string field. sFieldName Input - Field name to update
    sFieldData Input - Update value
    virtual xbInt16 PutField( xbInt16 iFieldNo, const xbString &sFieldData )Put string field. sFieldNo Input - Field number to update
    sFieldData Input - Update value
    virtual xbInt16 PutLogicalField( xbInt16 iFieldNo, const xbString &sFieldData )Put logicial field. sFieldNo Input - Field number to update
    sFieldData Input - Update value
    virtual xbInt16 PutLogicalField( const xbString &sFieldName, const xbString &sFieldData )Put logical field. sFieldName Input - Field name to update
    sFieldData Input - Update value
    virtual xbInt16 GetLogicalField( xbInt16 iFieldNo, xbString &sFieldData ) constGet logical field. iFieldNo Input - Field number to retrieve
    sFieldData Output - String name to put result
    virtual xbInt16 GetLogicalField( const xbString &sFieldName, xbString &sFieldData) constGet logical field. sFieldName Input - Field name to retrieve
    sFieldData Output - String name to put result
    virtual xbInt16 PutLogicalField( xbInt16 iFieldNo, xbBool bFieldData )Put logical field. sFieldNo Input - Field number to update
    bFieldData Output - Bool value
    virtual xbInt16 PutLogicalField( const xbString &sFieldName, xbBool bFieldData )Put logical field. sFieldName Input - Field name to update
    bFieldData Output - Bool value
    virtual xbInt16 GetLogicalField( xbInt16 iFieldNo, xbBool &bFieldData ) constGet logical field. iFieldNo Input - Field number to retrieve
    bFieldData Output - Bool value
    virtual xbInt16 GetLogicalField( xbInt16 iFieldNo, xbBool &bFieldData, xbInt16 iRecBufSw ) constGet logical field. iFieldNo Input - Field number to retrieve
    bFieldData Output - Bool value
    iRecBufSw Record buffer to pull data from.
  • 0 - current buffer
  • 1 - original buffer, before any updates
  • virtual xbInt16 GetLogicalField( const xbString &sFieldName, xbBool &bFieldData) constGet logical field. sFieldName Input - Field name to retrieve
    bFieldData Output - Bool value
    virtual xbInt16 GetLongField( xbInt16 iFieldNo, xbInt32 &lFieldValue ) constGet long field. iFieldNo Input - Field number to retrieve
    lFieldValue Output - xbInt32 field to put result
    virtual xbInt16 GetLongField( const xbString &sFieldName, xbInt32 &lFieldValue ) constGet long field. sFieldName Input - Field name to retrieve
    lFieldValue Output - xbInt32 field to put result
    virtual xbInt16 PutLongField( xbInt16 iFieldNo, xbInt32 lFieldValue )Put long field. sFieldNo Input - Field number to update
    lFieldValue Output - xbInt32 field to put result
    virtual xbInt16 PutLongField( const xbString &sFieldName, xbInt32 lFieldValue )Put long field. sFieldName Input - Field name to retrieve
    lFieldValue Output - xbInt32 update value
    virtual xbInt16 GetULongField( xbInt16 iFieldNo, xbUInt32 &lFieldValue ) constGet unsigned long field. iFieldNo Input - Field number to retrieve
    ulFieldValue Output - xbUInt32 field to put result
    virtual xbInt16 GetULongField( const xbString &sFieldName, xbUInt32 &lFieldValue ) constGet unsigned long field. sFieldName Input - Field name to retrieve
    ylFieldValue Output - xbUInt32 field to put result
    virtual xbInt16 PutULongField( xbInt16 iFieldNo, xbUInt32 lFieldValue )Put unsigned long field. sFieldNo Input - Field number to update
    lFieldValue Output - xbInt32 update value
    virtual xbInt16 PutULongField( const xbString &sFieldNo, xbUInt32 lFieldValue )Put unsigned long field. sFieldName Input - Field name to update
    lFieldValue Output - xbUInt32 update value
    virtual xbInt16 GetDoubleField( xbInt16 FieldNo, xbDouble &dFieldValue ) constGet double field. iFieldNo Input - Field number to retrieve
    dFieldValue Output - xbDouble field to put result
    virtual xbInt16 GetDoubleField( xbInt16 FieldNo, xbDouble &dFieldValue, xbInt16 iRecBufSw ) constGet double field. iFieldNo Input - Field number to retrieve
    dFieldValue Output - xbDouble field to put result
    virtual xbInt16 GetDoubleField( const xbString &sFieldName, xbDouble &dFieldValue ) constGet double field. sFieldName Input - Field name to retrieve
    dFieldValue Output - xbDouble field to put result
    virtual xbInt16 PutDoubleField( xbInt16 FieldNo, xbDouble dFieldValue )Put double field. sFieldNo Input - Field number to update
    dFieldValue Output - xbDouble update value
    virtual xbInt16 PutDoubleField( const xbString &FieldName, xbDouble dFieldValue )Put double field. sFieldName Input - Field name to update
    dFieldValue Output - xbDouble update value
    virtual xbInt16 GetFloatField( xbInt16 iFieldNo, xbFloat &fFieldValue ) constGet float field. iFieldNo Input - Field number to retrieve
    fFieldValue Output - xbFloat field to put result
    virtual xbInt16 GetFloatField( const xbString &sFieldName, xbFloat &fFieldValue ) constGet float field. sFieldName Input - Field name to retrieve
    fFieldValue Output - xbFloat field to put result
    virtual xbInt16 PutFloatField( xbInt16 iFieldNo, xbFloat fFieldValue )Put float field. sFieldName Input - Field number to update
    fFieldValue Output - xbFloat update value
    virtual xbInt16 PutFloatField( const xbString &sFieldName, xbFloat fFieldValue )Put float field. sFieldName Input - Field name to update
    fFieldValue Output - xbFloat update value
    virtual xbInt16 GetDateField( xbInt16 iFieldNo, xbDate &dt ) constGet date field. iFieldNo Input - Field number to retrieve
    dt Output - xbDate field to put result
    virtual xbInt16 GetDateField( const xbString &sFieldName, xbDate &dt ) constGet date field. sFieldName Input - Field name to retrieve
    dt Output - xbDate field to put result
    virtual xbInt16 PutDateField( xbInt16 iFieldNo, const xbDate &dt )Put date field. sFieldName Input - Field number to update
    dt Output - xbDate update value
    virtual xbInt16 PutDateField( const xbString &sFieldName, const xbDate &dt )Put date field. sFieldName Input - Field name to update
    dt Output - xbDate update value
    virtual xbInt16 GetNullSts( xbInt16 iFieldNo, xbBool &bIsNull ) const
    virtual xbInt16 GetNullSts( const xbString &sFieldName, xbBool &bIsNull ) const
    virtual xbInt16 GetNullSts( xbInt16 iFieldNo, xbBool &bIsNull, xbInt16 iRecBufSw ) const
    Get Field Null Status sFieldName Input - Field name to check
    iFieldNo Input - Field no to check
    bIsNull Output - True if the field is null (all spaces).
    iRecBufSw Record buffer to pull data from.
  • 0 - current buffer
  • 1 - original buffer



  • Memo File/Field Methods

    MethodDescriptionParms
    virtual xbInt16 GetMemoFieldCnt() constReturns number of memo fields in the table.
    virtual xbMemo *GetMemoPtr()Returns a pointer to the associated memo file instance.
    virtual xbUInt32 GetCreateMemoBlockSize() constReturns the block size a new memo file will be created with. Block sizes are in 512 byte increments.
    virtual xbInt16 GetMemoField( xbInt16 iFldNo, xbString &sMemoData )Get memo field data. iFldNo Input - Memo field number to retrieve
    sMemoData Output - xbString field to put result
    virtual xbInt16 GetMemoField( const xbString & sFldName, xbString &sMemoData )Get memo field data. iFldName Input - Memo field name to retrieve
    sMemoData Output - xbString field to put result
    virtual xbInt16 GetMemoFieldLen( xbInt16 iFldNo, xbUInt32 &ulMemoFieldLen )Get memo field length. iFldNo Input - Memo field number to retrieve
    ulMemoFieldLen Output - xbUInt32 field to put result
    virtual xbInt16 GetMemoFieldLen( const xbString & sFldName, xbUInt32 &ulMemoFieldLen )Get memo field length. iFldName Input - Memo field name to retrieve
    ulMemoFieldLen Output - xbUInt32 field to put result
    virtual xbBool MemoFieldExists( xbInt16 iFieldNo ) constReturns xbTrue if memo field exists, else returns xbFalse. iFieldNo Input - field number
    virtual xbBool MemoFieldExists( const xbString &sFieldName ) constReturns xbTrue if memo field exists, else returns xbFalse. sFieldName Input - field name
    virtual xbInt16 SetCreateMemoBlockSize( xbUInt32 ulBlockSize ) = 0Set the block size for the memo file. Must be called before memo file is created. ulBlockSize Input - New block size in 512 byte increments
    virtual xbInt16 UpdateMemoField( xbInt16 iFldNo, const xbString &sMemoData )Update memo field. iFldNo Input - Memo field number to update
    sMemoData Input - Memo data to update
    virtual xbInt16 UpdateMemoField( const xbString & sFldName, const xbString &sMemoData )Update memo field. iFldName Input - Memo field name to update
    sMemoData Input - Memo data to update



    Lock Methods

    If auto locking is turned on (default setting), xbase64 handles locking automatically.
    If auto locking is turned off and application is running in a multi user environment, then locking functions will need to be handled by the application program.
    MethodDescriptionParms
    virtual xbInt16 LockTable( xbInt16 iLockFunction )Lock the table. LockFunction
  • XB_LOCK
  • XB_UNLOCK
  • virtual xbInt16 LockRecord( xbInt16 iLockFunction, xbUInt32 ulRecNo )Lock record. iLockFunction
  • XB_LOCK
  • XB_UNLOCK
    ulRecNo - Record number to lock or unlock
  • virtual xbInt16 LockAppend( xbInt16 iLockFunction )Lock append bytes for adding new record. iLockFunction
  • XB_LOCK
  • XB_UNLOCK
  • virtual xbInt16 LockHeader( xbInt16 iLockFunction )Lock table header bytes for updating table. iLockFunction
  • XB_LOCK
  • XB_UNLOCK
  • virtual xbInt16 LockMemo( xbInt16 iLockFunction )Lock memo table for update. iLockFunction
  • XB_LOCK
  • XB_UNLOCK
  • virtual xbBool GetMemoLocked() constReturns the memo lock status.
    virtual xbInt16 LockIndices( xbInt16 iLockFunction )Lock indices for update. iLockFunction
  • XB_LOCK
  • XB_UNLOCK
  • xbInt16 GetAutoLock() constRetrieve current auto lock status.
    void SetAutoLock( xbInt16 iAutoLock )Set autolock status for table iAutoLock
  • 1 - Use auto lock for this table.
  • 0 - Don't use auto lock for this table.
  • -1 - (minus one) Use system default.
  • xbInt16 GetLockFlavor() constAlways returns 1. Included for potential future alternative locking schemes.
    void SetLockFlavor( xbInt16 iLockFlavor )For future use. Included for potential future alternative locking schemes.
    xbBool GetTableLocked() constReturns Table Locked status.
    xbBool GetHeaderLocked() constReturns Header Locked Status.
    xbUInt32 GetAppendLocked() constReturns Append Bytes locked status.
    xbLinkListNode * GetFirstRecLock() constReturns pointer to linked list of record locks.
    void DumpTableLockStatus() constDumps all lock information for debugging purposes.



    Index Methods

    MethodDescriptionParms
    virtual xbInt16 CheckTagIntegrity( xbInt16 iTagOpt, xbInt16 iOutputOpt )For debugging, check tag integrity. iTagOpt
  • 0 - Check current tag
  • 1 - Check all tags
    iOutputOpt
  • 0 = stdout
  • 1 = Syslog
  • 2 = Both
  • virtual xbInt16 CloseIndexFile( xbIx *pIx )Close an index file. pIx Pointer to index file instance.
    virtual xbInt16 CreateTag( const xbString &sIxType, const xbString &sName, const xbString &sKey, const xbString &sFilter, xbInt16 iDescending, xbInt16 iUnique, xbInt16 iOverLay, xbIx **xbIxOut, void **vpTagOut ) Create index tag sIxType Input - MDX or NDX
    sName Input - Tag Name
    sKey Input - Key Expression
    sFilter Input - Filter Expression (MDX only)
    iDescending Input - xbTrue for descending, xbFalse ascending
    iUnique Input - xbTrue for unique, xbFalse not unique
    iOverlay Input - xbTrue to overlay if existing file exists
    **xbIxOut Output - Pointer to ix instance
    **vpTagOut Output - Pointer to tag
    virtual xbInt16 DeleteTag( const xbString &sIxType, const xbString &sName )Delete a tag. sIxType Input - MDX or NDX
    sName Input - Tag Name
    sKey Input - Key Expression
    virtual xbInt16 DeleteAllIndexFiles()Delete all indices for table.
    virtual xbInt16 Find( xbString &sKey )Find xbString key for current tag (assumes character index). sKey - String search key
    virtual xbInt16 Find( xbDate &dtKey )Find xbDate key for current tag(assumes date index). dtKey - Date search key
    virtual xbInt16 Find( xbDouble &dKey )Find numeric key for current tag (assumes numeric index). dKey - Nueric search key
    virtual xbIx *GetCurIx() constReturns pointer to current index file.
    virtual void *GetCurTag() constReturns pointer to current tag.
    virtual xbInt16 GetFirstKey()Get the first key for the current tag, reposition current record.
    virtual xbInt16 GetNextKey()Get the next key for the current tag, reposition current record.
    virtual xbInt16 GetPrevKey()Get the previous key for the current tag, reposition current record.
    virtual xbInt16 GetLastKey()Get the last key for the current tag, reposition current record.
    virtual const xbString &GetCurIxType() constReturns the current index type.
    virtual const xbString &GetCurTagName() constReturns the current tag name.
    virtual xbIxList *GetIxList() constReturns a pointer to list of open indices.
    virtual xbInt32 GetPhysicalIxCnt () constReturns the count of open index files for the table.
    xbLinkListNode *GetTagList () constReturns a pointer to a list of tags for the table.
    virtual xbInt16 OpenIndex( const xbString &sIxType, const xbString &sIndexName ) Open the index.
    MDX index files are opened automatically.
    NDX index files can be opened automatically.
    sIxType
  • NDX
  • MDX
    sIndexName - index file name
  • virtual xbInt16 Reindex( xbInt16 iTagOpt )Reindex iTagOpt
  • 0 - Reindex current tag
  • 1 - Reindex all tags
  • virtual xbInt16 SetCurTag( const xbString &sTagName )Set current tag. sTagName Tag name
    virtual void SetCurTag( const xbString &sIxType, xbIx *pIx, void *vpTag )Set current tag. sIxType
  • NDX
  • MDX
    pIx - Pointer to index object
    vpTag - Pointer to tag object
  • virtual xbInt16 AssociateIndex( const xbString &sType, const xbString &sName, xbInt16 iOption ) Use this method to add an NDX index file name to an INF file.
    When a DBF file is opened, Xbase64 automatically opens NDX index files that are included in the appropriate INF file. This is also used for ODBC compatibility with other xbase type tools.
    sIxType Currently only NDX.
    Future versions can support additional non prod index types.
    sIxName The index name.
    iOpt
  • 0 - Add index to .INF if not already there
  • 1 - Remove index from .INF if it exists
  • xbLinkListNode *GetInfList() constReturns list of INF file entries.



    Block Read Methods

    MethodDescription
    xbInt16 DisableBlockReadProcessing()Disable block read processing for table.
    xbInt16 EnableBlockReadProcessing() Enable block read processing for table.
    This significantly speeds up processing speed if reading from the file sequentially.
    For random access, better performance will be achieved with block reading turned off.
    xbBool GetBlockReadStatus() constGet block read status.