Was this helpful?
The Structure of db_data
The db_data field in the II_DATA VALUE structure is a pointer to the data. The exact structure of db_data will vary according to the data type. For standard SQL data types it will be the equivalent C data structure (see the Embedded SQL Companion Guide).
The decimal data type (db_datatype II_DECIIMAL) structure is described in Internal Structure of a Decimal Value.
Internal Structure of a Decimal Value
A DECIMAL of precision 'P' is an array of unsigned chars of size (1+INT(Precision/2)) where the last nibble is the sign and preceding nibbles are the digits of the number (0x0-0x9) including leading zeros.
The size of the array is defined for the declared size of the variable, not the size actually used (leading and trailing zeros are stored). If there is an even number of digits, the first nibble in the array is unused.
The position of the decimal point cannot be determined from the DECIMAL data itself; it is specified in the metadata ('scale').
The Sign nibble uses values 0xa, 0xc, 0xe, and 0xf for positive numbers (0xc being preferred) and 0xb and 0xd for negative numbers (0xd being preferred).
Here is a sample array:
Last modified date: 01/30/2023