32/64-Bit Database Engine


Topics:

Overview
Revision Levels
Conditional Directives
Constants
Type Definitions
Enumerations
Data Members
Functions


Overview

The gxDatabase engine is a low-level file handler used to manipulate contiguous blocks of binary data. It is composed of an external file system API, platform interoperable integers, and several block manipulation functions. The external file system API defines the basic file system functionality required by the gxDatabase engine and calls the correct native file API function for each supported platform/compiler. Platform interoperable integers are used to achieve database and network interoperability in heterogeneous computing environments. The gxDatabase engine itself defines several low-level block manipulation functions used to build complex database models and navigation functions. The low-level methods are extremely flexible allowing the database engine to support object-oriented database models and relational database models.

Low-level methods include read, write, and seek operations, create and open functions, linear navigation, and large file support. Optional methods include CRC checking, file and record locking. The block manipulation functions operate independently of the file system API calls allowing you to use the same interface for large files and proprietary file systems. By default the gxDatabase engine uses 32-bit integers to store header information and represent file offsets. A database file using 32-bit offsets will not be allowed to grow larger then 2.1 GB. When large file support is enabled the gxDatabase engine uses 64-bit signed integers to store header information and represent file offsets. This allows database files to grow larger then 2.1 GB to a maximum size determined by the underlying operating system.

Database files created by the gxDatabase engine are constructed using a file header, a file lock header, an optional static storage area, and a dynamic storage area reserved for contiguous byte sequences marked by block headers. The file header is used to store information needed by the block allocation routines, a signature, and a version number. The lock header is used to lock the entire file during multi-threaded read and write operations. The static data area is used to store static data guaranteed not to be altered by the dynamic allocation routines. Block headers, record lock headers, and block checksums are used to manage data blocks created inside the dynamic data area. The database engine offers best-fit and first-fit block allocation methods to prevent database fragmentation. Optional CRC checking ensures data integrity. Multi-threaded/multi-machine database applications are directly supported using persistent locks at either the file and node level.

The gxDatabase engine includes optional CRC checking and persistent block checksums. Internal CRC checking is used by the database engine to detect any bit errors that occur during data storage operations. In order to minimize executions times relative to file operations internal CRC checking can be disabled within the gxDatabase engine. Persistent block checksums are stored at the end of each block. The use of a block checksum is optional. They are generally used by applications that require persistent checksums to maintain file integrity from one program invocation to the next.

The gxDatabase engine advisory locking scheme enables database files to facilitate optimum operability in multi-threaded/multi-machine environments. Both file and record locking is achieved through the use of persistent lock headers. Lock headers operate independently of the I/O subsystem thus allowing platform interoperable file and record locking. Additionally, the use of advisory file and record locks ensure that database engine will maintain maximum flexibility in both single user and multi-user applications. The absence of a mandatory locking protocol places the responsibility of adherence and enforcement of the locking sub-system on the application and not the database engine itself.


Revision Levels

The 32/64-bit database engine allows you to mix revision letters as needed. This feature was added specifically for large databases where even the slightest bit of overhead could have a tremendous affect on the file size and impact the applications in terms of speed. The version letter will determine the amount of overhead per database block and is set when the file is created:

gxDatabaseError gxDatabase::Create(const char *fname, FAU static_size =(FAU_t)0, __SBYTE__ RevisionLetter = gxDatabaseRevisionLetter);

The default revision level is set in the "gxd_ver.h" include file. When existing database files are opened 32/64-bit database engine checks the revision level stored in the file header and performs read, write, seek, and search operations accordingly. This allows you to mix the revision levels as needed without worrying about incompatibility with higher or lower revisions.

Revision 0, A, B, or C can be used with the 32/64-bit database engine, version 2000.101 and higher. Revision A, B, and C add features to maintain optimum data protection. Revision 0 offers the least amount of overhead per block.

Revision letter zero (denoted by any of the following: 0, '\0', or ' ') excludes the persistent checksum value and the persistent file and record lock headers.

Revision 'A' reserves space at the end of each block for an optional persistent checksum value and excludes the persistent file and record lock headers.

Revision 'B' includes the persistent checksum value with the addition of a persistent file lock header.

Revision 'C' includes all the features of revision 'A' and 'B' with the addition of persistent record lock headers.


Conditional Directives

__CPP_EXCEPTIONS__ - Directive used to enable C++ exception handling. NOTE: If this directive is used the database file functions will throw a gxCDatabaseException exception if any errors occur during a file operation. If this directive is not enabled a return value is used to evaluate file errors.

NOTE: When you enable the 64-bit preprocessor directives all the database classes including the B-tree class, POD manager, Persistent base class, and InfoHog API will used the 64-bit database engine. Since the file offsets change to 64-bits, 64-bit database files are not compatible with 32-bit database files. So it is important to determine which version of the database engine your project will require before you start building data files.

__64_BIT_DATABASE_ENGINE__ - Directive used to enable 64-bit file offsets. NOTE: This directive also requires a platform/compiler specific 64-bit integer directive:

__WIN32__ - Directive used to enable 64-bit integer support on all WIN32 platforms.

__MSVC__ - Directive used to enable 64-bit integer support using MSVC version 4.2 and higher.

__UNIX__ - Directive used to enable 64-bit integer support on all UNIX platforms.

_LARGEFILE64_SOURCE - Directive used on all UNIX platforms to enable large file support.

__LINUX__ - Directive used to enable 64-bit integer support on all Linux platforms.

__HPUX__ - Directive used to enable 64-bit integer support on all HPUX platforms.

__SOLARIS__ - Directive used to enable 64-bit integer support on all Solaris platforms.

__BCC32__ - Directive used to enable 64-bit integer support using BCC32 5.5. NOTE: At the time of this publication large file support has not been implemented under BCC 5.5, although the use of 64-bit integers is supported.


Public Data Members

Static data members used by the gxDatabase class in place of global variables.

static __SBYTE__ gxDatabase::gxSignature[gxSignatureSize] - Eight or ten byte string used to identify 32-bit or 64-bit database files and the revision level.

static FAU gxDatabase::gxVersion - Offset value used to represent the current library version number.

static gxUINT32 gxDatabase::gxInternalCheckWord - 32-bit check word used to mark blocks and maintain synchronization.


Functions

gxDatabase::gxDatabase()
gxDatabase::~gxDatabase()
gxDatabase::Alloc()
gxDatabase::BlockHeaderSize()
gxDatabase::BlockLength()
gxDatabase::CalcChecksum()
gxDatabase::Close()
gxDatabase::Create()
gxDatabase::DatabaseExceptionMessage()
gxDatabase::DatabaseName()
gxDatabase::Delete()
gxDatabase::DeleteBlocks()
gxDatabase::Exists()
gxDatabase::FileHeaderSize()
gxDatabase::FilePosition()
gxDatabase::FileSize()
gxDatabase::FindFirstBlock()
gxDatabase::FindFirstObject()
gxDatabase::FindNextBlock()
gxDatabase::FindNextObject()
gxDatabase::FindPrevBlock()
gxDatabase::FindPrevObject()
gxDatabase::Flush()
gxDatabase::GetDatabaseError()
gxDatabase::GetDatabaseFreeSpace()
gxDatabase::GetEOF()
gxDatabase::GetHeapStart()
gxDatabase::GetHighestBlock()
gxDatabase::GetRevLetter()
gxDatabase::GetSignature()
gxDatabase::GetVersion()
gxDatabase::InitFileHdr()
gxDatabase::InitFileLockHdr()
gxDatabase::InitRecordLockHdr()
gxDatabase::IsOK()
gxDatabase::IsOpen()
gxDatabase::LockFile()
gxDatabase::LockRecord()
gxDatabase::ObjectLength()
gxDatabase::Open()
gxDatabase::Read()
gxDatabase::ReadBlockHdr()
gxDatabase::ReadFileHdr()
gxDatabase::ReadFileLockHdr()
gxDatabase::ReadForReading()
gxDatabase::ReadObjectChecksum()
gxDatabase::ReadRecordLockHdr()
gxDatabase::ReadyForWriting()
gxDatabase::ReclaimBestFit()
gxDatabase::ReclaimFirstFit()
gxDatabase::Remove()
gxDatabase::ResetDatabaseError()
gxDatabase::ResetFileLock()
gxDatabase::ResetRecordLock()
gxDatabase::Seek()
gxDatabase::SeekTo()
gxDatabase::SetDatabaseError()
gxDatabase::SetRevisionLetter()
gxDatabase::StaticArea()
gxDatabase::TestFileHeader()
gxDatabase::TotalBlocks()
gxDatabase::UnDelete()
gxDatabase::UnlockFile()
gxDatabase::UnlockRecord()
gxDatabase::Write()
gxDatabase::WriteBlockHdr()
gxDatabase::WriteFileHdr()
gxDatabase::WriteFileLockHdr()
gxDatabase::WriteObjectChecksum()
gxDatabase::WriteRecordLockHdr()

gxDatabase::gxDatabase() - Default class constructor.

gxDatabase::gxDatabase(const gxDatabase &ob) - Private copy constructor used to disallow copying to prevent multiple copies of database objects. Forcing pointer semantics to helps to ensure the safe deletion or modification of a database object.

void gxDatabase::operator=(const gxDatabase &ob) - Private assignment operator used to disallow assignment to prevent multiple copies of database objects. Forcing pointer semantics to helps to ensure the safe deletion or modification of a database object.

virtual gxDatabase::~gxDatabase() - Virtual class destructor responsible for closing the open file and flushing any disk buffers.

virtual FAU gxDatabase::Alloc(__ULWORD__ bytes,gxDatabaseReclaimMethod method = gxDBASE_RECLAIM_FIRSTFIT) - Public member function used to allocate a specified number of bytes for a database object. The number of bytes allocated is adjusted to hold a block header, associated overhead, and the object or record. Only the block header is written to the allocated space. The application is responsible for writing the object or record to the block at the file address returned by this function. This function will return a zero if an allocation error occurs. NOTE: The database engine will position the file pointer to the file address where the next write operation should take place after allocating space for the object. The block reclamation method should be set to gxDBASE_RECLAIM_NONE (to extend the file and do not reclaim deleted blocks), gxDBASE_RECLAIM_BESTFIT (to reclaim deleted blocks using the best fit reclamation method ), or gxDBASE _RECLAIM_FIRSTFIT (to reclaim deleted blocks using the first fit reclamation method).

size_t gxDatabase::BlockHeaderSize() - Public member function that returns the correct size of the block header plus any overhead according to the revision level. This function should only be used when calculating file offsets and not for determining the actual size of the gxBlockHeader data structure.

__ULWORD__ gxDatabase::BlockLength(FAU object_address = gxCurrAddress) - Public member function that returns the total length of a block, in bytes, at a specified address. The total length refers to the size of the block header including any block overhead plus the block data.

__ULWORD__ gxDatabase::CalcChecksum(__ULWORD__ bytes, FAU file_address, int mem_alloc = 1) - Public member function used to calculate a 32-bit CRC checksum base on the Ethernet polynomial of 0x4C11DB7 for a given number of bytes starting at the specified address. Returns a 32-bit CRC value. If the "mem_alloc" variable is true, a buffer equal to the specified number of bytes will be created in memory. If the "mem_alloc" variable is false or memory allocation fails the CRC will be calculated byte by byte starting at the specified address.

virtual gxDatabaseError gxDatabase::Close() - Virtual public member function used to close an open database file. Returns a non-zero value to indicate an error condition or zero if successful.

virtual gxDatabaseError gxDatabase::Create(const char *fname, FAU static_size = (FAU_t) 0, __SBYTE__ RevisionLetter = gxDatabaseRevisionLetter) - Virtual public member function used to create a new file and truncate the file if it already exists. The "static_size" variable is used to reserve a specified number of bytes that will not be affected by the dynamic allocation routines. The "RevisionLetter" variable is used to select a specific revision letter when the file is created. The revision letter is used to enable or disable specific features that will determine the amount of overhead per block. Returns a non-zero value to indicate an error condition or zero if successful.

const char *gxDatabase::DatabaseExceptionMessage() - Public member function that returns a null terminated string, which can be used to log or print the last reported database exception.

const char *gxDatabase::DatabaseName() - Public member function that returns the file name of currently opened database file.

int gxDatabase::Delete(FAU object_address, int remove = 0) - Public member function used to mark a block at the specified object address deleted and leaves the object unchanged, allowing it to be undeleted. If the "remove" variable is true the block is marked removed, indicating that the object cannot be undeleted. Returns true if the block was deleted/removed or false if the block was not deleted/removed.

FAU gxDatabase::DeleteBlocks(FAU *d = 0, FAU *r = 0) - Public member function that returns the total number of removed and deleted blocks and passes back the number of delete and removed blocks in the "d" and "r" variables.

static int gxDatabase::Exists(const char *fname) - Static public member function that returns true if the "fname" file exists.

size_t gxDatabase::FileHeaderSize() - Public member function that returns the correct size of the file header plus any overhead according to the revision level. This function should only be used when calculating file offsets and not for determining the actual size of the gxFileHeader data structure.

gxStreamPos gxDatabase::FilePosition() - Public member function that returns the current file position. Returns the current file position or -1 to indicate an error condition.

static FAU gxDatabase::FileSize(const char *fname) - Static public member function used to obtain the size of file "fname". Returns the file size or -1 to indicate an error condition.

FAU gxDatabase::FindFirstBlock(FAU offset = (FAU_t)0) - Public member function used to search through the file until a valid block is found. The search begins starts at specified offset. This function will return zero if no valid blocks are found or the end of file is reached.

FAU gxDatabase::FindFirstObject(FAU offset = (FAU_t)0) - Public member function used to search through the file until a valid block is found and then return the object's address. If the block is marked deleted or removed, this function will continue searching until the first normal block is found. The search begins starts at specified offset. This function will return zero if no valid blocks are found or the end of file is reached.

FAU gxDatabase::FindNextBlock(FAU offset = (FAU_t)0) - Public member function used to search through the file until the next valid block after the first valid block is found. The search begins starts at specified offset. This function will return zero if no valid blocks are found or the end of file is reached.

FAU gxDatabase::FindNextObject(FAU offset = (FAU_t)0) - Public member function used to search through the file until the next valid block after the first valid block is found and then return the object's address. If the block is marked deleted or removed, this function will continue searching until the next normal block is found. The search begins starts at specified offset. This function will return zero if no valid blocks are found or the end of file is reached.

FAU gxDatabase::FindPrevBlock(FAU offset) - Public member function used to search backwards through the database until a valid block is found and then return the block's address. If the block is marked deleted this function continue searching until the first normal block is found. The search starts at the specified offset. Returns 0 if no valid block is found in the file or the start of file is reached.

FAU gxDatabase::FindPrevObject(FAU offset) - Public member function used to search backwards through the database until a valid block is found and then return the object's address. If the block is marked deleted this function will continue searching until the first normal block is found. The search starts at the specified offset. Returns 0 if no valid block is found in the file or the start of file is reached.

virtual gxDatabaseError gxDatabase::Flush() - Public member function used flush the file header and any open disk buffers. Returns a non-zero value to indicate an error condition or zero if successful.

gxDatabaseError gxDatabase::GetDatabaseError() - Public member function the returns an error code representing the last reported database error.

FAU gxDatabase::GetDatabaseFreeSpace() - Public member function that returns the file address to the starting address of the free space list. This function returns zero if no blocks have been deleted or removed.

FAU gxDatabase::GetEOF() - Public member function that returns the "end of file" marker stored in the file header.

FAU gxDatabase::GetHeapStart() - Public member function that returns the file address where the dynamic data area starts.

FAU gxDatabase::GetHighestBlock() - Public member function that returns the file address of the highest allocated block.

char gxDatabase::GetRevLetter() - Returns the current database revision letter which will be used to perform compatibility checks to ensure compatibility with all file revisions.

const char *gxDatabase::GetSignature() - Public member function that returns the file signature stored in the file header.

FAU gxDatabase::GetVersion() - Public member function that returns the library version number stored in the file header.

gxDatabaseError gxDatabase::InitFileHdr() - Protected member function used initialize the file header with default values and write it to disk. Returns a non-zero value to indicate an error condition or zero if successful.

void gxDatabase::InitFileLockHdr(gxFileLockHeader &hdr) - Public member function used to initialize a the lock header for a newly constructed file lock header.

void gxDatabase::InitRecordLockHdr(gxRecordLockHeader &hdr) - Public member function used to initialize a the lock header for a newly constructed record lock header.

int gxDatabase::IsOK() - Public member function that returns false if a fatal error condition has been reached.

int gxDatabase::IsOpen() - Public member function that returns true if a database file is open.

int gxDatabase::LockFile(gxDatabaseLockType l_type = gxDBASE_WRITELOCK) - Public member function used to lock the entire database file during a multi-threaded read or write operation. The "l_type" variable should be set to gxDBASE_WRITELOCK for exclusive file locks owned by a single thread or to gxDBASE_READLOCK for shared file locks owned by multiple threads. Returns a non-zero value if the file cannot be locked or the lock variable cannot be changed because it is exclusive or another thread is currently updating it.

int gxDatabase::LockRecord(gxDatabaseLockType l_type = gxDBASE_WRITELOCK,FAU block_address = gxCurrAddress) - Public member function used to a single node at the specified block address during a multi-threaded read or write operation. The "l_type" variable should be set to gxDBASE_WRITELOCK for exclusive record locks owned by a single thread or to gxDBASE_READLOCK for shared record locks owned by multiple threads. Returns a non-zero value if the node cannot be locked or the lock variable cannot be changed because it is exclusive or another thread is currently updating it.

__ULWORD__ gxDatabase::ObjectLength(FAU object_address = gxCurrAddress) - Public member function that returns the object's length, in bytes, at a specified object address.

virtual gxDatabaseError gxDatabase::Open(const char *fname, gxDatabaseAccessMode mode = gxDBASE_READWRITE) - Virtual public member function used to open an existing file. The "mode" variable determines if the file is opened for read only or read/write access. This function will check and record the database revision letter each time an existing file is opened. Returns a non-zero value to indicate an error condition or zero if successful. This version of the open functions will only accept: gxDBASE_READONLY or gxDBASE_READWRITE access modes.

gxDatabaseError gxDatabase::Read(void *buf, __ULWORD__ bytes, FAU file_address = gxCurrAddress) - Public member function used to read a specified number of bytes from the specified file offset or the current file position into a memory buffer. Returns a non-zero value to indicate an error condition or zero if successful.

gxDatabaseError gxDatabase::ReadBlockHdr(gxBlockHeader &hdr, FAU block_address = gxCurrAddress) - Public member function used to read a block header and tests the block's check word to ensure that this is a valid block. Returns a non-zero value to indicate an error condition or zero if successful.

gxDatabaseError gxDatabase::ReadFileHdr() - Public member function used to read the database file header. Returns a non-zero value to indicate an error condition or zero if successful.

gxDatabaseError gxDatabase::ReadFileLockHdr(gxFileLockHeader &hdr) - Public member function used to read the lock header from the file. Returns a non-zero value to indicate an error condition or zero if successful.

int gxDatabase::ReadForReading() - Public member function that returns true if the file is ready for reading.

int gxDatabase::ReadObjectChecksum(FAU object_address, __ULWORD__ *object_crc = 0,__ULWORD__ *calc_crc = 0) - Used by an application to test the object's CRC value stored on disk against the actual CRC of the bytes stored on disk. The Address variable must be set to the file address of the block data, not the block header. This function assumes that the data has already been written to the block. Returns true if the object's CRC test good or false if the CRC tests bad. Passes back the object's CRC stored on disk in the "object_crc" variable and the calculated CRC value in the "calc_crc" variable.

gxDatabaseError gxDatabase::ReadRecordLockHdr(gxRecordLockHeader &hdr, FAU block_address = gxCurrAddress) - Public member function used to read the block's record lock header. Returns a non-zero value to indicate an error condition or zero if successful.

int gxDatabase::ReadyForWriting() - Public member function that returns true if the file is ready for writing or false if this is a read only file.

FAU gxDatabase::ReclaimBestFit(__ULWORD__ bytes) - Public member function used by the dynamic allocation routines to search for a block that can be reused. This function will search the free space list for an "exact-fit" first and then try to find the "best-fit" for the number of bytes requested. NOTE: The byte size will be adjusted by the dynamic allocation routine to allocate space for the block header plus any block overhead. An exact-fit is a block that matches the exact number of bytes requested. If an exact-fit cannot be found, the next block big enough to hold number of bytes requested plus a block header with overhead and at least one byte left over becomes a "best-fit" block. A "best-fit" search continues until a block with the least number of unused bytes is found. The unused bytes in a "best-fit" block are used to create a new block that will be put back on the free space list. This "best-fit" method is specifically designed to keep the gaps between blocks as small as possible, with the smallest gap being as large as a single block header plus one byte. The "best-fit" method will prevent fragmentation as much as possible but it can be very costly in terms of speed. Returns address of the reclaimed space, or zero if a deleted or removed block of the appropriate size is not found

FAU gxDatabase::ReclaimFirstFit(__ULWORD__ bytes) - Public member function used by the dynamic allocation routines to search a for block that can be reused. This function will search the free space list for the first deleted block large enough to hold the number of bytes requested. A "first-fit" search continues until the first block big enough to hold the number of bytes requested plus the size a block header with overhead and at least one byte left over is returned. The unused bytes in a "first-fit" block are used to create a new block that will be put back on the free space list. The "first-fit" method will not prevent fragmentation as well as the "best-fit" method but offers a tremendous speed advantage. Returns address of the reclaimed space, or zero if a deleted or removed block of the appropriate size is not found

int gxDatabase::Remove(FAU object_address) - Public member function used to mark a database block removed indicating that the object cannot be undeleted. Returns true if the block was or removed or false if the block was not removed.

gxDatabaseError gxDatabase::ResetDatabaseError() - Public member function used to reset the last reported database error.

gxDatabaseError gxDatabase::ResetFileLock() - Public member function used to reset the database file lock header. NOTE: This function will clear all the file lock fields without testing the lock or the lock protect. Returns a non-zero value to indicate an error condition or zero if successful.

gxDatabaseError gxDatabase::ResetRecordLock(FAU block_address = gxCurrAddress) - Public member function used to reset the block's record lock. NOTE: This function will clear all the record lock fields without testing the lock or the lock protect. Returns a non-zero value to indicate an error condition or zero if successful.

gxDatabaseError gxDatabase::Seek(FAU offset, gxDatabaseSeekMode mode = gxDBASE_SEEK_BEG) - Public member function used to seek to the specified offset starting at the beginning of the file (gxDBASE_SEEK_BEG), the end of the file (gxDBASE_SEEK_END) or current offset (gxDBASE_SEEK_CUR). Returns a non-zero value to indicate an error condition or zero if successful.

FAU gxDatabase::SeekTo(FAU file_address) - Public member function used to seek to the specified address, optimizing the seek operation by moving the file position indicator based on the current stream position. Returns the current file position after performing the seek operation.

gxDatabaseError gxDatabase::SetDatabaseError(gxDatabaseError err) - Public member function used to set the last reported database error. This function is used to inform the database engine of a fatal error condition. Redundantly returns the "err" value to allow this function to be used as a return value.

void gxDatabase::SetRevisionLetter(__SBYTE__ RevisionLetter) - Public member function used to set the database revision letter to a specified value. If a valid revision is not specified the current revision letter will be used. The function is used to detect revision letter errors when new database files are created.

FAU gxDatabase::StaticArea() - Public member that returns the size of the pre-allocated static data area.

int gxDatabase::TestFileHeader() - Public member function used to ensure that the in-memory copy of the file header and the disk copy stay in sync during multiple file access. This function will return zero if no errors are found, or return the number of errors encountered during the test. If any errors are encountered the file header will be re-read from disk.

FAU gxDatabase::TotalBlocks() - Public member function that returns the total number of normal, deleted, and removed blocks.

int gxDatabase::UnDelete(FAU object_address) - Public member function used to undelete a secified object if the block has not been removed or reclaimed.

int gxDatabase::UnlockFile(gxDatabaseLockType l_type = gxDBASE_WRITELOCK) - Public member function used to unlock the file following a multi-threaded read or write operation. The "l_type" variable should be set to gxDBASE_WRITELOCK for exclusive file locks owned by a single thread or to gxDBASE_READLOCK for shared file locks owned by multiple threads. Returns a non-zero value if the file cannot be unlocked or the lock variable cannot be changed because it is exclusive or another thread is currently updating it.

int gxDatabase::UnlockRecord(gxDatabaseLockType l_type = gxDBASE_WRITELOCK,FAU block_address = gxCurrAddress) - Public member function used to unlock a specific node following a multi-threaded read or write operation. The "l_type" variable should be set to gxDBASE_WRITELOCK for exclusive record locks owned by a single thread or to gxDBASE_READLOCK for shared record locks owned by multiple threads. Returns a non-zero value if the record cannot be unlocked or the lock variable cannot be changed because it is exclusive or another thread is currently updating it.

gxDatabaseError gxDatabase::Write(const void *buf, __ULWORD__ bytes, FAU file_address = gxCurrAddress,int flush = 1, int bit_test = 1) - Public member function used to write a specific number of bytes from a memory buffer to a specified file offset. If the "flush" variable is true, the file buffers will be flushed to disk with each write operation. If the "bit_test" variable if true, the CRC of the buffer will be compared to the CRC of the actual bytes written to disk. Returns a non-zero value to indicate an error condition or zero if successful.

gxDatabaseError gxDatabase::WriteBlockHdr(const gxBlockHeader &hdr, FAU block_address = gxCurrAddress) - Public member function to write a block header to the specified block address. Returns a non-zero value to indicate an error condition or zero if successful.

gxDatabaseError gxDatabase::WriteFileHdr() - Public member function used to write the database file header. Returns a non-zero value to indicate an error condition or zero if successful.

gxDatabaseError gxDatabase::WriteFileLockHdr(const gxFileLockHeader &hdr) - Public member function used to write the lock header to the file. Returns a non-zero value to indicate an error condition or zero if successful.

gxUINT32 gxDatabase::WriteObjectChecksum(FAU object_address) - Used by an application to write a 32-bit checksum for the object at the end of a block. The Address variable must be set to the file address of the block data, not the block header. This function assumes that the data has already been written to the block. Returns the 32-bit CRC checksum value for the object stored in the block.

gxDatabaseError gxDatabase::WriteRecordLockHdr(const gxRecordLockHeader &hdr, FAU block_address = gxCurrAddress) - Public member function used to write the block's record lock header. Returns a non-zero value to indicate an error condition or zero if successful.


End Of Document