Previous Topic

Next Topic

DeleteKeyBlind

Delete key value when associated data record position is not known.

Short Name

DELBLD()

Type

Low level index file function

Declaration

LONG DeleteKeyBlind(COUNT keyno, pVOID target)

Description

DeleteKeyBlind() deletes the key value pointed to by target from index file keyno, if such a key value exists. DeleteKeyBlind() cannot be used when the index file supports duplicate keys.

Return

If the key value is found in the index, it is deleted and DeleteKeyBlind() returns the associated data record position. If it is not found, or some error is detected, DeleteKeyBlind() returns a zero (which is never a legal data record position), and uerr_cod is set as follows:

Value

Symbolic Constant

Explanation

0

NO_ERROR

Successful deletion.

4

KDEL_ERR

Cannot find key value to delete.

5

KBLD_ERR

Cannot call DeleteKeyBlind() when duplicate keys are supported.

See c-tree Plus Error Codes for a complete listing of valid c-tree Plus error values.

Example

LONG         recbyt;
COUNT        keyno;
TEXT         target[24];

keyno = 1;

printf("\nEnter key value: ");
scanf("%23s",target);
if (recbyt = DeleteKeyBlind(keyno,target))
    printf("\n%s deleted (data record position = %ld).", target,recbyt);
else
    printf("\nUnsuccessful deletion (code = %d).",uerr_cod);

Limitations

Cannot be used with an index supporting duplicate key values. Without knowledge of the associated data record position, there is no way to distinguish among identical key values.

See also

DeleteKey()