Returns the partition number and the node number based on the partitioning key values. An application can use this information to determine at which node a specific row of a table is stored.
The partitioning data structure, SQLUPI, is the input for this API. The structure can be returned by sqlugtpi - Get Table Partitioning Information. Another input is the character representations of the corresponding partitioning key values. The output is a partition number generated by the partitioning strategy and the corresponding node number from the partitioning map. If the partitioning map information is not provided, only the partition number is returned. This can be useful when analyzing data distribution.
The database manager does not need to be running when this API is called.
Scope
This API can be invoked from any node in the db2nodes.cfg file.
Authorization
None
Version
sqlutil.h
C API Syntax
/* File: sqlutil.h */ /* API: Get Row Partitioning Number */ /* ... */ SQL_API_RC SQL_API_FN sqlugrpn ( unsigned short num_ptrs, unsigned char ** ptr_array, unsigned short * ptr_lens, unsigned short ctrycode, unsigned short codepage, struct sqlupi * part_info, short * part_num, SQL_PDB_NODE_TYPE * node_num, unsigned short chklvl, struct sqlca * sqlca, short dataformat, void * pReserved1, void * pReserved2); /* ... */ |
Generic API Syntax
/* File: sqlutil.h */ /* API: Get Row Partitioning Number */ /* ... */ SQL_API_RC SQL_API_FN sqlggrpn ( unsigned short num_ptrs, unsigned char ** ptr_array, unsigned short * ptr_lens, unsigned short ctrycode, unsigned short codepage, struct sqlupi * part_info, short * part_num, SQL_PDB_NODE_TYPE * node_num, unsigned short chklvl, struct sqlca * sqlca, short dataformat, void * pReserved1, void * pReserved2); /* ... */ |
API Parameters
This value can also be obtained from the database configuration file (see the GET DATABASE CONFIGURATION command in the Command Reference.
This value can also be obtained from the database configuration file (see the GET DATABASE CONFIGURATION command in the Command Reference.
Usage Notes
Data types supported on the operating system are the same as those that can be defined as a partitioning key.
CHAR, VARCHAR, GRAPHIC, and VARGRAPHIC must be converted to the target code page before this API is called.
For numeric and datetime data types, the character representations must be at the code page of the respective system where the API is invoked.
If node_num is not NULL, the partitioning map must be supplied; that is, part_info->pmaplen is either 2 or 8 192. Otherwise, SQLCODE -6038 is returned.
The partitioning key must be defined; that is, part_info->sqld must be greater than zero. Otherwise, SQLCODE -2032 is returned.
If a null value is assigned to a non-nullable partitioning column, SQLCODE -6039 is returned.
All the leading blanks and trailing blanks of the input character string are stripped, except for the CHAR, VARCHAR, GRAPHIC, and VARGRAPHIC data types, where only trailing blanks are stripped.
See Also
sqlfxdb - Get Database Configuration
sqlugtpi - Get Table Partitioning Information
sqludrdt - Redistribute Nodegroup.