Btrieve 2
Loading...
Searching...
No Matches
BtrieveFile Class Reference

The Btrieve file class. More...

#include <btrieveCpp.h>

Public Member Functions

 BtrieveFile ()
 
 ~BtrieveFile ()
 
Btrieve::StatusCode BulkCreate (BtrieveBulkCreatePayload *btrieveBulkCreatePayload, BtrieveBulkCreateResult *btrieveBulkCreateResult)
 Bulk create.
 
Btrieve::StatusCode BulkDeleteNext (BtrieveBulkDeleteAttributes *bulkDeleteAttributes, BtrieveBulkDeleteResult *bulkDeleteResult)
 Delete bulk next.
 
Btrieve::StatusCode BulkDeletePrevious (BtrieveBulkDeleteAttributes *bulkDeleteAttributes, BtrieveBulkDeleteResult *bulkDeleteResult)
 Delete bulk previous.
 
Btrieve::StatusCode BulkRetrieveNext (BtrieveBulkRetrieveAttributes *bulkRetrieveAttributes, BtrieveBulkRetrieveResult *bulkRetrieveResult, Btrieve::LockMode lockMode=Btrieve::LOCK_MODE_NONE)
 Retrieve bulk next.
 
Btrieve::StatusCode BulkRetrievePrevious (BtrieveBulkRetrieveAttributes *bulkRetrieveAttributes, BtrieveBulkRetrieveResult *bulkRetrieveResult, Btrieve::LockMode lockMode=Btrieve::LOCK_MODE_NONE)
 Retrieve bulk previous.
 
long long GetCursorPosition ()
 Get the cursor position.
 
Btrieve::StatusCode GetInformation (BtrieveFileInformation *btrieveFileInformation)
 Get the file information.
 
Btrieve::StatusCode GetLastStatusCode ()
 Get the last status code.
 
int GetNumerator (Btrieve::Index index, const char *key, int keyLength, int denominator)
 Get the numerator which best approximates the location of the key within the index relative to the denominator.
 
int GetNumerator (long long cursorPosition, int denominator)
 Get the numerator which best approximates the location of the cursor position within the file relative to the denominator.
 
int GetPercentage (Btrieve::Index index, const char *key, int keyLength)
 Get the percentage which best approximates the location of the key within the given index.
 
int GetPercentage (long long cursorPosition)
 Get the percentage which best approximates the location of the cursor position within the file.
 
long long GetRecordCreateTime ()
 Get the record create time.
 
long long GetRecordUpdateTime ()
 Get the record update time.
 
Btrieve::StatusCode IndexCreate (BtrieveIndexAttributes *btrieveIndexAttributes)
 Create an index.
 
Btrieve::StatusCode IndexDrop (Btrieve::Index index)
 Drop an index.
 
Btrieve::StatusCode KeyRetrieve (Btrieve::Comparison comparison, Btrieve::Index index, char *key, int keyLength)
 Retrieve a key using the given comparison, index, and key.
 
Btrieve::StatusCode KeyRetrieveFirst (Btrieve::Index index, char *key, int keySize)
 Retrieve the first key.
 
Btrieve::StatusCode KeyRetrieveLast (Btrieve::Index index, char *key, int keySize)
 Retrieve the last key.
 
Btrieve::StatusCode KeyRetrieveNext (char *key, int keySize)
 Retrieve the next key.
 
Btrieve::StatusCode KeyRetrievePrevious (char *key, int keySize)
 Retrieve the previous key.
 
Btrieve::StatusCode RecordAppendChunk (const char *chunk, int chunkLength)
 Append a record chunk.
 
Btrieve::StatusCode RecordCreate (char *record, int recordLength)
 Create a record.
 
Btrieve::StatusCode RecordDelete ()
 Delete a record.
 
Btrieve::StatusCode RecordDeleteChunk (int chunkLength)
 Delete a record chunk at the current offset.
 
Btrieve::StatusCode RecordDeleteChunk (int offset, int chunkLength)
 Delete a record chunk.
 
Btrieve::StatusCode RecordInsertChunk (const char *chunk, int chunkLength)
 Insert a record chunk at the current offset.
 
Btrieve::StatusCode RecordInsertChunk (int offset, const char *chunk, int chunkLength)
 Insert a record chunk.
 
int RecordRetrieve (Btrieve::Comparison comparison, Btrieve::Index index, char *key, int keyLength, char *record, int recordSize, Btrieve::LockMode lockMode=Btrieve::LOCK_MODE_NONE)
 Retrieve a record using the given comparison, index, and key.
 
int RecordRetrieveByCursorPosition (Btrieve::Index index, long long cursorPosition, char *key, int keySize, char *record, int recordSize, Btrieve::LockMode lockMode=Btrieve::LOCK_MODE_NONE)
 Retrieve a record by cursor position.
 
int RecordRetrieveByCursorPosition (Btrieve::Index index, long long cursorPosition, char *record, int recordSize, Btrieve::LockMode lockMode=Btrieve::LOCK_MODE_NONE)
 Retrieve a record by cursor position.
 
int RecordRetrieveByFraction (Btrieve::Index index, int numerator, int denominator, char *key, int keySize, char *record, int recordSize, Btrieve::LockMode lockMode=Btrieve::LOCK_MODE_NONE)
 Retrieve a record by fraction.
 
int RecordRetrieveByFraction (Btrieve::Index index, int numerator, int denominator, char *record, int recordSize, Btrieve::LockMode lockMode=Btrieve::LOCK_MODE_NONE)
 Retrieve a record by fraction.
 
int RecordRetrieveByPercentage (Btrieve::Index index, int percentage, char *key, int keySize, char *record, int recordSize, Btrieve::LockMode lockMode=Btrieve::LOCK_MODE_NONE)
 Retrieve a record by percentage.
 
int RecordRetrieveByPercentage (Btrieve::Index index, int percentage, char *record, int recordSize, Btrieve::LockMode lockMode=Btrieve::LOCK_MODE_NONE)
 Retrieve a record by percentage.
 
int RecordRetrieveChunk (int length, char *chunk, int chunkSize, Btrieve::LockMode lockMode=Btrieve::LOCK_MODE_NONE)
 Retrieve a record chunk at the current offset.
 
int RecordRetrieveChunk (int offset, int length, char *chunk, int chunkSize, Btrieve::LockMode lockMode=Btrieve::LOCK_MODE_NONE)
 Retrieve a record chunk.
 
int RecordRetrieveFirst (Btrieve::Index index, char *key, int keySize, char *record, int recordSize, Btrieve::LockMode lockMode=Btrieve::LOCK_MODE_NONE)
 Retrieve the first record.
 
int RecordRetrieveFirst (Btrieve::Index index, char *record, int recordSize, Btrieve::LockMode lockMode=Btrieve::LOCK_MODE_NONE)
 Retrieve the first record.
 
int RecordRetrieveLast (Btrieve::Index index, char *key, int keySize, char *record, int recordSize, Btrieve::LockMode lockMode=Btrieve::LOCK_MODE_NONE)
 Retrieve the last record.
 
int RecordRetrieveLast (Btrieve::Index index, char *record, int recordSize, Btrieve::LockMode lockMode=Btrieve::LOCK_MODE_NONE)
 Retrieve the last record.
 
int RecordRetrieveNext (char *key, int keySize, char *record, int recordSize, Btrieve::LockMode lockMode=Btrieve::LOCK_MODE_NONE)
 Retrieve the next record.
 
int RecordRetrieveNext (char *record, int recordSize, Btrieve::LockMode lockMode=Btrieve::LOCK_MODE_NONE)
 Retrieve the next record.
 
int RecordRetrievePrevious (char *key, int keySize, char *record, int recordSize, Btrieve::LockMode lockMode=Btrieve::LOCK_MODE_NONE)
 Retrieve the previous record.
 
int RecordRetrievePrevious (char *record, int recordSize, Btrieve::LockMode lockMode=Btrieve::LOCK_MODE_NONE)
 Retrieve the previous record.
 
Btrieve::StatusCode RecordTruncate ()
 Truncate a record at the current offset.
 
Btrieve::StatusCode RecordTruncate (int offset)
 Truncate a record.
 
Btrieve::StatusCode RecordUnlock (Btrieve::UnlockMode unlockMode)
 Unlock a record or records.
 
Btrieve::StatusCode RecordUpdate (const char *record, int recordLength)
 Update a record.
 
Btrieve::StatusCode RecordUpdateChunk (const char *chunk, int chunkLength)
 Update a record chunk at the current offset.
 
Btrieve::StatusCode RecordUpdateChunk (int offset, const char *chunk, int chunkLength)
 Update a record chunk.
 
Btrieve::StatusCode SetOwner (Btrieve::OwnerMode ownerMode, const char *ownerName=NULL, const char *ownerNameAgain=NULL, bool useLongOwnerName=true)
 Set the owner.
 
Btrieve::StatusCode UnlockCursorPosition (long long cursorPosition)
 Unlock the cursor position.
 

Detailed Description

The Btrieve file class.

In order to retrieve, update, and delete records in a Btrieve file the cursor must be established. The following methods are among those used to establish the cursor:

Once established, the cursor enables traversal over the records in the file. The following methods are among those used to traverse over the file:

The cursor may be re-established repeatedly.

Examples
Test_BTRV2.cpp, bfileattributes.cpp, bfileinformation.cpp, bfilter.cpp, bindexattributes.cpp, bkeyonly.cpp, block.cpp, bpercentage.cpp, btest.cpp, btestappend.cpp, btestbulk.cpp, btestchunk.cpp, and btestvlr.cpp.

Constructor & Destructor Documentation

◆ BtrieveFile()

BtrieveFile::BtrieveFile ( )
Snippet
C++ btest.cpp
BtrieveFile btrieveFile;
Python btest.py
btrieveFile = btrievePython.BtrieveFile()
assert(btrieveFile != None)
See also
BtrieveClient::FileOpen

◆ ~BtrieveFile()

BtrieveFile::~BtrieveFile ( )

Member Function Documentation

◆ BulkCreate()

Btrieve::StatusCode BtrieveFile::BulkCreate ( BtrieveBulkCreatePayload * btrieveBulkCreatePayload,
BtrieveBulkCreateResult * btrieveBulkCreateResult )

Bulk create.

Parameters
[in]btrieveBulkCreatePayloadThe bulk create payload.
[out]btrieveBulkCreateResultThe bulk create result.
Snippet
C++ btestbulk.cpp
// If BulkCreate() fails.
if ((status = btrieveFile->BulkCreate(&btrieveBulkCreatePayload, &btrieveBulkCreateResult)) != Btrieve::STATUS_CODE_NO_ERROR)
{
printf("Error: BtrieveFile::BulkCreate():%d:%s.\n", status, Btrieve::StatusCodeToString(status));
goto leave;
}
Python btestbulk.py
rc = btrieveFile.BulkCreate(btrieveBulkCreatePayload, btrieveBulkCreateResult)
assert(rc == btrievePython.Btrieve.STATUS_CODE_NO_ERROR), "Error: BtrieveBulkCreatePayload::BulkCreate():%d:%s.\n" % (rc, btrievePython.Btrieve_StatusCodeToString(rc))
Cursor

The cursor is unaffected.
Current Offset
The current offset is unaffected.
Return values
= Btrieve::STATUS_CODE_NO_ERRORSuccess.
!= Btrieve::STATUS_CODE_NO_ERRORAn error has occurred.
See also
Btrieve::StatusCodeToString
Examples
btestbulk.cpp.

◆ BulkDeleteNext()

Btrieve::StatusCode BtrieveFile::BulkDeleteNext ( BtrieveBulkDeleteAttributes * bulkDeleteAttributes,
BtrieveBulkDeleteResult * bulkDeleteResult )

Delete bulk next.

Parameters
[in]bulkDeleteAttributesThe bulk delete attributes.
[out]bulkDeleteResultThe bulk delete result.
Cursor

The cursor must be established. The cursor is traversed forward to the last record examined.
Current Offset
The current offset is destroyed.
Return values
= Btrieve::STATUS_CODE_END_OF_FILESuccess. Zero or more records were deleted. There are no more records matching the given bulk delete attributes.
= Btrieve::STATUS_CODE_NO_ERRORSuccess. One or more records were deleted. There may be more records matching the given bulk delete attributes.
OtherwiseAn error has occurred.
See also
Btrieve::StatusCodeToString

◆ BulkDeletePrevious()

Btrieve::StatusCode BtrieveFile::BulkDeletePrevious ( BtrieveBulkDeleteAttributes * bulkDeleteAttributes,
BtrieveBulkDeleteResult * bulkDeleteResult )

Delete bulk previous.

Parameters
[in]bulkDeleteAttributesThe bulk delete attributes.
[out]bulkDeleteResultThe bulk delete result.
Cursor

The cursor must be established. The cursor is traversed backwards to the last record examined.
Current Offset
The current offset is destroyed.
Return values
= Btrieve::STATUS_CODE_END_OF_FILESuccess. Zero or more records were deleted. There are no more records matching the given bulk delete attributes.
= Btrieve::STATUS_CODE_NO_ERRORSuccess. One or more records were deleted. There may be more records matching the given bulk delete attributes.
OtherwiseAn error has occurred.
See also
Btrieve::StatusCodeToString

◆ BulkRetrieveNext()

Btrieve::StatusCode BtrieveFile::BulkRetrieveNext ( BtrieveBulkRetrieveAttributes * bulkRetrieveAttributes,
BtrieveBulkRetrieveResult * bulkRetrieveResult,
Btrieve::LockMode lockMode = Btrieve::LOCK_MODE_NONE )

Retrieve bulk next.

Parameters
[in]bulkRetrieveAttributesThe bulk retrieve attributes.
[out]bulkRetrieveResultThe bulk retrieve result.
[in]lockModeThe lock mode.
Snippet
C++ btestbulk.cpp
// If BulkRetrieveNext() fails.
if ((status = btrieveFile->BulkRetrieveNext(&btrieveBulkRetrieveAttributes, &btrieveBulkRetrieveResult)) != Btrieve::STATUS_CODE_NO_ERROR)
{
printf("Error: BtrieveFile::BulkRetrieveNext():%d:%s.\n", status, Btrieve::StatusCodeToString(status));
goto leave;
}
Python btestbulk.py
rc = btrieveFile.BulkRetrieveNext(btrieveBulkRetrieveAttributes, btrieveBulkRetrieveResult)
assert(rc == btrievePython.Btrieve.STATUS_CODE_NO_ERROR), "Error: BtrieveFile::BulkRetrieveNext():%d:%s.\n" % (rc, btrievePython.Btrieve_StatusCodeToString(rc))
Cursor

The cursor must be established. The cursor is traversed forward to the last record examined.
Current Offset
The current offset is destroyed.
Return values
= Btrieve::STATUS_CODE_END_OF_FILESuccess. Zero or more records were retrieved. There are no more records matching the given bulk retrieve attributes.
= Btrieve::STATUS_CODE_NO_ERRORSuccess. One or more records were retrieved. There may be more records matching the given bulk retrieve attributes.
OtherwiseAn error has occurred.
See also
Btrieve::StatusCodeToString
Examples
bfilter.cpp, and btestbulk.cpp.

◆ BulkRetrievePrevious()

Btrieve::StatusCode BtrieveFile::BulkRetrievePrevious ( BtrieveBulkRetrieveAttributes * bulkRetrieveAttributes,
BtrieveBulkRetrieveResult * bulkRetrieveResult,
Btrieve::LockMode lockMode = Btrieve::LOCK_MODE_NONE )

Retrieve bulk previous.

Parameters
[in]bulkRetrieveAttributesThe bulk retrieve attributes.
[out]bulkRetrieveResultThe bulk retrieve result.
[in]lockModeThe lock mode.
Cursor

The cursor must be established. The cursor is traversed backwards to the last record examined.
Current Offset
The current offset is destroyed.
Return values
= Btrieve::STATUS_CODE_END_OF_FILESuccess. Zero or more records were retrieved. There are no more records matching the given bulk retrieve attributes.
= Btrieve::STATUS_CODE_NO_ERRORSuccess. One or more records were retrieved. There may be more records matching the given bulk retrieve attributes.
OtherwiseAn error has occurred.
See also
Btrieve::StatusCodeToString

◆ GetCursorPosition()

long long BtrieveFile::GetCursorPosition ( )

Get the cursor position.

Note
The signature for this method changed in PSQL v13 R2.
Snippet
C++ bpercentage.cpp
// If GetCursorPosition() fails.
if ((cursorPosition = btrieveFile->GetCursorPosition()) == -1)
{
status = btrieveFile->GetLastStatusCode();
printf("Error: BtrieveFile::GetCursorPosition():%d:%s.\n", status, Btrieve::StatusCodeToString(status));
goto leave;
}
Python bpercentage.py
cursorPosition = btrieveFile.GetCursorPosition()
assert(cursorPosition != -1), "Error: BtrieveFile::GetCursorPosition():%d:%s.\n" % (rc, btrievePython.Btrieve_StatusCodeToString(btrieveFile.GetLastStatusCode()))
Cursor

The cursor is unaffected but must be established.
Current Offset
The current offset is unaffected.
Return values
>= 0The cursor position.
-1An error has occurred. Use BtrieveFile::GetLastStatusCode to determine the Btrieve::StatusCode associated with any error.
Examples
bpercentage.cpp.

◆ GetInformation()

Btrieve::StatusCode BtrieveFile::GetInformation ( BtrieveFileInformation * btrieveFileInformation)

Get the file information.

Parameters
[out]btrieveFileInformationThe file information.
Snippet
C++ bfileinformation.cpp
// If GetInformation() fails.
if ((status = btrieveFile->GetInformation(&btrieveFileInformation)) != Btrieve::STATUS_CODE_NO_ERROR)
{
printf("Error: BtrieveFile::GetInformation():%d:%s.\n", status, Btrieve::StatusCodeToString(status));
goto leave;
}
Python bfileinformation.py
rc = btrieveFile.GetInformation(btrieveFileInformation)
assert(rc == btrievePython.Btrieve.STATUS_CODE_NO_ERROR), "Error: BtrieveFile::GetInformation():%d:%s.\n" % (rc, btrievePython.Btrieve_StatusCodeToString(rc))
Cursor

The cursor is unaffected.
Current Offset
The current offset is unaffected.
Return values
= Btrieve::STATUS_CODE_NO_ERRORSuccess.
!= Btrieve::STATUS_CODE_NO_ERRORAn error has occurred.
See also
Btrieve::StatusCodeToString
Examples
bfileattributes.cpp, and bfileinformation.cpp.

◆ GetLastStatusCode()

Btrieve::StatusCode BtrieveFile::GetLastStatusCode ( )

Get the last status code.

Note
This method is intended for use following methods which don't return a status code.
Snippet
C++ btest.cpp
// If RecordRetrieve() fails.
if (btrieveFile->RecordRetrieve(Btrieve::COMPARISON_EQUAL, Btrieve::INDEX_1, (char *)key, sizeof(*key), (char *)&record, sizeof(record)) != sizeof(record))
{
status = btrieveFile->GetLastStatusCode();
printf("Error: BtrieveFile::RecordRetrieve():%d:%s.\n", status, Btrieve::StatusCodeToString(status));
goto leave;
}
Python btest.py
rc = btrieveFile.RecordRetrieve(btrievePython.Btrieve.COMPARISON_EQUAL, btrievePython.Btrieve.INDEX_1, key, record)
assert(rc == recordLength), "Error: BtrieveFile::RecordRetrieve():%d:%s.\n" % (rc, btrievePython.Btrieve_StatusCodeToString(btrieveFile.GetLastStatusCode()))
Cursor

The cursor is unaffected.
Current Offset
The current offset is unaffected.
Return values
= Btrieve::STATUS_CODE_NO_ERRORSuccess.
!= Btrieve::STATUS_CODE_NO_ERRORAn error has occurred.
See also
Btrieve::StatusCodeToString
Examples
Test_BTRV2.cpp, bfilter.cpp, bindexattributes.cpp, block.cpp, bpercentage.cpp, btest.cpp, btestappend.cpp, btestbulk.cpp, btestchunk.cpp, and btestvlr.cpp.

◆ GetNumerator() [1/2]

int BtrieveFile::GetNumerator ( Btrieve::Index index,
const char * key,
int keyLength,
int denominator )

Get the numerator which best approximates the location of the key within the index relative to the denominator.

Parameters
[in]indexThe index.
[in]keyThe key.
[in]keyLengthThe key length.
[in]denominatorThe denominator.
Snippet
C++ bpercentage.cpp
// If GetNumerator() fails.
if ((numerator = btrieveFile->GetNumerator(Btrieve::INDEX_1, (char *)&key, sizeof(key), NUMBER_OF_RECORDS)) == -1)
{
status = btrieveFile->GetLastStatusCode();
printf("Error: BtrieveFile::GetNumerator():%d:%s.\n", status, Btrieve::StatusCodeToString(status));
goto leave;
}
Python bpercentage.py
numerator = btrieveFile.GetNumerator(btrievePython.Btrieve.INDEX_1, key, numberOfRecords)
assert(numerator != -1), "Error: BtrieveFile::GetNumerator():%d:%s.\n" % (rc, btrievePython.Btrieve_StatusCodeToString(btrieveFile.GetLastStatusCode()))
Cursor

The cursor is unaffected.
Current Offset
The current offset is unaffected.
Return values
>= 0The numerator returned as 0 through denominator.
-1An error has occurred. Use BtrieveFile::GetLastStatusCode to determine the Btrieve::StatusCode associated with any error.

◆ GetNumerator() [2/2]

int BtrieveFile::GetNumerator ( long long cursorPosition,
int denominator )

Get the numerator which best approximates the location of the cursor position within the file relative to the denominator.

Note
The signature for this method changed in PSQL v13 R2.
Parameters
[in]cursorPositionThe cursor position.
[in]denominatorThe denominator.
Snippet
C++ bpercentage.cpp
// If GetNumerator() fails.
if ((numerator = btrieveFile->GetNumerator(cursorPosition, NUMBER_OF_RECORDS)) == -1)
{
status = btrieveFile->GetLastStatusCode();
printf("Error: BtrieveFile::GetNumerator():%d:%s.\n", status, Btrieve::StatusCodeToString(status));
goto leave;
}
Python bpercentage.py
numerator = btrieveFile.GetNumerator(cursorPosition, numberOfRecords)
assert(numerator != -1), "Error: BtrieveFile::GetNumerator():%d:%s.\n" % (rc, btrievePython.Btrieve_StatusCodeToString(btrieveFile.GetLastStatusCode()))
Cursor

The cursor is unaffected.
Current Offset
The current offset is unaffected.
Return values
>= 0The numerator returned as 0 through denominator.
-1An error has occurred. Use BtrieveFile::GetLastStatusCode to determine the Btrieve::StatusCode associated with any error.
Examples
bpercentage.cpp.

◆ GetPercentage() [1/2]

int BtrieveFile::GetPercentage ( Btrieve::Index index,
const char * key,
int keyLength )

Get the percentage which best approximates the location of the key within the given index.

Parameters
[in]indexThe index.
[in]keyThe key.
[in]keyLengthThe key length.
Snippet
C++ bpercentage.cpp
// If GetPercentage() fails.
if ((percentage = btrieveFile->GetPercentage(Btrieve::INDEX_1, (char *)&key, sizeof(key))) == -1)
{
status = btrieveFile->GetLastStatusCode();
printf("Error: BtrieveFile::GetPercentage():%d:%s.\n", status, Btrieve::StatusCodeToString(status));
goto leave;
}
Python bpercentage.py
percentage = btrieveFile.GetPercentage(btrievePython.Btrieve.INDEX_1, key)
assert(percentage != -1), "Error: BtrieveFile::GetPercentage():%d:%s.\n" % (rc, btrievePython.Btrieve_StatusCodeToString(btrieveFile.GetLastStatusCode()))
Cursor

The cursor is unaffected.
Current Offset
The current offset is unaffected.
Return values
>= 0The percentage returned as 0 through 10,000, corresponding to 0% through 100.00%.
-1An error has occurred. Use BtrieveFile::GetLastStatusCode to determine the Btrieve::StatusCode associated with any error.

◆ GetPercentage() [2/2]

int BtrieveFile::GetPercentage ( long long cursorPosition)

Get the percentage which best approximates the location of the cursor position within the file.

Note
The signature for this method changed in PSQL v13 R2.
Parameters
[in]cursorPositionThe cursor position.
Snippet
C++ bpercentage.cpp
// If GetPercentage() fails.
if ((percentage = btrieveFile->GetPercentage(cursorPosition)) == -1)
{
status = btrieveFile->GetLastStatusCode();
printf("Error: BtrieveFile::GetPercentage():%d:%s.\n", status, Btrieve::StatusCodeToString(status));
goto leave;
}
Python bpercentage.py
percentage = btrieveFile.GetPercentage(cursorPosition)
assert(percentage != -1), "Error: BtrieveFile::GetPercentage():%d:%s.\n" % (rc, btrievePython.Btrieve_StatusCodeToString(btrieveFile.GetLastStatusCode()))
Cursor

The cursor is unaffected.
Current Offset
The current offset is unaffected.
Return values
>= 0The percentage returned as 0 through 10,000, corresponding to 0% through 100.00%.
-1An error has occurred. Use BtrieveFile::GetLastStatusCode to determine the Btrieve::StatusCode associated with any error.
Examples
bpercentage.cpp.

◆ GetRecordCreateTime()

long long BtrieveFile::GetRecordCreateTime ( )

Get the record create time.

Cursor

The cursor is unaffected but must be established.
Current Offset
The current offset is unaffected.
Return values
> 0The record create time as a Btrieve timestamp.
= 0The record create time is unavailable. Ensure the file was created with system data. See BtrieveFileAttributes::SetSystemDataMode.
-1An error has occurred. Use BtrieveFile::GetLastStatusCode to determine the Btrieve::StatusCode associated with any error.
See also
Btrieve::TimestampToUnixEpochMicroseconds

◆ GetRecordUpdateTime()

long long BtrieveFile::GetRecordUpdateTime ( )

Get the record update time.

Cursor

The cursor is unaffected but must be established.
Current Offset
The current offset is unaffected.
Return values
> 0The record update time as a Btrieve timestamp.
= 0The record update time is unavailable. Ensure the file was created with system data version 2. See BtrieveFileAttributes::SetSystemDataMode.
-1An error has occurred. Use BtrieveFile::GetLastStatusCode to determine the Btrieve::StatusCode associated with any error.
See also
Btrieve::TimestampToUnixEpochMicroseconds

◆ IndexCreate()

Btrieve::StatusCode BtrieveFile::IndexCreate ( BtrieveIndexAttributes * btrieveIndexAttributes)

Create an index.

Parameters
[in]btrieveIndexAttributesThe index attributes.
Snippet
C++ btest.cpp
// If IndexCreate() fails.
if ((status = btrieveFile->IndexCreate(&btrieveIndexAttributes)) != Btrieve::STATUS_CODE_NO_ERROR)
{
printf("Error: BtrieveFile::IndexCreate():%d:%s.\n", status, Btrieve::StatusCodeToString(status));
goto leave;
}
Python btest.py
rc = btrieveFile.IndexCreate(btrieveIndexAttributes)
assert(rc == btrievePython.Btrieve.STATUS_CODE_NO_ERROR), "Error: BtrieveFile::IndexCreate():%d:%s.\n" % (rc, btrievePython.Btrieve_StatusCodeToString(rc))
Cursor

The cursor is unaffected.
Current Offset
The current offset is unaffected.
Return values
= Btrieve::STATUS_CODE_NO_ERRORSuccess.
!= Btrieve::STATUS_CODE_NO_ERRORAn error has occurred.
See also
Btrieve::StatusCodeToString
Examples
Test_BTRV2.cpp, bfilter.cpp, bindexattributes.cpp, block.cpp, bpercentage.cpp, btest.cpp, and btestvlr.cpp.

◆ IndexDrop()

Btrieve::StatusCode BtrieveFile::IndexDrop ( Btrieve::Index index)

Drop an index.

Parameters
[in]indexThe index.
Cursor

If the cursor index is dropped the cursor is destroyed. Otherwise, the cursor is unaffected.
Current Offset
The current offset is unaffected.
Return values
= Btrieve::STATUS_CODE_NO_ERRORSuccess.
!= Btrieve::STATUS_CODE_NO_ERRORAn error has occurred.
See also
Btrieve::StatusCodeToString

◆ KeyRetrieve()

Btrieve::StatusCode BtrieveFile::KeyRetrieve ( Btrieve::Comparison comparison,
Btrieve::Index index,
char * key,
int keyLength )

Retrieve a key using the given comparison, index, and key.

Note
The signature for this method changed in PSQL v15 R0.
Parameters
[in]comparisonThe comparison. Btrieve::COMPARISON_NOT_EQUAL isn't supported.
[in]indexThe index.
[in,out]keyThe key.
[in]keyLengthThe key length.
Snippet
C++ bkeyonly.cpp
// If KeyRetrieve() fails.
if ((status = btrieveFile->KeyRetrieve(Btrieve::COMPARISON_EQUAL, Btrieve::INDEX_1, (char *)key, sizeof(*key))) == Btrieve::STATUS_CODE_NO_ERROR)
{
printf("%u is prime.\n", *key);
goto leave;
}
{
printf("%u is not prime.\n", *key);
goto leave;
}
printf("Error: BtrieveClient::KeyRetrieve():%d:%s.\n", status, Btrieve::StatusCodeToString(status));
Python bkeyonly.py
rc = btrieveFile.KeyRetrieve(btrievePython.Btrieve.COMPARISON_EQUAL, btrievePython.Btrieve.INDEX_1, key)
if (rc == btrievePython.Btrieve.STATUS_CODE_NO_ERROR):
print(integerValue, "is prime.")
elif (rc == btrievePython.Btrieve.STATUS_CODE_KEY_VALUE_NOT_FOUND):
print(integerValue, "is not prime.")
else:
assert(False), "Error: BtrieveFile::KeyRetrieve():%d:%s.\n" % (rc, btrievePython.Btrieve_StatusCodeToString(rc))
Cursor

The cursor is established.
Current Offset
The current offset is destroyed.
Return values
= Btrieve::STATUS_CODE_NO_ERRORSuccess.
!= Btrieve::STATUS_CODE_NO_ERRORAn error has occurred.
See also
Btrieve::StatusCodeToString
Examples
bkeyonly.cpp.

◆ KeyRetrieveFirst()

Btrieve::StatusCode BtrieveFile::KeyRetrieveFirst ( Btrieve::Index index,
char * key,
int keySize )

Retrieve the first key.

Parameters
[in]indexThe index.
[out]keyThe key.
[in]keySizeThe key size.
Cursor

The cursor is established.
Current Offset
The current offset is destroyed.
Return values
= Btrieve::STATUS_CODE_NO_ERRORSuccess.
!= Btrieve::STATUS_CODE_NO_ERRORAn error has occurred.
See also
Btrieve::StatusCodeToString

◆ KeyRetrieveLast()

Btrieve::StatusCode BtrieveFile::KeyRetrieveLast ( Btrieve::Index index,
char * key,
int keySize )

Retrieve the last key.

Parameters
[in]indexThe index.
[out]keyThe key.
[in]keySizeThe key size.
Cursor

The cursor is established.
Current Offset
The current offset is destroyed.
Return values
= Btrieve::STATUS_CODE_NO_ERRORSuccess.
!= Btrieve::STATUS_CODE_NO_ERRORAn error has occurred.
See also
Btrieve::StatusCodeToString

◆ KeyRetrieveNext()

Btrieve::StatusCode BtrieveFile::KeyRetrieveNext ( char * key,
int keySize )

Retrieve the next key.

Parameters
[out]keyThe key.
[in]keySizeThe key size.
Cursor

The cursor must be established. The cursor is traversed forward one key.
Current Offset
The current offset is destroyed.
Return values
= Btrieve::STATUS_CODE_NO_ERRORSuccess.
!= Btrieve::STATUS_CODE_NO_ERRORAn error has occurred.
See also
Btrieve::StatusCodeToString

◆ KeyRetrievePrevious()

Btrieve::StatusCode BtrieveFile::KeyRetrievePrevious ( char * key,
int keySize )

Retrieve the previous key.

Parameters
[out]keyThe key.
[in]keySizeThe key size.
Cursor

The cursor must be established. The cursor is traversed backward one key.
Current Offset
The current offset is destroyed.
Return values
= Btrieve::STATUS_CODE_NO_ERRORSuccess.
!= Btrieve::STATUS_CODE_NO_ERRORAn error has occurred.
See also
Btrieve::StatusCodeToString

◆ RecordAppendChunk()

Btrieve::StatusCode BtrieveFile::RecordAppendChunk ( const char * chunk,
int chunkLength )

Append a record chunk.

Parameters
[in]chunkThe chunk.
[in]chunkLengthThe chunk length.
Description
The file must have variable length records. See BtrieveFileAttributes::SetVariableLengthRecordsMode.
Snippet
C++ btestappend.cpp
// If RecordAppendChunk() fails.
if ((status = btrieveFile->RecordAppendChunk((char *)&chunk, sizeof(chunk))) != Btrieve::STATUS_CODE_NO_ERROR)
{
printf("Error: BtrieveFile::RecordAppendChunk():%d:%s.\n", status, Btrieve::StatusCodeToString(status));
goto leave;
}
Python btestappend.py
rc = btrieveFile.RecordAppendChunk(chunk)
assert(rc == btrievePython.Btrieve.STATUS_CODE_NO_ERROR), "Error: BtrieveFile::RecordAppendChunk():%d:%s.\n" % (rc, btrievePython.Btrieve_StatusCodeToString(rc))
Cursor

The cursor is unaffected but must be established.
Current Offset
The current offset is established at the end of the appended chunk.
Return values
= Btrieve::STATUS_CODE_NO_ERRORSuccess.
!= Btrieve::STATUS_CODE_NO_ERRORAn error has occurred.
See also
Btrieve::StatusCodeToString
Examples
btestappend.cpp.

◆ RecordCreate()

Btrieve::StatusCode BtrieveFile::RecordCreate ( char * record,
int recordLength )

Create a record.

Note
The signature for this method changed in PSQL v13 R2.
Parameters
[in,out]recordThe record. If the current record contains a Btrieve::DATA_TYPE_AUTOINCREMENT or Btrieve::DATA_TYPE_AUTOTIMESTAMP key segment then the passed in record may be modifed.
[in]recordLengthThe record length. Record length is limited to Btrieve::MAXIMUM_RECORD_LENGTH bytes. See BtrieveFile::RecordAppendChunk for creating records greater than Btrieve::MAXIMUM_RECORD_LENGTH in length.
Snippet
C++ btest.cpp
// If RecordCreate() fails.
if ((status = btrieveFile->RecordCreate((char *)&record, sizeof(record))) != Btrieve::STATUS_CODE_NO_ERROR)
{
printf("Error: BtrieveFile::RecordCreate():%d:%s.\n", status, Btrieve::StatusCodeToString(status));
goto leave;
}
Python btest.py
rc = btrieveFile.RecordCreate(record)
assert(rc == btrievePython.Btrieve.STATUS_CODE_NO_ERROR), "Error: BtrieveFile::RecordCreate():%d:%s.\n" % (rc, btrievePython.Btrieve_StatusCodeToString(rc))
Cursor

The cursor is established.
Current Offset
The current offset is unaffected.
Return values
= Btrieve::STATUS_CODE_NO_ERRORSuccess.
!= Btrieve::STATUS_CODE_NO_ERRORAn error has occurred.
See also
Btrieve::StatusCodeToString
Examples
Test_BTRV2.cpp, bfilter.cpp, bindexattributes.cpp, bkeyonly.cpp, block.cpp, bpercentage.cpp, btest.cpp, btestappend.cpp, btestchunk.cpp, and btestvlr.cpp.

◆ RecordDelete()

Btrieve::StatusCode BtrieveFile::RecordDelete ( )

Delete a record.

Snippet
C++ bkeyonly.cpp
// If RecordDelete() fails.
if ((status = btrieveFile->RecordDelete()) != Btrieve::STATUS_CODE_NO_ERROR)
{
printf("Error: BtrieveFile::RecordDelete():%d:%s.\n", status, Btrieve::StatusCodeToString(status));
goto leave;
}
Python bkeyonly.py
rc = btrieveFile.RecordDelete()
assert(rc == btrievePython.Btrieve.STATUS_CODE_NO_ERROR), "Error: BtrieveFile::RecordDelete():%d:%s.\n" % (rc, btrievePython.Btrieve_StatusCodeToString(rc))
Cursor

The cursor is unaffected but must be established.
Current Offset
The current offset is destroyed.
Return values
= Btrieve::STATUS_CODE_NO_ERRORSuccess.
!= Btrieve::STATUS_CODE_NO_ERRORAn error has occurred.
See also
Btrieve::StatusCodeToString
Examples
bkeyonly.cpp.

◆ RecordDeleteChunk() [1/2]

Btrieve::StatusCode BtrieveFile::RecordDeleteChunk ( int chunkLength)

Delete a record chunk at the current offset.

Parameters
[in]chunkLengthThe chunk length.
Description
The file must have variable length records. See BtrieveFileAttributes::SetVariableLengthRecordsMode.
Cursor

The cursor is unaffected but must be established.
Current Offset
The current offset must be established and is then traversed forward to the end of the deleted chunk.
Return values
= Btrieve::STATUS_CODE_NO_ERRORSuccess.
!= Btrieve::STATUS_CODE_NO_ERRORAn error has occurred.

◆ RecordDeleteChunk() [2/2]

Btrieve::StatusCode BtrieveFile::RecordDeleteChunk ( int offset,
int chunkLength )

Delete a record chunk.

Parameters
[in]offsetThe offset. If offset is -1, then the current offset is used. Offset must be within the variable length portion of the record.
[in]chunkLengthThe chunk length.
Description
The file must have variable length records. See BtrieveFileAttributes::SetVariableLengthRecordsMode.
Cursor

The cursor is unaffected but must be established.
Current Offset
The current offset is established at the end of the deleted chunk.
Return values
= Btrieve::STATUS_CODE_NO_ERRORSuccess.
!= Btrieve::STATUS_CODE_NO_ERRORAn error has occurred.

◆ RecordInsertChunk() [1/2]

Btrieve::StatusCode BtrieveFile::RecordInsertChunk ( const char * chunk,
int chunkLength )

Insert a record chunk at the current offset.

Parameters
[in]chunkThe chunk.
[in]chunkLengthThe chunk length.
Description
The file must have variable length records. See BtrieveFileAttributes::SetVariableLengthRecordsMode.
Cursor

The cursor is unaffected but must be established.
Current Offset
The current offset must be established and is then traversed forward to the end of the inserted chunk.
Return values
= Btrieve::STATUS_CODE_NO_ERRORSuccess.
!= Btrieve::STATUS_CODE_NO_ERRORAn error has occurred.

◆ RecordInsertChunk() [2/2]

Btrieve::StatusCode BtrieveFile::RecordInsertChunk ( int offset,
const char * chunk,
int chunkLength )

Insert a record chunk.

Parameters
[in]offsetThe offset. If offset is -1, then the current offset is used. Offset must be within the variable length portion of the record.
[in]chunkThe chunk.
[in]chunkLengthThe chunk length.
Description
The file must have variable length records. See BtrieveFileAttributes::SetVariableLengthRecordsMode.
Cursor

The cursor is unaffected but must be established.
Current Offset
The current offset is established at the end of the inserted chunk.
Return values
= Btrieve::STATUS_CODE_NO_ERRORSuccess.
!= Btrieve::STATUS_CODE_NO_ERRORAn error has occurred.

◆ RecordRetrieve()

int BtrieveFile::RecordRetrieve ( Btrieve::Comparison comparison,
Btrieve::Index index,
char * key,
int keyLength,
char * record,
int recordSize,
Btrieve::LockMode lockMode = Btrieve::LOCK_MODE_NONE )

Retrieve a record using the given comparison, index, and key.

Note
This method doesn't return a Btrieve::StatusCode. See below for more information.
The signature for this method changed in PSQL v15 R0.
Parameters
[in]comparisonThe comparison. Btrieve::COMPARISON_NOT_EQUAL isn't supported.
[in]indexThe index.
[in,out]keyThe key.
[in]keyLengthThe key length.
[out]recordThe record.
[in]recordSizeThe record size.
[in]lockModeThe lock mode.
Snippet
C++ btest.cpp
// If RecordRetrieve() fails.
if (btrieveFile->RecordRetrieve(Btrieve::COMPARISON_EQUAL, Btrieve::INDEX_1, (char *)key, sizeof(*key), (char *)&record, sizeof(record)) != sizeof(record))
{
status = btrieveFile->GetLastStatusCode();
printf("Error: BtrieveFile::RecordRetrieve():%d:%s.\n", status, Btrieve::StatusCodeToString(status));
goto leave;
}
Python btest.py
rc = btrieveFile.RecordRetrieve(btrievePython.Btrieve.COMPARISON_EQUAL, btrievePython.Btrieve.INDEX_1, key, record)
assert(rc == recordLength), "Error: BtrieveFile::RecordRetrieve():%d:%s.\n" % (rc, btrievePython.Btrieve_StatusCodeToString(btrieveFile.GetLastStatusCode()))
Cursor

The cursor is established.
Current Offset
The current offset is destroyed.
Return values
>= 0The number of bytes read. The number of bytes read is limited to Btrieve::MAXIMUM_RECORD_LENGTH. See BtrieveFile::RecordRetrieveChunk for retrieving records greater than Btrieve::MAXIMUM_RECORD_LENGTH in length. If the record size requested is less than the length of the current record then BtrieveFile::GetLastStatusCode will return Btrieve::STATUS_CODE_DATALENGTH_ERROR.
-1An error has occurred. Use BtrieveFile::GetLastStatusCode to determine the Btrieve::StatusCode associated with any error.
Examples
bkeyonly.cpp, btest.cpp, and btestvlr.cpp.

◆ RecordRetrieveByCursorPosition() [1/2]

int BtrieveFile::RecordRetrieveByCursorPosition ( Btrieve::Index index,
long long cursorPosition,
char * key,
int keySize,
char * record,
int recordSize,
Btrieve::LockMode lockMode = Btrieve::LOCK_MODE_NONE )

Retrieve a record by cursor position.

Note
This method doesn't return a Btrieve::StatusCode. See below for more information.
Parameters
[in]indexAn index or Btrieve::INDEX_NONE.
[in]cursorPositionThe cursor position.
[out]keyThe key.
[in]keySizeThe key size.
[out]recordThe record.
[in]recordSizeThe record size.
[in]lockModeThe lock mode.
Cursor

The cursor is established.
Current Offset
The current offset is destroyed.
Return values
>= 0The number of bytes read. The number of bytes read is limited to Btrieve::MAXIMUM_RECORD_LENGTH. See BtrieveFile::RecordRetrieveChunk for retrieving records greater than Btrieve::MAXIMUM_RECORD_LENGTH in length. If the record size requested is less than the length of the current record then BtrieveFile::GetLastStatusCode will return Btrieve::STATUS_CODE_DATALENGTH_ERROR.
-1An error has occurred. Use BtrieveFile::GetLastStatusCode to determine the Btrieve::StatusCode associated with any error.

◆ RecordRetrieveByCursorPosition() [2/2]

int BtrieveFile::RecordRetrieveByCursorPosition ( Btrieve::Index index,
long long cursorPosition,
char * record,
int recordSize,
Btrieve::LockMode lockMode = Btrieve::LOCK_MODE_NONE )

Retrieve a record by cursor position.

Note
This method doesn't return a Btrieve::StatusCode. See below for more information.
The signature for this method changed in PSQL v13 R2.
Parameters
[in]indexAn index or Btrieve::INDEX_NONE.
[in]cursorPositionThe cursor position.
[out]recordThe record.
[in]recordSizeThe record size.
[in]lockModeThe lock mode.
Snippet
C++ bpercentage.cpp
// If RecordRetrieveByCursorPosition() fails.
if (btrieveFile->RecordRetrieveByCursorPosition(Btrieve::INDEX_1, cursorPosition, (char *)&record, sizeof(record)) != sizeof(record))
{
printf("Error: BtrieveFileAttributes::RecordRetrieveByCursorPosition():%d:%s.\n", status, Btrieve::StatusCodeToString(status));
goto leave;
}
Python bpercentage.py
rc = btrieveFile.RecordRetrieveByCursorPosition(btrievePython.Btrieve.INDEX_1, cursorPosition, record)
assert(rc == recordLength), "Error: BtrieveFile::RecordRetrieveByCursorPosition():%d:%s.\n" % (rc, btrievePython.Btrieve_StatusCodeToString(btrieveFile.GetLastStatusCode()))
Cursor

The cursor is established.
Current Offset
The current offset is destroyed.
Return values
>= 0The number of bytes read. The number of bytes read is limited to Btrieve::MAXIMUM_RECORD_LENGTH. See BtrieveFile::RecordRetrieveChunk for retrieving records greater than Btrieve::MAXIMUM_RECORD_LENGTH in length. If the record size requested is less than the length of the current record then BtrieveFile::GetLastStatusCode will return Btrieve::STATUS_CODE_DATALENGTH_ERROR.
-1An error has occurred. Use BtrieveFile::GetLastStatusCode to determine the Btrieve::StatusCode associated with any error.
Examples
bpercentage.cpp.

◆ RecordRetrieveByFraction() [1/2]

int BtrieveFile::RecordRetrieveByFraction ( Btrieve::Index index,
int numerator,
int denominator,
char * key,
int keySize,
char * record,
int recordSize,
Btrieve::LockMode lockMode = Btrieve::LOCK_MODE_NONE )

Retrieve a record by fraction.

Note
This method doesn't return a Btrieve::StatusCode. See below for more information.
Parameters
[in]indexAn index or Btrieve::INDEX_NONE.
[in]numeratorThe numerator given as 0 through denominator.
[in]denominatorThe denominator.
[out]keyThe key.
[in]keySizeThe key size.
[out]recordThe record.
[in]recordSizeThe record size.
[in]lockModeThe lock mode.
Cursor

The cursor is established.
Current Offset
The current offset is destroyed.
Return values
>= 0The number of bytes read. The number of bytes read is limited to Btrieve::MAXIMUM_RECORD_LENGTH. See BtrieveFile::RecordRetrieveChunk for retrieving records greater than Btrieve::MAXIMUM_RECORD_LENGTH in length. If the record size requested is less than the length of the current record then BtrieveFile::GetLastStatusCode will return Btrieve::STATUS_CODE_DATALENGTH_ERROR.
-1An error has occurred. Use BtrieveFile::GetLastStatusCode to determine the Btrieve::StatusCode associated with any error.

◆ RecordRetrieveByFraction() [2/2]

int BtrieveFile::RecordRetrieveByFraction ( Btrieve::Index index,
int numerator,
int denominator,
char * record,
int recordSize,
Btrieve::LockMode lockMode = Btrieve::LOCK_MODE_NONE )

Retrieve a record by fraction.

Note
This method doesn't return a Btrieve::StatusCode. See below for more information.
Parameters
[in]indexAn index or Btrieve::INDEX_NONE.
[in]numeratorThe numerator given as 0 through denominator.
[in]denominatorThe denominator.
[out]recordThe record.
[in]recordSizeThe record size.
[in]lockModeThe lock mode.
Snippet
C++ bpercentage.cpp
// If RecordRetrieveByFraction() fails.
if (btrieveFile->RecordRetrieveByFraction(Btrieve::INDEX_1, NUMBER_OF_RECORDS / 2, NUMBER_OF_RECORDS, (char *)&record, sizeof(record)) != sizeof(record))
{
status = btrieveFile->GetLastStatusCode();
printf("Error: BtrieveFile::RecordRetrieveByFraction():%d:%s.\n", status, Btrieve::StatusCodeToString(status));
goto leave;
}
Python bpercentage.py
rc = btrieveFile.RecordRetrieveByFraction(btrievePython.Btrieve.INDEX_1, int(numberOfRecords / 2), numberOfRecords, record)
assert(rc == recordLength), "Error: BtrieveFile::RecordRetrieveByFraction():%d:%s.\n" % (rc, btrievePython.Btrieve_StatusCodeToString(btrieveFile.GetLastStatusCode()))
Cursor

The cursor is established.
Current Offset
The current offset is destroyed.
Return values
>= 0The number of bytes read. The number of bytes read is limited to Btrieve::MAXIMUM_RECORD_LENGTH. See BtrieveFile::RecordRetrieveChunk for retrieving records greater than Btrieve::MAXIMUM_RECORD_LENGTH in length. If the record size requested is less than the length of the current record then BtrieveFile::GetLastStatusCode will return Btrieve::STATUS_CODE_DATALENGTH_ERROR.
-1An error has occurred. Use BtrieveFile::GetLastStatusCode to determine the Btrieve::StatusCode associated with any error.
Examples
bpercentage.cpp.

◆ RecordRetrieveByPercentage() [1/2]

int BtrieveFile::RecordRetrieveByPercentage ( Btrieve::Index index,
int percentage,
char * key,
int keySize,
char * record,
int recordSize,
Btrieve::LockMode lockMode = Btrieve::LOCK_MODE_NONE )

Retrieve a record by percentage.

Note
This method doesn't return a Btrieve::StatusCode. See below for more information.
Parameters
[in]indexAn index or Btrieve::INDEX_NONE.
[in]percentageThe percentage given as 0 through 10,000, corresponding to 0% through 100.00%.
[out]keyThe key.
[in]keySizeThe key size.
[out]recordThe record.
[in]recordSizeThe record size.
[in]lockModeThe lock mode.
Cursor

The cursor is established.
Current Offset
The current offset is destroyed.
Return values
>= 0The number of bytes read. The number of bytes read is limited to Btrieve::MAXIMUM_RECORD_LENGTH. See BtrieveFile::RecordRetrieveChunk for retrieving records greater than Btrieve::MAXIMUM_RECORD_LENGTH in length. If the record size requested is less than the length of the current record then BtrieveFile::GetLastStatusCode will return Btrieve::STATUS_CODE_DATALENGTH_ERROR.
-1An error has occurred. Use BtrieveFile::GetLastStatusCode to determine the Btrieve::StatusCode associated with any error.

◆ RecordRetrieveByPercentage() [2/2]

int BtrieveFile::RecordRetrieveByPercentage ( Btrieve::Index index,
int percentage,
char * record,
int recordSize,
Btrieve::LockMode lockMode = Btrieve::LOCK_MODE_NONE )

Retrieve a record by percentage.

Note
This method doesn't return a Btrieve::StatusCode. See below for more information.
Parameters
[in]indexAn index or Btrieve::INDEX_NONE.
[in]percentageThe percentage given as 0 through 10,000, corresponding to 0% through 100.00%.
[out]recordThe record.
[in]recordSizeThe record size.
[in]lockModeThe lock mode.
Snippet
C++ bpercentage.cpp
// If RecordRetrieveByPercentage() fails.
if (btrieveFile->RecordRetrieveByPercentage(Btrieve::INDEX_1, 5000, (char *)&record, sizeof(record)) != sizeof(record))
{
status = btrieveFile->GetLastStatusCode();
printf("Error: BtrieveFile::RecordRetrieveByPercentage():%d:%s.\n", status, Btrieve::StatusCodeToString(status));
goto leave;
}
Python bpercentage.py
rc = btrieveFile.RecordRetrieveByPercentage(btrievePython.Btrieve.INDEX_1, 5000, record)
assert(rc == recordLength), "Error: BtrieveFile::RecordRetrieveByPercentage():%d:%s.\n" % (rc, btrievePython.Btrieve_StatusCodeToString(btrieveFile.GetLastStatusCode()))
Cursor

The cursor is established.
Current Offset
The current offset is destroyed.
Return values
>= 0The number of bytes read. The number of bytes read is limited to Btrieve::MAXIMUM_RECORD_LENGTH. See BtrieveFile::RecordRetrieveChunk for retrieving records greater than Btrieve::MAXIMUM_RECORD_LENGTH in length. If the record size requested is less than the length of the current record then BtrieveFile::GetLastStatusCode will return Btrieve::STATUS_CODE_DATALENGTH_ERROR.
-1An error has occurred. Use BtrieveFile::GetLastStatusCode to determine the Btrieve::StatusCode associated with any error.
Examples
bpercentage.cpp.

◆ RecordRetrieveChunk() [1/2]

int BtrieveFile::RecordRetrieveChunk ( int length,
char * chunk,
int chunkSize,
Btrieve::LockMode lockMode = Btrieve::LOCK_MODE_NONE )

Retrieve a record chunk at the current offset.

Note
This method doesn't return a Btrieve::StatusCode. See below for more information.
Parameters
[in]lengthThe length.
[out]chunkThe chunk.
[in]chunkSizeThe chunk size.
[in]lockModeThe lock mode.
Snippet
C++ btestchunk.cpp
// If RecordRetrieveChunk() fails.
if (btrieveFile->RecordRetrieveChunk(sizeof(chunk), (char *)&chunk, sizeof(chunk)) != sizeof(chunk))
{
status = btrieveFile->GetLastStatusCode();
printf("Error: BtrieveFile::RecordRetrieveChunk():%d:%s.\n", status, Btrieve::StatusCodeToString(status));
goto leave;
}
Python btestchunk.py
rc = btrieveFile.RecordRetrieveChunk(chunkLength, chunk)
assert(rc == chunkLength), "Error: BtrieveFile::RecordRetrieveChunk():%d:%s.\n" % (rc, btrievePython.Btrieve_StatusCodeToString(btrieveFile.GetLastStatusCode()))
Cursor

The cursor is unaffected but must be established.
Current Offset
The current offset must be established and is then traversed forward to the end of the retrieved chunk.
Return values
>= 0The number of bytes read. You may retrieve multiple chunks.
-1An error has occurred. Use BtrieveFile::GetLastStatusCode to determine the Btrieve::StatusCode associated with any error.

◆ RecordRetrieveChunk() [2/2]

int BtrieveFile::RecordRetrieveChunk ( int offset,
int length,
char * chunk,
int chunkSize,
Btrieve::LockMode lockMode = Btrieve::LOCK_MODE_NONE )

Retrieve a record chunk.

Note
This method doesn't return a Btrieve::StatusCode. See below for more information.
Parameters
[in]offsetThe offset. If offset is -1, then the current offset is used.
[in]lengthThe length.
[out]chunkThe chunk.
[in]chunkSizeThe chunk size.
[in]lockModeThe lock mode.
Snippet
C++ btestchunk.cpp
// If RecordRetrieveChunk() fails.
if (btrieveFile->RecordRetrieveChunk(0, sizeof(chunk), (char *)&chunk, sizeof(chunk)) != sizeof(chunk))
{
status = btrieveFile->GetLastStatusCode();
printf("Error: BtrieveFile::RecordRetrieveChunk():%d:%s.\n", status, Btrieve::StatusCodeToString(status));
goto leave;
}
Python btestchunk.py
rc = btrieveFile.RecordRetrieveChunk(0, chunkLength, chunk)
assert(rc == chunkLength), "Error: BtrieveFile::RecordRetrieveChunk():%d:%s.\n" % (rc, btrievePython.Btrieve_StatusCodeToString(btrieveFile.GetLastStatusCode()))
Cursor

The cursor is unaffected but must be established.
Current Offset
The current offset is established at the end of the retrieved chunk.
Return values
>= 0The number of bytes read. You may retrieve multiple chunks.
-1An error has occurred. Use BtrieveFile::GetLastStatusCode to determine the Btrieve::StatusCode associated with any error.
Examples
btestappend.cpp, and btestchunk.cpp.

◆ RecordRetrieveFirst() [1/2]

int BtrieveFile::RecordRetrieveFirst ( Btrieve::Index index,
char * key,
int keySize,
char * record,
int recordSize,
Btrieve::LockMode lockMode = Btrieve::LOCK_MODE_NONE )

Retrieve the first record.

Note
This method doesn't return a Btrieve::StatusCode. See below for more information.
Parameters
[in]indexAn index or Btrieve::INDEX_NONE.
[out]keyThe key.
[in]keySizeThe key size.
[out]recordThe record.
[in]recordSizeThe record size.
[in]lockModeThe lock mode.
Cursor

The cursor is established.
Current Offset
The current offset is destroyed.
Return values
>= 0The number of bytes read. The number of bytes read is limited to Btrieve::MAXIMUM_RECORD_LENGTH. See BtrieveFile::RecordRetrieveChunk for retrieving records greater than Btrieve::MAXIMUM_RECORD_LENGTH in length. If the record size requested is less than the length of the current record then BtrieveFile::GetLastStatusCode will return Btrieve::STATUS_CODE_DATALENGTH_ERROR.
-1An error has occurred. Use BtrieveFile::GetLastStatusCode to determine the Btrieve::StatusCode associated with any error.

◆ RecordRetrieveFirst() [2/2]

int BtrieveFile::RecordRetrieveFirst ( Btrieve::Index index,
char * record,
int recordSize,
Btrieve::LockMode lockMode = Btrieve::LOCK_MODE_NONE )

Retrieve the first record.

Note
This method doesn't return a Btrieve::StatusCode. See below for more information.
Parameters
[in]indexAn index or Btrieve::INDEX_NONE.
[out]recordThe record.
[in]recordSizeThe record size.
[in]lockModeThe lock mode.
Snippet
C++ btestbulk.cpp
// If RecordRetrieveFirst() fails.
if (btrieveFile->RecordRetrieveFirst(Btrieve::INDEX_NONE, (char *)&record, sizeof(record)) != sizeof(record))
{
status = btrieveFile->GetLastStatusCode();
printf("Error: BtrieveFile::RecordRetrieveFirst():%d:%s.\n", status, Btrieve::StatusCodeToString(status));
goto leave;
}
Python btestbulk.py
rc = btrieveFile.RecordRetrieveFirst(btrievePython.Btrieve.INDEX_NONE, record)
assert(rc == recordLength), "Error: BtrieveFile::RecordRetrieveFirst():%d:%s.\n" % (rc, btrievePython.Btrieve_StatusCodeToString(btrieveFile.GetLastStatusCode()))
Cursor

The cursor is established.
Current Offset
The current offset is destroyed.
Return values
>= 0The number of bytes read. The number of bytes read is limited to Btrieve::MAXIMUM_RECORD_LENGTH. See BtrieveFile::RecordRetrieveChunk for retrieving records greater than Btrieve::MAXIMUM_RECORD_LENGTH in length. If the record size requested is less than the length of the current record then BtrieveFile::GetLastStatusCode will return Btrieve::STATUS_CODE_DATALENGTH_ERROR.
-1An error has occurred. Use BtrieveFile::GetLastStatusCode to determine the Btrieve::StatusCode associated with any error.
Examples
bfilter.cpp, bindexattributes.cpp, block.cpp, bpercentage.cpp, btestappend.cpp, btestbulk.cpp, and btestchunk.cpp.

◆ RecordRetrieveLast() [1/2]

int BtrieveFile::RecordRetrieveLast ( Btrieve::Index index,
char * key,
int keySize,
char * record,
int recordSize,
Btrieve::LockMode lockMode = Btrieve::LOCK_MODE_NONE )

Retrieve the last record.

Note
This method doesn't return a Btrieve::StatusCode. See below for more information.
Parameters
[in]indexAn index or Btrieve::INDEX_NONE.
[out]keyThe key.
[in]keySizeThe key size.
[out]recordThe record.
[in]recordSizeThe record size.
[in]lockModeThe lock mode.
Cursor

The cursor is established.
Current Offset
The current offset is destroyed.
Return values
>= 0The number of bytes read. The number of bytes read is limited to Btrieve::MAXIMUM_RECORD_LENGTH. See BtrieveFile::RecordRetrieveChunk for retrieving records greater than Btrieve::MAXIMUM_RECORD_LENGTH in length. If the record size requested is less than the length of the current record then BtrieveFile::GetLastStatusCode will return Btrieve::STATUS_CODE_DATALENGTH_ERROR.
-1An error has occurred. Use BtrieveFile::GetLastStatusCode to determine the Btrieve::StatusCode associated with any error.

◆ RecordRetrieveLast() [2/2]

int BtrieveFile::RecordRetrieveLast ( Btrieve::Index index,
char * record,
int recordSize,
Btrieve::LockMode lockMode = Btrieve::LOCK_MODE_NONE )

Retrieve the last record.

Note
This method doesn't return a Btrieve::StatusCode. See below for more information.
Parameters
[in]indexAn index or Btrieve::INDEX_NONE.
[out]recordThe record.
[in]recordSizeThe record size.
[in]lockModeThe lock mode.
Snippet
C++ bpercentage.cpp
// If RecordRetrieveLast() fails.
if (btrieveFile->RecordRetrieveLast(Btrieve::INDEX_1, (char *)&record, sizeof(record)) != sizeof(record))
{
status = btrieveFile->GetLastStatusCode();
printf("Error: BtrieveFile::RecordRetrieveLast():%d:%s.\n", status, Btrieve::StatusCodeToString(status));
goto leave;
}
Python bpercentage.py
rc = btrieveFile.RecordRetrieveLast(btrievePython.Btrieve.INDEX_1, record)
assert(rc == recordLength), "Error: BtrieveFile::RecordRetrieveLast():%d:%s.\n" % (rc, btrievePython.Btrieve_StatusCodeToString(btrieveFile.GetLastStatusCode()))
Cursor

The cursor is established.
Current Offset
The current offset is destroyed.
Return values
>= 0The number of bytes read. The number of bytes read is limited to Btrieve::MAXIMUM_RECORD_LENGTH. See BtrieveFile::RecordRetrieveChunk for retrieving records greater than Btrieve::MAXIMUM_RECORD_LENGTH in length. If the record size requested is less than the length of the current record then BtrieveFile::GetLastStatusCode will return Btrieve::STATUS_CODE_DATALENGTH_ERROR.
-1An error has occurred. Use BtrieveFile::GetLastStatusCode to determine the Btrieve::StatusCode associated with any error.
Examples
Test_BTRV2.cpp, and bpercentage.cpp.

◆ RecordRetrieveNext() [1/2]

int BtrieveFile::RecordRetrieveNext ( char * key,
int keySize,
char * record,
int recordSize,
Btrieve::LockMode lockMode = Btrieve::LOCK_MODE_NONE )

Retrieve the next record.

Note
This method doesn't return a Btrieve::StatusCode. See below for more information.
Parameters
[out]keyThe key.
[in]keySizeThe key size.
[out]recordThe record.
[in]recordSizeThe record size.
[in]lockModeThe lock mode.
Cursor

The cursor must be established. The cursor is traversed forward one record.
Current Offset
The current offset is destroyed.
Return values
>= 0The number of bytes read. The number of bytes read is limited to Btrieve::MAXIMUM_RECORD_LENGTH. See BtrieveFile::RecordRetrieveChunk for retrieving records greater than Btrieve::MAXIMUM_RECORD_LENGTH in length. If the record size requested is less than the length of the current record then BtrieveFile::GetLastStatusCode will return Btrieve::STATUS_CODE_DATALENGTH_ERROR.
-1An error has occurred. Use BtrieveFile::GetLastStatusCode to determine the Btrieve::StatusCode associated with any error.

◆ RecordRetrieveNext() [2/2]

int BtrieveFile::RecordRetrieveNext ( char * record,
int recordSize,
Btrieve::LockMode lockMode = Btrieve::LOCK_MODE_NONE )

Retrieve the next record.

Note
This method doesn't return a Btrieve::StatusCode. See below for more information.
Parameters
[out]recordThe record.
[in]recordSizeThe record size.
[in]lockModeThe lock mode.
Snippet
C++ bindexattributes.cpp
// If RecordRetrieveNext() fails.
if (btrieveFile->RecordRetrieveNext((char *)&record, sizeof(record)) != sizeof(record))
{
status = btrieveFile->GetLastStatusCode();
printf("Error: BtrieveFile::RecordRetrieveNext():%d:%s.\n", status, Btrieve::StatusCodeToString(status));
goto leave;
}
}
Python bindexattributes.py
rc = btrieveFile.RecordRetrieveNext(record)
assert(rc == recordLength), "Error: BtrieveFile::RecordRetrieveNext():%d:%s.\n" % (rc, btrievePython.Btrieve_StatusCodeToString(btrieveFile.GetLastStatusCode()))
Cursor

The cursor must be established. The cursor is traversed forward one record.
Current Offset
The current offset is destroyed.
Return values
>= 0The number of bytes read. The number of bytes read is limited to Btrieve::MAXIMUM_RECORD_LENGTH. See BtrieveFile::RecordRetrieveChunk for retrieving records greater than Btrieve::MAXIMUM_RECORD_LENGTH in length. If the record size requested is less than the length of the current record then BtrieveFile::GetLastStatusCode will return Btrieve::STATUS_CODE_DATALENGTH_ERROR.
-1An error has occurred. Use BtrieveFile::GetLastStatusCode to determine the Btrieve::StatusCode associated with any error.
Examples
bindexattributes.cpp.

◆ RecordRetrievePrevious() [1/2]

int BtrieveFile::RecordRetrievePrevious ( char * key,
int keySize,
char * record,
int recordSize,
Btrieve::LockMode lockMode = Btrieve::LOCK_MODE_NONE )

Retrieve the previous record.

Note
This method doesn't return a Btrieve::StatusCode. See below for more information.
Parameters
[out]keyThe key.
[in]keySizeThe key size.
[out]recordThe record.
[in]recordSizeThe record size.
[in]lockModeThe lock mode.
Cursor

The cursor must be established. The cursor is traversed backward one record.
Current Offset
The current offset is destroyed.
Return values
>= 0The number of bytes read. The number of bytes read is limited to Btrieve::MAXIMUM_RECORD_LENGTH. See BtrieveFile::RecordRetrieveChunk for retrieving records greater than Btrieve::MAXIMUM_RECORD_LENGTH in length. If the record size requested is less than the length of the current record then BtrieveFile::GetLastStatusCode will return Btrieve::STATUS_CODE_DATALENGTH_ERROR.
-1An error has occurred. Use BtrieveFile::GetLastStatusCode to determine the Btrieve::StatusCode associated with any error.

◆ RecordRetrievePrevious() [2/2]

int BtrieveFile::RecordRetrievePrevious ( char * record,
int recordSize,
Btrieve::LockMode lockMode = Btrieve::LOCK_MODE_NONE )

Retrieve the previous record.

Note
This method doesn't return a Btrieve::StatusCode. See below for more information.
Parameters
[out]recordThe record.
[in]recordSizeThe record size.
[in]lockModeThe lock mode.
Cursor

The cursor must be established. The cursor is traversed backward one record.
Current Offset
The current offset is destroyed.
Return values
>= 0The number of bytes read. The number of bytes read is limited to Btrieve::MAXIMUM_RECORD_LENGTH. See BtrieveFile::RecordRetrieveChunk for retrieving records greater than Btrieve::MAXIMUM_RECORD_LENGTH in length. If the record size requested is less than the length of the current record then BtrieveFile::GetLastStatusCode will return Btrieve::STATUS_CODE_DATALENGTH_ERROR.
-1An error has occurred. Use BtrieveFile::GetLastStatusCode to determine the Btrieve::StatusCode associated with any error.

◆ RecordTruncate() [1/2]

Btrieve::StatusCode BtrieveFile::RecordTruncate ( )

Truncate a record at the current offset.

Cursor

The cursor is unaffected but must be established.
Current Offset
The current offset must be established and remains unchanged.
Return values
= Btrieve::STATUS_CODE_NO_ERRORSuccess.
!= Btrieve::STATUS_CODE_NO_ERRORAn error has occurred.

◆ RecordTruncate() [2/2]

Btrieve::StatusCode BtrieveFile::RecordTruncate ( int offset)

Truncate a record.

Parameters
[in]offsetThe offset. If offset is -1, then the current offset is used.
Cursor

The cursor is unaffected but must be established.
Current Offset
The current offset is established at the end of the record.
Return values
= Btrieve::STATUS_CODE_NO_ERRORSuccess.
!= Btrieve::STATUS_CODE_NO_ERRORAn error has occurred.

◆ RecordUnlock()

Btrieve::StatusCode BtrieveFile::RecordUnlock ( Btrieve::UnlockMode unlockMode)

Unlock a record or records.

Parameters
[in]unlockModeThe unlock mode.
Snippet
C++ block.cpp
// If RecordUnlock() fails.
{
printf("Error: BtrieveFile::RecordUnlock():%d:%s.\n", status, Btrieve::StatusCodeToString(status));
goto leave;
}
Python block.py
rc = btrieveFile.RecordUnlock(btrievePython.Btrieve.UNLOCK_MODE_SINGLE)
assert(rc == btrievePython.Btrieve.STATUS_CODE_NO_ERROR), "Error: BtrieveFile::RecordUnlock():%d:%s.\n" % (rc, btrievePython.Btrieve_StatusCodeToString(rc))
Cursor

The cursor is unaffected.
Current Offset
The current offset is unaffected.
Return values
= Btrieve::STATUS_CODE_NO_ERRORSuccess.
!= Btrieve::STATUS_CODE_NO_ERRORAn error has occurred.
See also
Btrieve::StatusCodeToString
Examples
block.cpp.

◆ RecordUpdate()

Btrieve::StatusCode BtrieveFile::RecordUpdate ( const char * record,
int recordLength )

Update a record.

Parameters
[in]recordThe record.
[in]recordLengthThe record length. Record length is limited to Btrieve::MAXIMUM_RECORD_LENGTH bytes. See BtrieveFile::RecordUpdateChunk for updating records greater than Btrieve::MAXIMUM_RECORD_LENGTH in length.
Snippet
C++ block.cpp
status = btrieveFile.RecordUpdate((char *)&record, sizeof(record));
Python block.py
rc = btrieveFile.RecordUpdate(record)
Cursor

The cursor is unaffected but must be established.
Current Offset
The current offset is unaffected.
Return values
= Btrieve::STATUS_CODE_NO_ERRORSuccess.
!= Btrieve::STATUS_CODE_NO_ERRORAn error has occurred.
See also
Btrieve::StatusCodeToString
Examples
block.cpp.

◆ RecordUpdateChunk() [1/2]

Btrieve::StatusCode BtrieveFile::RecordUpdateChunk ( const char * chunk,
int chunkLength )

Update a record chunk at the current offset.

Parameters
[in]chunkThe chunk.
[in]chunkLengthThe chunk length.
Snippet
C++ btestchunk.cpp
// If RecordUpdateChunk() fails.
if ((status = btrieveFile->RecordUpdateChunk((char *)&chunk, sizeof(chunk))) != Btrieve::STATUS_CODE_NO_ERROR)
{
printf("Error: BtrieveFile::RecordUpdateChunk():%d:%s.\n", status, Btrieve::StatusCodeToString(status));
goto leave;
}
Python btestchunk.py
rc = btrieveFile.RecordUpdateChunk(chunk)
assert(rc == btrievePython.Btrieve.STATUS_CODE_NO_ERROR), "Error: BtrieveFile::RecordUpdateChunk():%d:%s.\n" % (rc, btrievePython.Btrieve_StatusCodeToString(rc))
Cursor

The cursor is unaffected but must be established.
Current Offset
The current offset must be established and is then traversed forward to the end of the updated chunk.
Return values
= Btrieve::STATUS_CODE_NO_ERRORSuccess.
!= Btrieve::STATUS_CODE_NO_ERRORAn error has occurred.

◆ RecordUpdateChunk() [2/2]

Btrieve::StatusCode BtrieveFile::RecordUpdateChunk ( int offset,
const char * chunk,
int chunkLength )

Update a record chunk.

Parameters
[in]offsetThe offset. If offset is -1, then the current offset is used.
[in]chunkThe chunk.
[in]chunkLengthThe chunk length.
Snippet
C++ btestchunk.cpp
// If RecordUpdateChunk() fails.
if ((status = btrieveFile->RecordUpdateChunk(0, (char *)&chunk, sizeof(chunk))) != Btrieve::STATUS_CODE_NO_ERROR)
{
printf("Error: BtrieveFile::RecordUpdateChunk():%d:%s.\n", status, Btrieve::StatusCodeToString(status));
goto leave;
}
Python btestchunk.py
rc = btrieveFile.RecordUpdateChunk(0, chunk)
assert(rc == btrievePython.Btrieve.STATUS_CODE_NO_ERROR), "Error: BtrieveFile::RecordUpdateChunk():%d:%s.\n" % (rc, btrievePython.Btrieve_StatusCodeToString(rc))
Cursor

The cursor is unaffected but must be established.
Current Offset
The current offset is established at the end of the updated chunk.
Return values
= Btrieve::STATUS_CODE_NO_ERRORSuccess.
!= Btrieve::STATUS_CODE_NO_ERRORAn error has occurred.
Examples
btestchunk.cpp.

◆ SetOwner()

Btrieve::StatusCode BtrieveFile::SetOwner ( Btrieve::OwnerMode ownerMode,
const char * ownerName = NULL,
const char * ownerNameAgain = NULL,
bool useLongOwnerName = true )

Set the owner.

Parameters
[in]ownerModeThe owner mode.
[in]ownerNameThe owner name.
[in]ownerNameAgainThe owner name (again).
[in]useLongOwnerNameUse a long owner name?
Description
Owner mode defaults to Btrieve::OWNER_MODE_NONE.
Cursor

The cursor is unaffected.
Current Offset
The current offset is unaffected.
Return values
= Btrieve::STATUS_CODE_NO_ERRORSuccess.
!= Btrieve::STATUS_CODE_NO_ERRORAn error has occurred.
See also
Btrieve::StatusCodeToString

◆ UnlockCursorPosition()

Btrieve::StatusCode BtrieveFile::UnlockCursorPosition ( long long cursorPosition)

Unlock the cursor position.

Note
The signature for this method changed in PSQL v13 R2.
Parameters
[in]cursorPositionThe cursor position.
Cursor

The cursor is unaffected.
Current Offset
The current offset is unaffected.
Return values
= Btrieve::STATUS_CODE_NO_ERRORSuccess.
!= Btrieve::STATUS_CODE_NO_ERRORAn error has occurred.
See also
Btrieve::StatusCodeToString