#include <dbf.h>
Public Member Functions | |
xbDbf (xbXBase *) | |
Constructor. | |
xbShort | AppendRecord (void) |
Append the current record to the data file. | |
xbShort | BlankRecord (void) |
Blank the record buffer. | |
xbLong | CalcCheckSum (void) |
Calculate checksum for the current record. | |
xbShort | CloseDatabase (bool deleteIndexes=0) |
Close the dbf file. | |
xbShort | CopyDbfStructure (const char *, xbShort) |
Copy DBF structure. | |
xbShort | CreateDatabase (const char *Name, xbSchema *, const xbShort Overlay) |
Create the dbf file. | |
xbLong | DbfTell (void) |
Return the current position in the dbf file. | |
xbShort | DeleteAllRecords (void) |
Delete all records. | |
xbShort | DeleteRecord (void) |
Delete the current record. | |
xbShort | DumpRecord (xbULong) |
Dump record. | |
xbLong | FieldCount (void) |
Return number of fields. | |
xbString & | GetDbfName (void) |
Return Dbf name. | |
xbShort | GetDbfStatus (void) |
Return status. | |
xbShort | GetFirstRecord (void) |
Get the first physical record in the data file. | |
xbShort | GetLastRecord (void) |
Get the last phyiscal record in the data file. | |
xbShort | GetNextRecord (void) |
Get the next physical record in the data file. | |
xbShort | GetPrevRecord (void) |
Get the previous physical record in the data file. | |
xbLong | GetCurRecNo (void) |
Return current record number. | |
xbShort | GetRecord (xbULong) |
Get a record from the data file. | |
char * | GetRecordBuf (void) |
Return a pointer to the record buffer. | |
xbShort | GetRecordLen (void) |
Return record length. | |
xbShort | NameSuffixMissing (xbShort, const char *) |
Determine if file name suffix is missing. | |
xbLong | NoOfRecords (void) |
Gets the number of records in the data file. | |
xbLong | PhysicalNoOfRecords (void) |
Get the physical number of records in the data file. | |
xbShort | OpenDatabase (const char *) |
Open the DBF file. | |
xbShort | PackDatabase (xbShort LockWaitOption, void(*packStatusFunc)(xbLong itemNum, xbLong numItems)=0, void(*indexStatusFunc)(xbLong itemNum, xbLong numItems)=0) |
Pack the database. | |
xbShort | PutRecord (void) |
Write the current record buffer to the current record in the data file. | |
xbShort | PutRecord (xbULong) |
Write the current record buffer to the specified record in the data file. | |
xbShort | RebuildAllIndices (void(*statusFunc)(xbLong itemNum, xbLong numItems)=0) |
Rebuild all index files. | |
xbShort | RecordDeleted (void) |
Determine if current record is deleted. | |
void | ResetNoOfRecs (void) |
Set number of records to zero???? | |
xbShort | SetVersion (xbShort) |
Set dbase version for the dbf file. | |
xbShort | UndeleteAllRecords (void) |
Undelete all records. | |
xbShort | UndeleteRecord (void) |
Undelete the current record. | |
xbShort | Zap (xbShort) |
Delete all records and pack data file. | |
const char * | GetField (xbShort FieldNo) const |
Get the value of the specified field. | |
const char * | GetField (const char *Name) const |
Get the value of the specified field. | |
xbShort | GetField (xbShort FieldNo, char *Buf) const |
Get the value of the specified field. | |
xbShort | GetRawField (const xbShort FieldNo, char *Buf) const |
Get the raw value of the specified field. | |
xbShort | GetField (xbShort FieldNo, char *Buf, xbShort RecBufSw) const |
Get the value of the specified field. | |
xbShort | GetField (const char *Name, char *Buf) const |
Get the value of the specified field. | |
xbShort | GetRawField (const char *Name, char *Buf) const |
Get the raw value of the specified field. | |
xbShort | GetField (const char *Name, char *Buf, xbShort RecBufSw) const |
Get the value of the specified field. | |
xbShort | GetField (xbShort FieldNo, xbString &, xbShort RecBufSw) const |
xbShort | GetFieldDecimal (const xbShort) |
Returns the number of decimals in the specified field. | |
xbShort | GetFieldLen (const xbShort) |
Returns the length of the specified field. | |
char * | GetFieldName (const xbShort) |
Returns the name of the specified field. | |
xbShort | GetFieldNo (const char *FieldName) const |
Returns the field number of the specified field. | |
char | GetFieldType (const xbShort FieldNo) const |
Returns the type of the specified field. | |
xbShort | GetLogicalField (const xbShort FieldNo) |
Get the logical value of the specified field. | |
xbShort | GetLogicalField (const char *FieldName) |
Get the logical value of the specified field. | |
char * | GetStringField (const xbShort FieldNo) |
Get the string value of the specified field. | |
char * | GetStringField (const char *FieldName) |
Get the string value of the specified field. | |
xbShort | PutField (const xbShort, const char *) |
Put a value into the specified field. | |
xbShort | PutRawField (const xbShort FieldNo, const char *buf) |
Put a raw value into the specified field. | |
xbShort | PutField (const char *Name, const char *buf) |
Put a value into the specified field. | |
xbShort | PutRawField (const char *Name, const char *buf) |
Put a raw value into the specified field. | |
xbShort | ValidLogicalData (const char *) |
Determines if data is valid logical data. | |
xbShort | ValidNumericData (const char *) |
Determines if data is valid numeric data. | |
xbLong | GetLongField (const char *FieldName) const |
Get the long value of the specified field. | |
xbLong | GetLongField (const xbShort FieldNo) const |
Get the long value of the specified field. | |
xbShort | PutLongField (const xbShort, const xbLong) |
Put a long value into the specified field. | |
xbShort | PutLongField (const char *, const xbLong) |
Put a long value into the specified field. | |
xbFloat | GetFloatField (const char *FieldName) |
Get the float value of the specified field. | |
xbFloat | GetFloatField (const xbShort FieldNo) |
Get the float value of the specified field. | |
xbShort | PutFloatField (const char *, const xbFloat) |
Put a float value into the specified field. | |
xbShort | PutFloatField (const xbShort, const xbFloat) |
Put a float value into the specified field. | |
xbDouble | GetDoubleField (const char *) |
Get the double value of the specified field. | |
xbDouble | GetDoubleField (const xbShort, xbShort RecBufSw=0) |
Get the double value of the specified field. | |
xbShort | PutDoubleField (const char *, const xbDouble) |
Put a double value into the specified field. | |
xbShort | PutDoubleField (const xbShort, const xbDouble) |
Put a double value into the specified field. | |
xbShort | LockDatabase (const xbShort, const xbShort, const xbLong) |
xbShort | ExclusiveLock (const xbShort) |
xbShort | ExclusiveUnlock (void) |
void | AutoLockOn (void) |
Turn autolock on. | |
void | AutoLockOff (void) |
Turn autolock off. | |
xbShort | GetAutoLock (void) |
Return whether or not autolocking is on or off. | |
void | RealDeleteOn (void) |
Turn on "real" deletes. | |
void | RealDeleteOff (void) |
xbShort | GetRealDelete (void) |
Return whether "real" deletes are on or off. | |
Public Attributes | |
xbXBase * | xbase |
Protected Member Functions | |
xbShort | DeleteAll (xbShort) |
Delete all records. | |
void | InitVars (void) |
Initialize private data members. | |
xbShort | PackDatafiles (void(*statusFunc)(xbLong itemNum, xbLong numItems)=0) |
Pack data file. | |
xbShort | ReadHeader (xbShort) |
Read the dbf header. | |
xbShort | WriteHeader (const xbShort) |
Write the dbf header. | |
Protected Attributes | |
xbString | DatabaseName |
xbShort | XFV |
xbShort | NoOfFields |
char | DbfStatus |
FILE * | fp |
xbSchemaRec * | SchemaPtr |
char * | RecBuf |
char * | RecBuf2 |
char | Version |
char | UpdateYY |
char | UpdateMM |
char | UpdateDD |
xbULong | NoOfRecs |
xbUShort | HeaderLen |
xbUShort | RecordLen |
xbULong | FirstFreeRec |
xbULong | RealNumRecs |
xbIxList * | MdxList |
xbIxList * | NdxList |
xbIxList * | FreeIxList |
xbULong | CurRec |
xbShort | AutoLock |
xbShort | RealDelete |
The xbDbf class encapsulates an xbase DBF database file. It includes all dbf access, field access, and locking methods.
|
Constructor.
|
|
Append the current record to the data file. This method attempts to append the contents of the current record buffer to the end of the XDB DBF file and updates the file date and number of records in the file. Also updates any open indexes associated with this data file.
|
|
Turn autolock off.
|
|
Turn autolock on.
|
|
Blank the record buffer. Sets the record to spaces. |
|
Calculate checksum for the current record. Internal use only. |
|
Close the dbf file. This method attempts to close the XDB DBF file which was previously opened with either CreateDatabase() or OpenDatabase(). Deletes any memory allocated. Automatically closes any open indexes associated with this data file.
|
|
Copy DBF structure.
|
|
Create the dbf file. This method attempts to create the XDB DBF file with the specified name (TableName) and schema (xbSchema s). The OverLay switch is used to determine if an existing file should be overwritten or an error flagged if the file already exists. The record buffer is blanked (set to spaces).
|
|
Return the current position in the dbf file.
|
|
Delete all records.
|
|
Delete all records.
|
|
Delete the current record. Marks the current record as deleted or if "real" deletes are turned on (xbDbf::RealDeleteOn()) will delete the record and add it to the free record list. Normal dBase behavior is to simply mark the record as deleted; the record will actually be deleted when the the DBF file "packed" (xbDbf::PackDatabase()). If "real" deletes are not on, a record may be undeleted using xbDbf::UndeleteRecord().
|
|
Dump record. Dump the contents of the specified record to stdout.
|
|
|
|
|
|
Return number of fields.
|
|
Return whether or not autolocking is on or off.
|
|
Return current record number.
|
|
Return Dbf name.
|
|
Return status.
|
|
Get the double value of the specified field.
|
|
Get the double value of the specified field.
|
|
|
|
Get the value of the specified field. Get the value of the field referenced by Name and place its value in buf.
|
|
Get the value of the specified field. Get the value of the field specified by Name and place its value in buf.
|
|
Get the value of the specified field. Get the value of the field specified by FieldNo and place its value in buf.
|
|
Get the value of the specified field.
|
|
Get the value of the specified field. Returns the value of the field specified by Name.
|
|
Get the value of the specified field. Returns the value of the field specified by FieldNo.
|
|
Returns the number of decimals in the specified field. Returns the number decimals in the field specified by FieldNo.
|
|
Returns the length of the specified field. Returns the length of the field specified by FieldNo.
|
|
Returns the name of the specified field. Returns a pointer to the name for the field specified by FieldNo.
|
|
Returns the field number of the specified field. Returns the field number for the named field.
|
|
Returns the type of the specified field. Returns the type of the field specified by FieldNo.
|
|
Get the first physical record in the data file. Attempts to retrieve the first physical record from the data file into the record buffer.
|
|
Get the float value of the specified field.
|
|
Get the float value of the specified field.
|
|
Get the last phyiscal record in the data file. Attempts to retrieve the last physical record from the data file into the record buffer.
|
|
Get the logical value of the specified field.
|
|
Get the logical value of the specified field.
|
|
Get the long value of the specified field.
|
|
Get the long value of the specified field.
|
|
Get the next physical record in the data file. Attempts to retrieve the next physical record from the data file into the record buffer.
|
|
Get the previous physical record in the data file. Attempts to retrieve the previous physical record from the data file into the record buffer.
|
|
Get the raw value of the specified field. Get the value of the field specified by Name and place its value in buf.
|
|
Get the raw value of the specified field.
|
|
Return whether "real" deletes are on or off. Use this to determine if "real deletes" are being used with the database. |
|
Get a record from the data file. This method attempts to retrieve the record specified by RecNo from the data file into the record buffer.
|
|
Return a pointer to the record buffer.
|
|
Return record length.
|
|
Get the string value of the specified field.
|
|
Get the string value of the specified field.
|
|
Initialize private data members. Internal use only. |
|
|
|
Determine if file name suffix is missing. Internal use only. |
|
Gets the number of records in the data file.
|
|
Open the DBF file. This method attempts to open the XDB DBF file with the specified name (TableName). This method does not position to any particular record in the file. The record buffer is blanked (set to spaces).
|
|
Pack the database. This method removes all records marked for deletion from an Xbase (.DBF) file, reindexes any open index files, and also reorganizes any memo fields stored in a .DBT memo file.
|
|
Pack data file.
|
|
Get the physical number of records in the data file.
|
|
Put a double value into the specified field.
|
|
Put a double value into the specified field.
|
|
Put a value into the specified field.
|
|
Put a value into the specified field.
|
|
Put a float value into the specified field.
|
|
Put a float value into the specified field.
|
|
Put a long value into the specified field.
|
|
Put a long value into the specified field.
|
|
Put a raw value into the specified field.
|
|
Put a raw value into the specified field.
|
|
Write the current record buffer to the specified record in the data file. Attempts to write the contents of the record buffer to the record specified by RecNo. Updates any open indexes.
|
|
Write the current record buffer to the current record in the data file. Attempts to write the contents of the record buffer to the current record in the data file. Updates any open indexes.
|
|
Read the dbf header. Internal use only.
|
|
Turn off "real" deletes |
|
Turn on "real" deletes. This should be done before creating a database (with xbDbf::CreateDatatabase()) and thereafter before opening a database with xbDbfCreateDatabase(). You cannot "turn on" real deletes once a database has been created and records added. |
|
Rebuild all index files.
|
|
Determine if current record is deleted.
|
|
Set number of records to zero????
|
|
Set dbase version for the dbf file. Set dbase version. Should only be used before creating a database with xbDbf::CreateDatabase().
|
|
Undelete all records.
|
|
Undelete the current record. Marks the currect record as not deleted (i.e. removes the flag indicating the record is deleted). This method may not be used (and will return an error code) if "real" deletes are on.
|
|
Determines if data is valid logical data. Determines if the data in buf is valid for a logical field value.
|
|
Determines if data is valid numeric data. Determines if the data in buf is valid for a numeric field value.
|
|
Write the dbf header. Internal use only.
|
|
Delete all records and pack data file.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|