Public Member Functions | List of all members
BtrieveKeySegment Class Reference

The Btrieve key segment class. More...

#include <btrieveCpp.h>

Public Member Functions

 BtrieveKeySegment ()
 
 ~BtrieveKeySegment ()
 
Btrieve::ACSMode GetACSMode ()
 Get the alternate collation sequence mode. More...
 
int GetACSNumber ()
 Get the alternate collation sequence number. More...
 
Btrieve::DataType GetDataType ()
 Get the data type. More...
 
int GetDescendingSortOrder ()
 Get string. More...
 
Btrieve::DuplicateMode GetDuplicateMode ()
 Get the duplicate mode. More...
 
Btrieve::Index GetIndex ()
 Get the index. More...
 
int GetKeyContinues ()
 Get key continues. More...
 
Btrieve::StatusCode GetLastStatusCode ()
 Get the last status code. More...
 
int GetLength ()
 Get the length. More...
 
int GetModifiable ()
 Get modifiable. More...
 
Btrieve::NullKeyMode GetNullKeyMode ()
 Get the null key mode. More...
 
int GetNullValue ()
 Get the null value. More...
 
int GetOffset ()
 Get the offset. More...
 
long long GetUniqueValueCount ()
 Get the unique value count. More...
 
Btrieve::StatusCode SetDescendingSortOrder (bool setDescendingSortOrder)
 Set descending sort order. More...
 
Btrieve::StatusCode SetField (int offset, int length, Btrieve::DataType dataType)
 Set the field. More...
 
Btrieve::StatusCode SetNullKeyMode (Btrieve::NullKeyMode nullKeyMode)
 Set the null key mode. More...
 
Btrieve::StatusCode SetNullValue (int nullValue)
 Set the null value. More...
 

Detailed Description

The Btrieve key segment class.

Examples:
bfileinformation.cpp, bfilter.cpp, bindexattributes.cpp, bkeyonly.cpp, block.cpp, bpercentage.cpp, btest.cpp, and btestvlr.cpp.

Constructor & Destructor Documentation

◆ BtrieveKeySegment()

BtrieveKeySegment::BtrieveKeySegment ( )
Snippet
BtrieveKeySegment btrieveKeySegment;

◆ ~BtrieveKeySegment()

BtrieveKeySegment::~BtrieveKeySegment ( )

Member Function Documentation

◆ GetACSMode()

Btrieve::ACSMode BtrieveKeySegment::GetACSMode ( )

Get the alternate collation sequence mode.

Snippet
// If GetACSMode() fails.
if ((btrieveACSMode = btrieveKeySegment.GetACSMode()) == Btrieve::ACS_MODE_UNKNOWN)
{
status = btrieveKeySegment.GetLastStatusCode();
printf("Error: BtrieveKeySegment::GetACSMode():%d:%s.\n", status, Btrieve::StatusCodeToString(status));
goto leave;
}
printf("\tACSMode = %s\n", Btrieve::ACSModeToString(btrieveACSMode));
Return values
!= Btrieve::ACS_MODE_UNKNOWNThe alternate collation sequence mode.
= Btrieve::ACS_MODE_UNKNOWNAn error has occurred. Use BtrieveKeySegment::GetLastStatusCode to determine the Btrieve::StatusCode associated with any error.
See also
Btrieve::ACSModeToString
Examples:
bfileinformation.cpp.

◆ GetACSNumber()

int BtrieveKeySegment::GetACSNumber ( )

Get the alternate collation sequence number.

Snippet
// If GetACSNumber() fails.
if ((i = btrieveKeySegment.GetACSNumber()) < 0)
{
status = btrieveKeySegment.GetLastStatusCode();
printf("Error: BtrieveKeySegment::GetACSNumber():%d:%s.\n", status, Btrieve::StatusCodeToString(status));
goto leave;
}
printf("\tACSNumber = %d\n", i);
Return values
>= 0The alternate collation sequence number.
-1An error has occurred. Use BtrieveKeySegment::GetLastStatusCode to determine the Btrieve::StatusCode associated with any error.
Examples:
bfileinformation.cpp.

◆ GetDataType()

Btrieve::DataType BtrieveKeySegment::GetDataType ( )

Get the data type.

Snippet
// If GetDataType() fails.
if ((btrieveDataType = btrieveKeySegment.GetDataType()) == Btrieve::DATA_TYPE_UNKNOWN)
{
status = btrieveKeySegment.GetLastStatusCode();
printf("Error: BtrieveKeySegment::GetDataType():%d:%s.\n", status, Btrieve::StatusCodeToString(status));
goto leave;
}
printf("\tDataType = %s\n", Btrieve::DataTypeToString(btrieveDataType));
Return values
!= Btrieve::DATA_TYPE_UNKNOWNThe data type.
= Btrieve::DATA_TYPE_UNKNOWNAn error has occurred. Use BtrieveKeySegment::GetLastStatusCode to determine the Btrieve::StatusCode associated with any error.
See also
Btrieve::DataTypeToString
Examples:
bfileinformation.cpp.

◆ GetDescendingSortOrder()

int BtrieveKeySegment::GetDescendingSortOrder ( )

Get string.

Snippet
// If GetDescendingSortOrder() fails.
if ((i = btrieveKeySegment.GetDescendingSortOrder()) < 0)
{
status = btrieveKeySegment.GetLastStatusCode();
printf("Error: BtrieveKeySegment::GetDescendingSortOrder():%d:%s.\n", status, Btrieve::StatusCodeToString(status));
goto leave;
}
printf("\tDescendingSortOrder = %s\n", i > 0 ? "Yes" : "No");
Return values
> 0Descending sort order is set.
0Descending sort order isn't set.
-1An error has occurred. Use BtrieveKeySegment::GetLastStatusCode to determine the Btrieve::StatusCode associated with any error.
Examples:
bfileinformation.cpp.

◆ GetDuplicateMode()

Btrieve::DuplicateMode BtrieveKeySegment::GetDuplicateMode ( )

Get the duplicate mode.

Snippet
// If GetDuplicateMode() fails.
if ((btrieveDuplicateMode = btrieveKeySegment.GetDuplicateMode()) == Btrieve::DUPLICATE_MODE_UNKNOWN)
{
status = btrieveKeySegment.GetLastStatusCode();
printf("Error: BtrieveKeySegment::GetDuplicateMode():%d:%s.\n", status, Btrieve::StatusCodeToString(status));
goto leave;
}
printf("\tDuplicateMode = %s\n", Btrieve::DuplicateModeToString(btrieveDuplicateMode));
Return values
!= Btrieve::DUPLICATE_MODE_UNKNOWNThe duplicate mode.
= Btrieve::DUPLICATE_MODE_UNKNOWNAn error has occurred. Use BtrieveKeySegment::GetLastStatusCode to determine the Btrieve::StatusCode associated with any error.
See also
Btrieve::DuplicateModeToString
Examples:
bfileinformation.cpp.

◆ GetIndex()

Btrieve::Index BtrieveKeySegment::GetIndex ( )

Get the index.

Snippet
// If GetIndex() fails.
if ((btrieveIndex = btrieveKeySegment.GetIndex()) == Btrieve::INDEX_UNKNOWN)
{
status = btrieveKeySegment.GetLastStatusCode();
printf("Error: BtrieveKeySegment::GetIndex():%d:%s.\n", status, Btrieve::StatusCodeToString(status));
goto leave;
}
printf("\tIndex = %s\n", Btrieve::IndexToString(btrieveIndex));
Return values
!= Btrieve::INDEX_UNKNOWNThe index.
= Btrieve::INDEX_UNKNOWNAn error has occurred. Use BtrieveKeySegment::GetLastStatusCode to determine the Btrieve::StatusCode associated with any error.
See also
Btrieve::IndexToString
Examples:
bfileinformation.cpp.

◆ GetKeyContinues()

int BtrieveKeySegment::GetKeyContinues ( )

Get key continues.

Snippet
// If GetKeyContinues() fails.
if ((i = btrieveKeySegment.GetKeyContinues()) < 0)
{
status = btrieveKeySegment.GetLastStatusCode();
printf("Error: BtrieveKeySegment::GetKeyContinues():%d:%s.\n", status, Btrieve::StatusCodeToString(status));
goto leave;
}
printf("\tKeyContinues = %s\n", i > 0 ? "Yes" : "No");
Return values
> 0Key continues is set.
0Key continues isn't set.
-1An error has occurred. Use BtrieveKeySegment::GetLastStatusCode to determine the Btrieve::StatusCode associated with any error.
Examples:
bfileinformation.cpp.

◆ GetLastStatusCode()

Btrieve::StatusCode BtrieveKeySegment::GetLastStatusCode ( )

Get the last status code.

Snippet
// If GetACSMode() fails.
if ((btrieveACSMode = btrieveKeySegment.GetACSMode()) == Btrieve::ACS_MODE_UNKNOWN)
{
status = btrieveKeySegment.GetLastStatusCode();
printf("Error: BtrieveKeySegment::GetACSMode():%d:%s.\n", status, Btrieve::StatusCodeToString(status));
goto leave;
}
Return values
= Btrieve::STATUS_CODE_NO_ERRORSuccess.
!= Btrieve::STATUS_CODE_NO_ERRORAn error has occurred.
See also
Btrieve::StatusCodeToString
Examples:
bfileinformation.cpp.

◆ GetLength()

int BtrieveKeySegment::GetLength ( )

Get the length.

Snippet
// If GetLength() fails.
if ((i = btrieveKeySegment.GetLength()) < 0)
{
status = btrieveKeySegment.GetLastStatusCode();
printf("Error: BtrieveKeySegment::GetLength():%d:%s.\n", status, Btrieve::StatusCodeToString(status));
goto leave;
}
printf("\tLength = %d\n", i);
Return values
>= 0The length.
-1An error has occurred. Use BtrieveKeySegment::GetLastStatusCode to determine the Btrieve::StatusCode associated with any error.
Examples:
bfileinformation.cpp.

◆ GetModifiable()

int BtrieveKeySegment::GetModifiable ( )

Get modifiable.

Snippet
// If GetModifiable() fails.
if ((i = btrieveKeySegment.GetModifiable()) < 0)
{
status = btrieveKeySegment.GetLastStatusCode();
printf("Error: BtrieveKeySegment::GetModifiable():%d:%s.\n", status, Btrieve::StatusCodeToString(status));
goto leave;
}
printf("\tModifiable = %s\n", i > 0 ? "Yes" : "No");
Return values
> 0Modifications are allowed.
0Modifications are not allowed.
-1An error has occurred. Use BtrieveKeySegment::GetLastStatusCode to determine the Btrieve::StatusCode associated with any error.
Examples:
bfileinformation.cpp.

◆ GetNullKeyMode()

Btrieve::NullKeyMode BtrieveKeySegment::GetNullKeyMode ( )

Get the null key mode.

Snippet
// If GetNullKeyMode() fails.
if ((btrieveNullKeyMode = btrieveKeySegment.GetNullKeyMode()) == Btrieve::NULL_KEY_MODE_UNKNOWN)
{
status = btrieveKeySegment.GetLastStatusCode();
printf("Error: BtrieveKeySegment::GetNullKeyMode():%d:%s.\n", status, Btrieve::StatusCodeToString(status));
goto leave;
}
printf("\tNullKeyMode = %s\n", Btrieve::NullKeyModeToString(btrieveNullKeyMode));
Return values
!= Btrieve::NULL_KEY_MODE_UNKNOWNThe null key mode.
= Btrieve::NULL_KEY_MODE_UNKNOWNAn error has occurred. Use BtrieveKeySegment::GetLastStatusCode to determine the Btrieve::StatusCode associated with any error.
See also
Btrieve::NullKeyModeToString
Examples:
bfileinformation.cpp.

◆ GetNullValue()

int BtrieveKeySegment::GetNullValue ( )

Get the null value.

Snippet
// If GetNullValue() fails.
if ((i = btrieveKeySegment.GetNullValue()) < 0)
{
status = btrieveKeySegment.GetLastStatusCode();
printf("Error: BtrieveKeySegment::GetNullValue():%d:%s.\n", status, Btrieve::StatusCodeToString(status));
goto leave;
}
printf("\tNullValue = %d\n", i);
Return values
>= 0The null value.
-1An error has occurred. Use BtrieveKeySegment::GetLastStatusCode to determine the Btrieve::StatusCode associated with any error.
Examples:
bfileinformation.cpp.

◆ GetOffset()

int BtrieveKeySegment::GetOffset ( )

Get the offset.

Snippet
// If GetOffset() fails.
if ((i = btrieveKeySegment.GetOffset()) < 0)
{
status = btrieveKeySegment.GetLastStatusCode();
printf("Error: BtrieveKeySegment::GetOffset():%d:%s.\n", status, Btrieve::StatusCodeToString(status));
goto leave;
}
printf("\tOffset = %d\n", i);
Return values
>= 0The offset.
-1An error has occurred. Use BtrieveKeySegment::GetLastStatusCode to determine the Btrieve::StatusCode associated with any error.
Examples:
bfileinformation.cpp.

◆ GetUniqueValueCount()

long long BtrieveKeySegment::GetUniqueValueCount ( )

Get the unique value count.

Note
The signature for this method changed in PSQL 13.20.
Snippet
// If GetUniqueValueCount() fails.
if ((uniqueValueCount = btrieveKeySegment.GetUniqueValueCount()) < 0)
{
status = btrieveKeySegment.GetLastStatusCode();
printf("Error: BtrieveKeySegment::GetUniqueValueCount():%d:%s.\n", status, Btrieve::StatusCodeToString(status));
goto leave;
}
printf("\tUniqueValueCount = %lld\n", uniqueValueCount);
Return values
>= 0The unique value count.
-1An error has occurred. Use BtrieveKeySegment::GetLastStatusCode to determine the Btrieve::StatusCode associated with any error.
Examples:
bfileinformation.cpp.

◆ SetDescendingSortOrder()

Btrieve::StatusCode BtrieveKeySegment::SetDescendingSortOrder ( bool  setDescendingSortOrder)

Set descending sort order.

Parameters
[in]setDescendingSortOrderEnable descending sort order?
Description
Descending sort order is disabled by default.
Snippet
// If SetDescendingSortOrder() fails.
if ((status = btrieveKeySegment.SetDescendingSortOrder(true)) != Btrieve::STATUS_CODE_NO_ERROR)
{
printf("Error: BtrieveKeySegment::SetDescendingSortOrder():%d:%s.\n", status, Btrieve::StatusCodeToString(status));
goto leave;
}
Return values
= Btrieve::STATUS_CODE_NO_ERRORSuccess.
!= Btrieve::STATUS_CODE_NO_ERRORAn error has occurred.
See also
Btrieve::StatusCodeToString
Examples:
bindexattributes.cpp.

◆ SetField()

Btrieve::StatusCode BtrieveKeySegment::SetField ( int  offset,
int  length,
Btrieve::DataType  dataType 
)

Set the field.

Parameters
[in]offsetThe offset. Offset must be less than Btrieve::MAXIMUM_RECORD_LENGTH.
[in]lengthThe length. Length is limited to Btrieve::MAXIMUM_KEY_LENGTH.
[in]dataTypeThe data type.
Description
Key segments have no field initially. Offset plus length is limited to Btrieve::MAXIMUM_RECORD_LENGTH.
Snippet
// If SetField() fails.
{
printf("Error: BtrieveKeySegment::SetField():%d:%s.\n", status, Btrieve::StatusCodeToString(status));
goto leave;
}
Return values
= Btrieve::STATUS_CODE_NO_ERRORSuccess.
!= Btrieve::STATUS_CODE_NO_ERRORAn error has occurred.
See also
Btrieve::StatusCodeToString
Examples:
bfilter.cpp, bindexattributes.cpp, bkeyonly.cpp, block.cpp, bpercentage.cpp, btest.cpp, and btestvlr.cpp.

◆ SetNullKeyMode()

Btrieve::StatusCode BtrieveKeySegment::SetNullKeyMode ( Btrieve::NullKeyMode  nullKeyMode)

Set the null key mode.

Parameters
[in]nullKeyModeThe null key mode.
Description
Null key mode defaults to Btrieve::NULL_KEY_MODE_NONE.
Snippet
// If SetNullKeyMode() fails.
{
printf("Error: BtrieveKeySegment::SetNullKeyMode():%d:%s.\n", status, Btrieve::StatusCodeToString(status));
goto leave;
}
Return values
= Btrieve::STATUS_CODE_NO_ERRORSuccess.
!= Btrieve::STATUS_CODE_NO_ERRORAn error has occurred.
See also
Btrieve::StatusCodeToString
Examples:
bindexattributes.cpp.

◆ SetNullValue()

Btrieve::StatusCode BtrieveKeySegment::SetNullValue ( int  nullValue)

Set the null value.

Parameters
[in]nullValueThe null value.
Description
Null value defaults to zero.
Snippet
// If SetNullValue() fails.
if ((status = btrieveKeySegment.SetNullValue(255)) != Btrieve::STATUS_CODE_NO_ERROR)
{
printf("Error: BtrieveKeySegment::SetNullValue():%d:%s.\n", status, Btrieve::StatusCodeToString(status));
goto leave;
}
Return values
= Btrieve::STATUS_CODE_NO_ERRORSuccess.
!= Btrieve::STATUS_CODE_NO_ERRORAn error has occurred.
See also
Btrieve::StatusCodeToString
Examples:
bindexattributes.cpp.