hashprep Routine--Prepare Value for Hash Key
This routine prepares a data value for becoming a hash key. Place the address of this routine in the dtd_hashprep_addr field of the IIADD_DT_DFN structure. If the II_DT_NOKEY attribute is present, then this routine is not necessary.
For most data types, hash key preparation is a simple copy operation, copying the input data to the output. However, some data types may require more processing. For example, character data types may require blank removal or case translation.
The DBMS Server hash algorithm treats the hash key as a simple byte stream. It does not make allowances for the special characteristics of a data type. You must normalize any variable-length data types within this routine. Unused space must be initialized to some known value. For example, character strings are typically padded with blanks. You must also ensure that there are no compiler-generated holes in your data type. Holes can occur when a compiler pads a structure definition for alignment.
This routine must transform any two values of a data type that compare as equal (using the compare routine) into identical byte streams.
Inputs
The inputs for this function are:
scb
Pointer to a SCB
dv_from
Pointer to an II_DATA_VALUE for value to be keyed upon.
dv_key
Pointer to an II_DATA_VALUE that contains the key.
Outputs
The outputs for this function are:
*dv_key
db_length
The length of the key
db_data
The key value
Returns
II_STATUS
Last modified date: 08/28/2024