DB2 Version 9.7 for Linux, UNIX, and Windows

sqlupi data structure

This structure is used to store partitioning information, such as the distribution map and the distribution key of a table.
Table 1. Fields in the SQLUPI Structure
Field Name Data Type Description
PMAPLEN INTEGER The length of the distribution map in bytes. For a single-node table, the value is sizeof(SQL_PDB_NODE_TYPE). For a multi-node table, the value is SQL_PDB_MAP_SIZE * sizeof(SQL_PDB_NODE_TYPE).
PMAP SQL_PDB_NODE_TYPE The distribution map.
SQLD INTEGER The number of used SQLPARTKEY elements; that is, the number of key parts in a distribution key.
SQLPARTKEY Structure The description of a distribution column in a distribution key. The maximum number of distribution columns is SQL_MAX_NUM_PART_KEYS.
The following table shows the SQL data types and lengths for the SQLUPI data structure. The SQLTYPE column specifies the numeric value that represents the data type of an item.
Table 2. SQL Data Types and Lengths for the SQLUPI Structure
Data type SQLTYPE (Nulls Not Allowed) SQLTYPE (Nulls Allowed) SQLLEN AIX®
Date 384 385 Ignored Yes
Time 388 389 Ignored Yes
Timestamp 392 393 Ignored Yes
Variable-length character string 448 449 Length of the string Yes
Fixed-length character string 452 453 Length of the string Yes
Long character string 456 457 Ignored No
Null-terminated character string 460 461 Length of the string Yes
Floating point 480 481 Ignored Yes
Decimal 484 485 Byte 1 = precision Byte 2 = scale Yes
Large integer 496 497 Ignored Yes
Small integer 500 501 Ignored Yes
Variable-length graphic string 464 465 Length in double- byte characters Yes
Fixed-length graphic string 468 469 Length in double- byte characters Yes
Long graphic string 472 473 Ignored No
sqlpartkey data structure parameter descriptions
sqltype
Input. Data type of the distribution key.
sqllen
Input. Data length of the distribution key.

API and data structure syntax

SQL_STRUCTURE sqlupi
{
   unsigned short  pmaplen;
   SQL_PDB_NODE_TYPE pmap[SQL_PDB_MAP_SIZE];
   unsigned short  sqld;
   struct sqlpartkey sqlpartkey[SQL_MAX_NUM_PART_KEYS];
};

SQL_STRUCTURE sqlpartkey
{
   unsigned short  sqltype;
   unsigned short  sqllen;
};