Xbase64 Class Library  3.1.2
Public Member Functions | Public Attributes | List of all members
xbDbf Class Reference

xbMH struct More...

#include <xbdbf.h>

Inheritance diagram for xbDbf:
xbFile

Public Member Functions

 xbDbf (xbXBase *)
 Constructor. More...
 
virtual ~xbDbf ()
 Destructor. More...
 
xbShort AppendRecord ()
 Append the current record to the data file. More...
 
xbShort BlankRecord ()
 Blank the record buffer. More...
 
xbShort CloseDatabase (xbBool deleteIndexes=0)
 Close the dbf file. More...
 
xbShort CopyDbfStructure (const char *, xbShort)
 Copy DBF structure. More...
 
xbShort CreateDatabase (const char *Name, xbSchema *, xbShort Overlay)
 Create the dbf file. More...
 
xbShort DeleteAllRecords ()
 Delete all records. More...
 
xbShort DeleteRecord ()
 Delete the current record. More...
 
xbShort DumpRecord (xbULong)
 Dump record. More...
 
xbLong FieldCount ()
 Return number of fields. More...
 
const xbStringGetDbfName ()
 Return Dbf name. More...
 
xbShort GetDbfStatus ()
 Return status. More...
 
xbShort GetFirstRecord ()
 Get the first physical record in the data file. More...
 
xbShort GetLastRecord ()
 Get the last phyiscal record in the data file. More...
 
xbShort GetNextRecord ()
 Get the next physical record in the data file. More...
 
xbShort GetPrevRecord ()
 Get the previous physical record in the data file. More...
 
xbLong GetCurRecNo ()
 Return current record number. More...
 
xbShort GetRecord (xbULong)
 Get a record from the data file. More...
 
char * GetRecordBuf ()
 Return a pointer to the record buffer. More...
 
xbShort GetRecordLen ()
 Return record length. More...
 
xbShort NameSuffixMissing (xbShort, const char *)
 Determine if file name suffix is missing. More...
 
xbLong GetRecCnt ()
 
xbLong NoOfRecords ()
 Remove an index from the list. More...
 
xbLong PhysicalNoOfRecords ()
 Get the physical number of records in the data file. More...
 
xbShort OpenDatabase (const char *)
 Dump header information. More...
 
xbShort PackDatabase (xbShort LockWaitOption, void(*packStatusFunc)(xbLong itemNum, xbLong numItems)=0, void(*indexStatusFunc)(xbLong itemNum, xbLong numItems)=0)
 Pack the database. More...
 
xbShort PutRecord ()
 Write the current record buffer to the current record in the data file. More...
 
xbShort PutRecord (xbULong)
 Write the current record buffer to the specified record in the data file. More...
 
xbShort RebuildAllIndices (void(*statusFunc)(xbLong itemNum, xbLong numItems)=0)
 Add index to list. More...
 
xbShort RecordDeleted ()
 Determine if current record is deleted. More...
 
void ResetNoOfRecs ()
 Set number of records to zero???? More...
 
xbShort SetVersion (xbShort)
 Set dbase version for the dbf file. More...
 
xbShort UndeleteAllRecords ()
 Undelete all records. More...
 
xbShort UndeleteRecord ()
 Undelete the current record. More...
 
xbShort Zap (xbShort)
 Delete all records and pack data file. More...
 
const char * GetField (xbShort FieldNo) const
 Get the value of the specified field. More...
 
const char * GetField (const char *Name) const
 Get the value of the specified field. More...
 
xbShort GetField (xbShort FieldNo, char *Buf) const
 Get the value of the specified field. More...
 
xbShort GetRawField (xbShort FieldNo, char *Buf) const
 Get the raw value of the specified field. More...
 
xbShort GetField (xbShort FieldNo, char *Buf, xbShort RecBufSw) const
 Get the value of the specified field. More...
 
xbShort GetField (const char *Name, char *Buf) const
 Get the value of the specified field. More...
 
xbShort GetRawField (const char *Name, char *Buf) const
 Get the raw value of the specified field. More...
 
xbShort GetField (const char *Name, char *Buf, xbShort RecBufSw) const
 Get the value of the specified field. More...
 
xbShort GetField (xbShort FieldNo, xbString &, xbShort RecBufSw) const
 
xbShort GetFieldDecimal (xbShort)
 Returns the number of decimals in the specified field. More...
 
xbShort GetFieldLen (xbShort)
 Returns the length of the specified field. More...
 
char * GetFieldName (xbShort)
 Returns the name of the specified field. More...
 
xbShort GetFieldNo (const char *FieldName) const
 Returns the field number of the specified field. More...
 
char GetFieldType (xbShort FieldNo) const
 Returns the type of the specified field. More...
 
xbShort GetLogicalField (xbShort FieldNo)
 Get the logical value of the specified field. More...
 
xbShort GetLogicalField (const char *FieldName)
 Get the logical value of the specified field. More...
 
char * GetStringField (xbShort FieldNo)
 Get the string value of the specified field. More...
 
char * GetStringField (const char *FieldName)
 Get the string value of the specified field. More...
 
xbShort PutField (xbShort, const char *)
 Put a value into the specified field. More...
 
xbShort PutRawField (xbShort FieldNo, const char *buf)
 Put a raw value into the specified field. More...
 
xbShort PutField (const char *Name, const char *buf)
 Put a value into the specified field. More...
 
xbShort PutRawField (const char *Name, const char *buf)
 Put a raw value into the specified field. More...
 
xbShort ValidLogicalData (const char *)
 Determines if data is valid logical data. More...
 
xbShort ValidNumericData (const char *)
 Determines if data is valid numeric data. More...
 
xbLong GetLongField (const char *FieldName) const
 Get the long value of the specified field. More...
 
xbLong GetLongField (const xbShort FieldNo) const
 Get the long value of the specified field. More...
 
xbShort PutLongField (const xbShort, const xbLong)
 Put a long value into the specified field. More...
 
xbShort PutLongField (const char *, const xbLong)
 Put a long value into the specified field. More...
 
xbFloat GetFloatField (const char *FieldName)
 Get the float value of the specified field. More...
 
xbFloat GetFloatField (xbShort FieldNo)
 Get the float value of the specified field. More...
 
xbShort PutFloatField (const char *, const xbFloat)
 Put a float value into the specified field. More...
 
xbShort PutFloatField (const xbShort, const xbFloat)
 Put a float value into the specified field. More...
 
xbDouble GetDoubleField (const char *)
 Get the double value of the specified field. More...
 
xbDouble GetDoubleField (xbShort, xbShort RecBufSw=0)
 Get the double value of the specified field. More...
 
xbShort PutDoubleField (const char *, xbDouble)
 Put a double value into the specified field. More...
 
xbShort PutDoubleField (const xbShort, xbDouble)
 Put a double value into the specified field. More...
 
xbShort LockDatabase (xbShort, xbShort, xbLong)
 
xbShort ExclusiveLock (xbShort)
 
xbShort ExclusiveUnlock ()
 
void AutoLockOn ()
 Turn autolock on. More...
 
void AutoLockOff ()
 Turn autolock off. More...
 
xbShort GetAutoLock ()
 Return whether or not autolocking is on or off. More...
 
void RealDeleteOn ()
 Turn on "real" deletes. More...
 
void RealDeleteOff ()
 
xbShort GetRealDelete ()
 Return whether "real" deletes are on or off. More...
 
void Flush ()
 
virtual const char * GetExtWithDot (bool lower)
 

Public Attributes

xbXBasexbase
 

Additional Inherited Members

- Protected Member Functions inherited from xbFile
void SetFileName (const char *filename)
 
 xbFile ()
 
const xbStringGetFileName ()
 
xbString MakeFileName (const char *filename)
 

Detailed Description

xbMH struct

Internal use only.xbDbf class

The xbDbf class encapsulates an xbase DBF database file. It includes all dbf access, field access, and locking methods.

Constructor & Destructor Documentation

◆ xbDbf()

xbDbf::xbDbf ( xbXBase x)

Constructor.

Parameters
xpointer to the global xbXbase class

◆ ~xbDbf()

xbDbf::~xbDbf ( )
virtual

Destructor.

Member Function Documentation

◆ AppendRecord()

xbShort xbDbf::AppendRecord ( )

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 DBF file and updates the file date and number of records in the file. Also updates any open indices associated with this data file.

Returns
One of the following:

Return CodeDescription
XB_NO_ERRORNo error
XB_LOCK_FAILEDCouldn't lock file
XB_WRITE_ERRORError writing to file

◆ AutoLockOff()

void xbDbf::AutoLockOff ( )
inline

Turn autolock off.

◆ AutoLockOn()

void xbDbf::AutoLockOn ( )
inline

Turn autolock on.

◆ BlankRecord()

xbShort xbDbf::BlankRecord ( )

Blank the record buffer.

Sets the record to spaces.

◆ CloseDatabase()

xbShort xbDbf::CloseDatabase ( xbBool  deleteIndexes = 0)

Close the dbf file.

This method attempts to close the 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.

Parameters
deleteIndexesif TRUE, the indexes (xbIndex instances) will also be deleted (index files will not be deleted)
Returns
One of the following:

Return CodeDescription
XB_NO_ERRORNo error
XB_NOT_OPENFile was not open

◆ CopyDbfStructure()

xbShort xbDbf::CopyDbfStructure ( const char *  NewFileName,
xbShort  Overlay 
)

Copy DBF structure.

◆ CreateDatabase()

xbShort xbDbf::CreateDatabase ( const char *  TableName,
xbSchema s,
xbShort  Overlay 
)

Create the dbf file.

This method attempts to create the 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).

Parameters
TableNamename of the table
sxbSchema
OverlayOne of the following:

OverLayDescription
XB_OVERLAYOverwrite existing file if it exists
XB_DONTOVERLAYReport an error if file exists
Returns
One of the following return codes:

Return CodeDescription
XB_NO_ERRORNo error
XB_FILE_EXISTSIf the file exists and OverLay is XB_DONTOVERLAY
XB_OPEN_ERRORCouldn't open the file
XB_NO_MEMORYMemory allocation error
XB_WRITE_ERRORCouldn't write to disk

◆ DeleteAllRecords()

xbShort xbDbf::DeleteAllRecords ( )
inline

Delete all records.

◆ DeleteRecord()

xbShort xbDbf::DeleteRecord ( )

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().

Returns
One of the following:

Return CodeDescription
XB_NO_ERRORNo error
XB_INVALID_RECORDInvalid record number

◆ DumpRecord()

xbShort xbDbf::DumpRecord ( xbULong  RecNo)

Dump record.

Dump the contents of the specified record to stdout.

Parameters
RecNoRecord number of record to be dumped.
Returns
An error code (same as GetRecord()).

◆ ExclusiveLock()

xbShort xbDbf::ExclusiveLock ( xbShort  )
inline

◆ ExclusiveUnlock()

xbShort xbDbf::ExclusiveUnlock ( )
inline

◆ FieldCount()

xbLong xbDbf::FieldCount ( )
inline

Return number of fields.

◆ Flush()

void xbDbf::Flush ( )

◆ GetAutoLock()

xbShort xbDbf::GetAutoLock ( )
inline

Return whether or not autolocking is on or off.

◆ GetCurRecNo()

xbLong xbDbf::GetCurRecNo ( )
inline

Return current record number.

◆ GetDbfName()

const xbString& xbDbf::GetDbfName ( )
inline

Return Dbf name.

◆ GetDbfStatus()

xbShort xbDbf::GetDbfStatus ( )
inline

Return status.

◆ GetDoubleField() [1/2]

xbDouble xbDbf::GetDoubleField ( const char *  FieldName)

Get the double value of the specified field.

◆ GetDoubleField() [2/2]

xbDouble xbDbf::GetDoubleField ( xbShort  FieldNo,
xbShort  RecBufSw = 0 
)

Get the double value of the specified field.

◆ GetExtWithDot()

const char * xbDbf::GetExtWithDot ( bool  lower)
virtual

Implements xbFile.

◆ GetField() [1/7]

const char * xbDbf::GetField ( xbShort  FieldNo) const

Get the value of the specified field.

Returns the value of the field specified by FieldNo.

Parameters
FieldNoNumber of field.
Returns
Value of the specified field.

◆ GetField() [2/7]

const char * xbDbf::GetField ( const char *  Name) const

Get the value of the specified field.

Returns the value of the field specified by Name.

Parameters
NameName of field.
Returns
Value of the specified field.

◆ GetField() [3/7]

xbShort xbDbf::GetField ( xbShort  FieldNo,
char *  Buf 
) const

Get the value of the specified field.

◆ GetField() [4/7]

xbShort xbDbf::GetField ( xbShort  FieldNo,
char *  buf,
xbShort  RecBufSw 
) const

Get the value of the specified field.

Get the value of the field specified by FieldNo and place its value in buf.

Parameters
FieldNoNumber of field.
bufBuffer to hold field value. Must be large enough to hold the entire field value. Use GetFieldLen() to determine the length of the field, if necessary.
RecBufSw
Returns
The length of the field.

◆ GetField() [5/7]

xbShort xbDbf::GetField ( const char *  Name,
char *  buf 
) const

Get the value of the specified field.

Get the value of the field specified by Name and place its value in buf.

Parameters
NameName of field.
bufBuffer to hold field value. Must be large enough to hold the entire field value. Use GetFieldLen() to determine the length of the field, if necessary.
Returns
One of the following:

◆ GetField() [6/7]

xbShort xbDbf::GetField ( const char *  Name,
char *  buf,
xbShort  RecBufSw 
) const

Get the value of the specified field.

Get the value of the field referenced by Name and place its value in buf.

Parameters
NameName of field.
bufBuffer to hold field value. Must be large enough to hold the entire field value. Use GetFieldLen() to determine the length of the field, if necessary.
RecBufSw
Returns
One of the following:

◆ GetField() [7/7]

xbShort xbDbf::GetField ( xbShort  FieldNo,
xbString sf,
xbShort  RecBufSw 
) const

◆ GetFieldDecimal()

xbShort xbDbf::GetFieldDecimal ( xbShort  FieldNo)

Returns the number of decimals in the specified field.

Returns the number of decimals in the field specified by FieldNo.

Parameters
FieldNoNumber of field.
Returns
Length of the specified field in bytes.

◆ GetFieldLen()

xbShort xbDbf::GetFieldLen ( xbShort  FieldNo)

Returns the length of the specified field.

Returns the length of the field specified by FieldNo.

Parameters
FieldNoNumber of field.
Returns
Length of the specified field in bytes.

◆ GetFieldName()

char * xbDbf::GetFieldName ( xbShort  FieldNo)

Returns the name of the specified field.

Returns a pointer to the name for the field specified by FieldNo.

Parameters
FieldNoNumber of field.
Returns
A pointer to the name of the field.

◆ GetFieldNo()

xbShort xbDbf::GetFieldNo ( const char *  name) const

Returns the field number of the specified field.

Returns the field number for the named field.

Parameters
nameName of field.
Returns
Number of field named name.

◆ GetFieldType()

char xbDbf::GetFieldType ( xbShort  FieldNo) const

Returns the type of the specified field.

Returns the type of the field specified by FieldNo.

Parameters
FieldNoNumber of field.
Returns
Type of specified field.

◆ GetFirstRecord()

xbShort xbDbf::GetFirstRecord ( )

Get the first physical record in the data file.

Attempts to retrieve the first physical record from the data file into the record buffer.

Returns
One of the following:

Return CodeDescription
XB_NO_ERRORNo error
XB_LOCK_FAILEDCouldn't lock file
XB_NOT_OPENFile is not open
XB_INVALID_RECORDInvalid record number
XB_SEEK_ERRORError seeking file
XB_WRITE_ERRORError writing to file

◆ GetFloatField() [1/2]

xbFloat xbDbf::GetFloatField ( const char *  FieldName)

Get the float value of the specified field.

◆ GetFloatField() [2/2]

xbFloat xbDbf::GetFloatField ( xbShort  FieldNo)

Get the float value of the specified field.

◆ GetLastRecord()

xbShort xbDbf::GetLastRecord ( )

Get the last phyiscal record in the data file.

Attempts to retrieve the last physical record from the data file into the record buffer.

Returns
One of the following:

Return CodeDescription
XB_NO_ERRORNo error
XB_LOCK_FAILEDCouldn't lock file
XB_EOFAt end of file
XB_NOT_OPENFile is not open
XB_INVALID_RECORDInvalid record number
XB_SEEK_ERRORError seeking file
XB_WRITE_ERRORError writing to file

◆ GetLogicalField() [1/2]

xbShort xbDbf::GetLogicalField ( xbShort  FieldNo)

Get the logical value of the specified field.

◆ GetLogicalField() [2/2]

xbShort xbDbf::GetLogicalField ( const char *  FieldName)

Get the logical value of the specified field.

◆ GetLongField() [1/2]

xbLong xbDbf::GetLongField ( const char *  FieldName) const

Get the long value of the specified field.

◆ GetLongField() [2/2]

xbLong xbDbf::GetLongField ( const xbShort  FieldNo) const

Get the long value of the specified field.

◆ GetNextRecord()

xbShort xbDbf::GetNextRecord ( )

Get the next physical record in the data file.

Attempts to retrieve the next physical record from the data file into the record buffer.

Returns
One of the following:

Return CodeDescription
XB_NO_ERRORNo error
XB_LOCK_FAILEDCouldn't lock file
XB_EOFAt end of file
XB_NOT_OPENFile is not open
XB_INVALID_RECORDInvalid record number
XB_SEEK_ERRORError seeking file
XB_WRITE_ERRORError writing to file

◆ GetPrevRecord()

xbShort xbDbf::GetPrevRecord ( )

Get the previous physical record in the data file.

Attempts to retrieve the previous physical record from the data file into the record buffer.

Returns
One of the following:

Return CodeDescription
XB_NO_ERRORNo error
XB_LOCK_FAILEDCouldn't lock file
XB_BOFAt beginning of file
XB_NOT_OPENFile is not open
XB_INVALID_RECORDInvalid record number
XB_SEEK_ERRORError seeking file
XB_WRITE_ERRORError writing to file

◆ GetRawField() [1/2]

xbShort xbDbf::GetRawField ( xbShort  FieldNo,
char *  Buf 
) const

Get the raw value of the specified field.

◆ GetRawField() [2/2]

xbShort xbDbf::GetRawField ( const char *  Name,
char *  buf 
) const

Get the raw value of the specified field.

Get the value of the field specified by Name and place its value in buf.

Parameters
NameName of field.
bufBuffer to hold field value. Must be large enough to hold the entire field value. Use GetFieldLen() to determine the length of the field, if necessary.
Returns
One of the following:

◆ GetRealDelete()

xbShort xbDbf::GetRealDelete ( )
inline

Return whether "real" deletes are on or off.

Use this to determine if "real deletes" are being used with the database.

◆ GetRecCnt()

xbLong xbDbf::GetRecCnt ( )
inline

◆ GetRecord()

xbShort xbDbf::GetRecord ( xbULong  RecNo)

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.

Parameters
RecNoRecord number to retrieve
Returns
One of the following:

Return CodeDescription
XB_NO_ERRORNo error
XB_LOCK_FAILEDCouldn't lock file
XB_NOT_OPENFile is not open
XB_INVALID_RECORDInvalid record number
XB_WRITE_ERRORError writing to file

◆ GetRecordBuf()

char* xbDbf::GetRecordBuf ( )
inline

Return a pointer to the record buffer.

◆ GetRecordLen()

xbShort xbDbf::GetRecordLen ( )
inline

Return record length.

◆ GetStringField() [1/2]

char * xbDbf::GetStringField ( xbShort  FieldNo)

Get the string value of the specified field.

◆ GetStringField() [2/2]

char * xbDbf::GetStringField ( const char *  FieldName)

Get the string value of the specified field.

◆ LockDatabase()

xbShort xbDbf::LockDatabase ( xbShort  ,
xbShort  ,
xbLong   
)
inline

◆ NameSuffixMissing()

xbShort xbDbf::NameSuffixMissing ( xbShort  type,
const char *  name 
)

Determine if file name suffix is missing.

Internal use only.

◆ NoOfRecords()

xbLong xbDbf::NoOfRecords ( )

Remove an index from the list.

Gets the number of records in the data file

◆ OpenDatabase()

xbShort xbDbf::OpenDatabase ( const char *  TableName)

Dump header information.

Parameters
OptionOne of the following:

OptionDescription
1Print header only
2Field data only
3Header and field data
Open the DBF file.

This method attempts to open the 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).

Parameters
TableNameName of table to open
Returns
One of the following:

Return CodeDescription
XB_NO_ERRORNo error
XB_OPEN_ERRORCouldn't open file
XB_NO_MEMORYMemory allocation error
XB_NOT_XBASENot an DBF file

◆ PackDatabase()

xbShort xbDbf::PackDatabase ( xbShort  LockWaitOption,
void(*)(xbLong itemNum, xbLong numItems)  packStatusFunc = 0,
void(*)(xbLong itemNum, xbLong numItems)  indexStatusFunc = 0 
)

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.

Parameters
packStatusFuncstatus function
indexStatusFuncindex status function
LockWaitOptionOne of the following:

LockWaitOptionDescription
F_SETLKReturn immediately if the DBF file cannot be locked
XB_LOCKWait for lock on DBF file to succeed
Returns
One of the following return codes:

Return CodeDescription
XB_NO_ERRORNo error
XB_CLOSE_ERRORUnable to close intermediate work file
XB_OPEN_ERRORCould not open file
XB_NO_MEMORYMemory allocation error
XB_WRITE_ERRORCouldn't write to disk
XB_SEEK_ERRORError seeking file
XB_LOCK_FAILEDUnable to lock file or index

◆ PhysicalNoOfRecords()

xbLong xbDbf::PhysicalNoOfRecords ( )

Get the physical number of records in the data file.

◆ PutDoubleField() [1/2]

xbShort xbDbf::PutDoubleField ( const char *  FieldName,
xbDouble  d 
)

Put a double value into the specified field.

◆ PutDoubleField() [2/2]

xbShort xbDbf::PutDoubleField ( const xbShort  FieldNo,
xbDouble  d 
)

Put a double value into the specified field.

◆ PutField() [1/2]

xbShort xbDbf::PutField ( xbShort  FieldNo,
const char *  buf 
)

Put a value into the specified field.

◆ PutField() [2/2]

xbShort xbDbf::PutField ( const char *  Name,
const char *  buf 
)

Put a value into the specified field.

◆ PutFloatField() [1/2]

xbShort xbDbf::PutFloatField ( const char *  FieldName,
const xbFloat  f 
)

Put a float value into the specified field.

◆ PutFloatField() [2/2]

xbShort xbDbf::PutFloatField ( const xbShort  FldNo,
const xbFloat  f 
)

Put a float value into the specified field.

◆ PutLongField() [1/2]

xbShort xbDbf::PutLongField ( const xbShort  FieldNo,
const xbLong  Val 
)

Put a long value into the specified field.

◆ PutLongField() [2/2]

xbShort xbDbf::PutLongField ( const char *  FieldName,
const xbLong  Val 
)

Put a long value into the specified field.

◆ PutRawField() [1/2]

xbShort xbDbf::PutRawField ( xbShort  FieldNo,
const char *  buf 
)

Put a raw value into the specified field.

◆ PutRawField() [2/2]

xbShort xbDbf::PutRawField ( const char *  Name,
const char *  buf 
)

Put a raw value into the specified field.

◆ PutRecord() [1/2]

xbShort xbDbf::PutRecord ( )

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.

See also
PutRecord(xbULong RecNo)
Returns
One of the following:

Return CodeDescription
XB_NO_ERRORNo error
XB_LOCK_FAILEDCouldn't lock file
XB_NOT_OPENFile is not open
XB_INVALID_RECORDInvalid record number
XB_SEEK_ERRORError seeking file
XB_WRITE_ERRORError writing to file

◆ PutRecord() [2/2]

xbShort xbDbf::PutRecord ( xbULong  RecNo)

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.

Parameters
RecNoRecord number to which data should be written
Returns
One of the following:

Return CodeDescription
XB_NO_ERRORNo error
XB_LOCK_FAILEDCouldn't lock file
XB_NOT_OPENFile is not open
XB_INVALID_RECORDInvalid record number
XB_SEEK_ERRORError seeking file
XB_WRITE_ERRORError writing to file

◆ RealDeleteOff()

void xbDbf::RealDeleteOff ( )
inline

Turn off "real" deletes

◆ RealDeleteOn()

void xbDbf::RealDeleteOn ( )
inline

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.

◆ RebuildAllIndices()

xbShort xbDbf::RebuildAllIndices ( void(*)(xbLong itemNum, xbLong numItems)  statusFunc = 0)

Add index to list.

Adds the specified index to the list of indexes maintained by the dbf.

Parameters
nindex to add
IndexNamename of indexRebuild all index files

◆ RecordDeleted()

xbShort xbDbf::RecordDeleted ( )

Determine if current record is deleted.

Returns
TRUE (1) if the current record is marked as deleted or FALSE (0) if not.

◆ ResetNoOfRecs()

void xbDbf::ResetNoOfRecs ( )
inline

Set number of records to zero????

◆ SetVersion()

xbShort xbDbf::SetVersion ( xbShort  v)

Set dbase version for the dbf file.

Set dbase version. Should only be used before creating a database with xbDbf::CreateDatabase().

Parameters
vversion, either 3 or 4.

◆ UndeleteAllRecords()

xbShort xbDbf::UndeleteAllRecords ( )
inline

Undelete all records.

◆ UndeleteRecord()

xbShort xbDbf::UndeleteRecord ( )

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.

Returns
One of the following:

Return CodeDescription
XB_NO_ERRORNo error
XB_INVALID_RECORDInvalid record number

◆ ValidLogicalData()

xbShort xbDbf::ValidLogicalData ( const char *  buf)

Determines if data is valid logical data.

Determines if the data in buf is valid for a logical field value.

Parameters
bufdata to be tested
Returns
TRUE (non-zero) if valid, FALSE (zero) if not.

◆ ValidNumericData()

xbShort xbDbf::ValidNumericData ( const char *  buf)

Determines if data is valid numeric data.

Determines if the data in buf is valid for a numeric field value.

Parameters
buf
Returns
TRUE (non-zero) if valid, FALSE (zero) if not.

◆ Zap()

xbShort xbDbf::Zap ( xbShort  WaitOption)

Delete all records and pack data file.

Member Data Documentation

◆ xbase

xbXBase* xbDbf::xbase

The documentation for this class was generated from the following files: