linux.techass.com
"Tell Bill where to go today!"

Home/What's New
Products
Projects

Technology Associates Homepage


eternaLight!
Alien Technology?



[an error occurred while processing this directive]

Powered by Linux!
(of course)

SourceForge Logo xdb Documentation
Main Page   Class Hierarchy   Compound List   Header Files   Compound Members  

xbDbf Class Reference

xbDbf class. More...

#include <dbf.h>

List of all members.


Public Members

 xbDbf ( xbXBase * )
Constructor. More...

xbShort AddIndexToIxList (xbIndex *, const char *IndexName)
Add index to list. More...

xbShort RemoveIndexFromIxList ( xbIndex * )
Remove an index from the list.

xbShort AppendRecord ( void )
Append the current record to the data file. More...

xbShort BlankRecord ( void )
Blank the record buffer. More...

xbLong CalcCheckSum ( void )
Calculate checksum for the current record.

xbShort CloseDatabase (bool deleteIndexes = 0)
Close the dbf file. More...

xbShort CopyDbfStructure ( const char *, xbShort )
Copy DBF structure.

xbShort CreateDatabase ( const char * Name, xbSchema *, const xbShort Overlay )
Create the dbf file. More...

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 DumpHeader ( xbShort )
Dump header information. More...

xbShort DumpRecord ( xbULong )
Dump record. More...

xbLong FieldCount ( void )
Return number of fields.

xbStringGetDbfName ( void )
Return Dbf name.

xbShort GetDbfStatus ( void )
Return status.

xbShort GetFirstRecord ( void )
Get the first physical record in the data file. More...

xbShort GetLastRecord ( void )
Get the last phyiscal record in the data file. More...

xbShort GetNextRecord ( void )
Get the next physical record in the data file. More...

xbShort GetPrevRecord ( void )
Get the previous physical record in the data file. More...

xbLong GetCurRecNo ( void )
Return current record number.

xbShort GetRecord ( xbULong )
Get a record from the data file. More...

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. More...

xbShort PackDatabase (xbShort LockWaitOption, void (*packStatusFunc)(xbLong itemNum, xbLong numItems) = 0, void (*indexStatusFunc)(xbLong itemNum, xbLong numItems) = 0)
Pack the data file.

xbShort PutRecord (void)
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)
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. More...

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. More...

const char* GetField (const char *Name) const
Get the value of the specified field. More...

xbShort GetField ( xbShort FieldNo, char *Buf) const
xbShort GetField ( xbShort FieldNo, char *Buf, xbShort RecBufSw) const
xbShort GetField ( const char *Name, char *Buf) const
Get the value of the specified field. More...

xbShort GetField ( const char *Name, char *Buf, xbShort RecBufSw) const
xbShort GetField (xbShort FieldNo, xbString&, xbShort RecBufSw ) const
xbShort GetFieldDecimal ( const xbShort )
Returns the number of decimals in the specified field. More...

xbShort GetFieldLen ( const xbShort )
Returns the length of the specified field. More...

char* GetFieldName ( const 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 ( const xbShort FieldNo ) const
Returns the type of the specified field. More...

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 PutField ( const char *Name, const char *buf)
Put a value into the specified field.

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.

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)
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 xbULong )
Short description. More...

xbShort ExclusiveLock ( const xbShort )
Short description. More...

xbShort ExclusiveUnlock ( void )
Short description.

void AutoLockOn ( void )
Turn autolock on.

void AutoLockOff ( void )
Turn autolock off.

xbShort GetAutoLock (void)
Return whether or not autolocking is on or off.

xbShort GetMemoField ( const xbShort FieldNo,const xbLong len, char * Buf, const xbShort LockOption )
Short description. More...

xbLong GetMemoFieldLen ( const xbShort FieldNo )
Short description. More...

xbShort UpdateMemoData ( const xbShort FieldNo, const xbLong len, const char * Buf, const xbShort LockOption )
Short description. More...

xbShort MemoFieldExists ( const xbShort FieldNo ) const
Short description. More...

xbShort LockMemoFile ( const xbShort WaitOption, const xbShort LockType )
Short description. More...

xbShort MemoFieldsPresent ( void ) const
Short description.

xbLong CalcLastDataBlock ()
Short description.

xbShort FindBlockSetInChain ( const xbLong BlocksNeeded, const xbLong LastDataBlock, xbLong & Location, xbLong &PreviousNode )
Short description. More...

xbShort GetBlockSetFromChain ( const xbLong BlocksNeeded, const xbLong Location, const xbLong PreviousNode )
Short description. More...

xbShort DumpMemoFreeChain ( void )
Short description.

void DumpMemoHeader ( void ) const
Short description.

void DumpMemoBlock ( void ) const
Short description.

void RealDeleteOn (void)
Turn on "real" deletes.

void RealDeleteOff (void)
Turn off "real" deletes.

xbShort GetRealDelete (void)
Return whether "real" deletes are on or off.

xbShort IndexCount (void)
Get the number of currently open indexes for data file.

xbIndexGetIndex (xbShort indexNum)
Get a specific index.

xbXBasexbase


Detailed Description

xbDbf class.

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


Member Function Documentation

xbDbf::xbDbf (xbXBase * x)

Constructor.

Parameters:
x   pointer to the global xbXbase class

xbShort xbDbf::AddIndexToIxList (xbIndex * n, const char * IndexName)

Add index to list.

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

Parameters:
n   index to add
IndexName   name of index

xbShort xbDbf::AppendRecord (void)

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.

Returns:
One of the following:

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

xbShort xbDbf::BlankRecord (void)

Blank the record buffer.

Sets the record to spaces.

xbShort xbDbf::CloseDatabase (bool deleteIndexes = 0)

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.

Parameters:
deleteIndexes   if 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

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

Create the dbf file.

This method attempts to create the XDB DBF file with the specified name (TableName) and schema (s). The OverLay switch is used to determine if an existing file should be overwritten or an error flagged. The record buffer is blanked (set to spaces).

Parameters:
TableName   name of the table
s   Schema
Overlay   One 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

xbShort xbDbf::DumpHeader (xbShort Option)

Dump header information.

Parameters:
Option   One of the following:

OptionDescription
1Print header only
2Field data only
3Header and field data

xbShort xbDbf::DumpRecord (xbULong RecNo)

Dump record.

Dump the contents of the specified record to stdout.

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

xbShort xbDbf::GetFirstRecord (void)

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

xbShort xbDbf::GetLastRecord (void)

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

xbShort xbDbf::GetNextRecord (void)

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

xbShort xbDbf::GetPrevRecord (void)

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

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:
RecNo   Record 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

xbShort xbDbf::OpenDatabase (const char * TableName)

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

Parameters:
TableName   Name 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 XDB DBF file

xbShort xbDbf::PutRecord (void)

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

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:
RecNo   Record 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

xbShort xbDbf::SetVersion (xbShort v)

Set dbase version for the dbf file.

Set dbase version.

Parameters:
v   version, either 3 or 4.

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

Get the value of the specified field.

Returns the value of the field specified by FieldNo.

Parameters:
FieldNo   Number of field.
Returns:
Value of the specified field.

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:
Name   Name of field.
Returns:
Value of the specified field.

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:
Name   Name of field.
buf   Buffer 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:

xbShort xbDbf::GetFieldDecimal (const xbShort FieldNo)

Returns the number of decimals in the specified field.

Returns the number decimals in the field specified by FieldNo.

Parameters:
FieldNo   Number of field.
Returns:
Number of decimals in the specified field.

xbShort xbDbf::GetFieldLen (const xbShort FieldNo)

Returns the length of the specified field.

Returns the length of the field specified by FieldNo.

Parameters:
FieldNo   Number of field.
Returns:
Length of the specified field in bytes.

char * xbDbf::GetFieldName (const xbShort FieldNo)

Returns the name of the specified field.

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

Parameters:
FieldNo   Number of field.
Returns:
A pointer to the name of the field.

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

Returns the field number of the specified field.

Returns the field number for the named field.

Parameters:
name   Name of field.
Returns:
Number of field named name.

char xbDbf::GetFieldType (const xbShort FieldNo) const

Returns the type of the specified field.

Returns the type of the field specified by FieldNo.

Parameters:
FieldNo   Number of field.
Returns:
Type of specified field.

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:
buf   data to be tested
Returns:
TRUE (non-zero) if valid, FALSE (zero) if not.

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.

xbShort xbDbf::LockDatabase (const xbShort WaitOption, const xbShort LockType, const xbULong)

Short description.

Parameters:
WaitOption  
LockType  
LRecNo  

xbShort xbDbf::ExclusiveLock (const xbShort LockWaitOption)

Short description.

Parameters:
LockWaitOption  

xbShort xbDbf::GetMemoField (const xbShort FieldNo, const xbLong len, char * Buf, const xbShort LockOpt)

Short description.

Parameters:
FieldNo  
len  
Buf  
LockOpt  

xbLong xbDbf::GetMemoFieldLen (const xbShort FieldNo)

Short description.

Parameters:
FieldNo  

xbShort xbDbf::UpdateMemoData (const xbShort FieldNo, const xbLong DataLen, const char * Buf, const xbShort LockOption)

Short description.

Parameters:
FieldNo  
DataLen  
Buf  
LockOpt  

xbShort xbDbf::MemoFieldExists (const xbShort FieldNo) const

Short description.

Parameters:
FieldNo  

xbShort xbDbf::LockMemoFile (const xbShort WaitOption, const xbShort LockType)

Short description.

Parameters:
WaitOption  
LockType  

xbShort xbDbf::FindBlockSetInChain (const xbLong BlocksNeeded, const xbLong LastDataBlock, xbLong & Location, xbLong & PreviousNode)

Short description.

Parameters:
BlocksNeeded  
LastDataBlock  
Location  
PreviousNode  

xbShort xbDbf::GetBlockSetFromChain (const xbLong BlocksNeeded, const xbLong Location, const xbLong PrevNode)

Short description.

Parameters:
BlocksNeeded  
Location  
PrevNode  

The documentation for this class was generated from the following files:
  • dbf.h
  • dbf.cpp
  • fields.cpp
  • lock.cpp
  • memo.cpp

Copyright © 2000-2002 Derry Bryson. All Rights Reserved.