tibasKeyDef_Create()

Creates a primary key and specifies the fields for the key.

Declaration

tibas_status tibasKeyDef_Create(
    tibasKeyDef* keyDef,
    char*        fieldNames)

Parameters

Parameter Description
keyDef Specifies the name of the key definition for the primary key that you are creating.
fieldNames A comma-separated list that specifies the field names to be used as the primary key.

Remarks

Use the tibasKeyDef_Create() function to create a primary key and specify the fields for the key..

The fieldnames parameter specifies a comma separated list of field names to be used as the primary key.

To activate the key definition:

  • If you do not already have a spaceDef object to which to assign the key definition, use the tibasSpaceDef_Create() function to a spaceDef object.
  • Call the tibasSpaceDef_SetKeyDef() function to assign the KeyDef to a specified SpaceDef so that it can be used as the primary key for searches within the space.
    Note: When you call tibasKeyDef() to create a key, the default index type is TIBAS_INDEX_HASH. You can change the index type by calling the tibasKeyDef_SetIndexType() function.

Note also that if you need to change the primary key, you must free the space by calling the tibasSpace_Free() function and then reconnect to the space using the new key definition.