Allows an application to obtain the distribution information for a table. The distribution information includes the distribution map and the column definitions of the distribution key.
Information returned by this API can be passed to the db2GetRowPartNum API to determine the database partition number and the database partition server number for any row in the table.
To use this API, the application must be connected to the database that contains the table for which distribution information is being requested.
This API can be executed on any database partition server defined in the db2nodes.cfg file.
Database
db2ApiDf.h
db2GetDistMap (
sqluint32 db2VersionNumber, /* Database version number */
void * pParmStruct, /* In/out parameters */
struct sqlca * pSqlca); /* SQLCA */
where
SQL_STRUCTURE db2DistMapStruct
{
unsigned char *tname; /* Fully qualified table */
/* name */
struct db2PartitioningInfo *partinfo; /* Partitioning */
/* Information */
};
SQL_STRUCTURE db2PartitioningInfo
{
sqluint32 pmaplen; /* Length of partitioning */
/* map */
SQL_PDB_NODE_TYPE *pmap; /* Partitioning map */
unsigned short sqld; /* # of used */
/* db2PartitioningKey */
/* elements */
struct db2PartitioningKey sqlpartkey[SQL_MAX_NUM_PART_KEYS]; /* */
/* KEYS */
};
SQL_STRUCTURE db2PartitioningKey
{
unsigned short sqltype; /* Date Type of Key */
unsigned short sqllen; /* Data Length of Key */
};
The pmap in db2PartitioningInfo structure must point to an array of SQL_PDB_MAP_SIZE_32K entries.