dam_add_damobj_fkey
- Last Updated: May 12, 2026
- 5 minute read
- OpenAccess SDK
- Version 9.0
- Documentation
This function is used to return schema information about primary and foreign keys. Add an fkey schema object with the specified values to the list of objects returned to the OpenAccess SDK SQL engine. Use the Unicode versions when using this function from OAIP_schemaW or OAIP_schemaExW.
All values should be set. Set Null values as follows:
- For char *, set the pointer to NULL.
- For integer, set the value to DAMOBJ_NOTSET.
Refer to Schema Definition and Management in the OpenAccess SDK Programmer's Guide for information about each of the values to set.
int dam_add_damobj_fkey(
XM_Tree * pMemTree,
DAM_OBJ_LIST pList,
DAM_OBJ pSearchObj,
char * pktable_qualifier,
char pktable_owner,
char * pktable_name,
char * pkcolumn_name,
char * fktable_qualifier,
char * fktable_owner,
char * fktable_name,
char * fkcolumn_name,
short key_seq,
short update_rule,
short delete_rule,
char * fk_name,
char * pk_name)
Parameters for dam_add_damobj_fkey
| Parameter | Type | Description |
| IN | ||
| pMemTree | XM_Tree * | The memory tree on which to allocate memory for the new object. |
| pList | DAM_OBJ_LIST | The list on which the objects are to be added. It is passed in the call to the IP. The IP can pass the pSearchObj filter to have the OpenAccess SDK SQL engine filter the objects before adding to the list. |
| pSearchObj | DAM_OBJ | The object to use for filtering the objects added to the list. If you have taken care of only adding the object that are requested, then set this to NULL. If you want the OpenAccess SDK SQL engine to do the filtering, then pass in the same value as passed into your IP. |
| pktable_qualifier | char * | The name of the database in which the primary key table falls. Can be used to distribute tables into physically different databases. You would normally specify SCHEMA. If you want to expose this field as an empty value, then return a 0 when OAIP_getInfo(SQL_MAX_QUALIFIER_NAME) is called and set this field value to NULL. |
| pktable_owner | char * | The owner of the primary key table. You would set it to system or user. SYSTEM - the table is managed by the OpenAccess SDK SQL engine. OAUSER - the table is managed by the IP. The value for this parameter and OA_COLUMNS must match. If you want to expose this field as an empty value, then SQL_MAX_OWNER_NAME entry in the gColArray_info array (found in the xxx_info.c file added to the IP project) should be changed from 128 to 0, and you should specify NULL for this field in the schema definition. |
| pktable_name | char * | The name of the primary key table. This is how the end user refers to it. |
| pkcolumn_name | char * | The name of the primary key column. |
| fktable_qualifier | char * | The name of the database in which the foreign key table falls. Can be used to distribute tables into physically different databases. You would normally specify SCHEMA. If you want to expose this field as an empty value, then SQL_MAX_QUALIFIER_NAME entry in the gColArray_info array (found in found in the oacs_info.c and oacs_info.h files in the C memory sample project) should be changed from 128 to 0 and you should specify NULL for this field in the schema definition. |
| fktable_owner | char * | The owner of the foreign key table. You would normally set it to system or user. SYSTEM - the table is managed by the OpenAccess SDK SQL engine. OAUSER - the table is managed by the IP. The value for this parameter and OA_COLUMNS must match. If you want to expose this field as an empty value, then SQL_MAX_OWNER_NAME entry in the gColArray_info array (found in the xxx_info.c file added to the IP project) should be changed from 128 to 0, and you should specify NULL for this field in the schema definition. |
| fktable_name | char * | The name of the foreign key table. This is how the end user refers to it. |
| fkcolumn_name | char * | The name of the foreign key column. |
| key_seq | short | The column sequence number in key, starting with 1. |
| delete_rule | short | Not used. Set to null. |
| fk_name | char * | The foreign key identifier. |
| pk_name | char * | The primary key identifier. |
| RETURN | ||
| int | Function call status: DAM_SUCCESS - values set. DAM_FAILURE - values not set. One of the values was null when it cannot be. |
int dam_add_damobj_fkeyW(
XM_Tree * pMemTree,
DAM_OBJ_LIST pList,
DAM_OBJ pSearchObj,
OAWCHAR * pktable_qualifier,
OAWCHAR * pktable_owner,
OAWCHAR * pktable_name,
OAWCHAR * pkcolumn_name,
OAWCHAR * fktable_qualifier,
OAWCHAR * fktable_owner,
OAWCHAR * fktable_name,
OAWCHAR * fkcolumn_name,
short key_seq,
short update_rule,
short delete_rule,
OAWCHAR * fk_name,
OAWCHAR * pk_name)
Parameters for dam_add_damobj_fkeyW
| Parameter | Type | Description |
| IN | ||
| pMemTree | XM_Tree * | The memory tree on which to allocate memory for the new object. |
| pList | DAM_OBJ_LIST | The list on which the objects are to be added. It is passed in the call to the IP. The IP can pass the pSearchObj filter to have the OpenAccess SDK SQL engine filter the objects before adding to the list. |
| pSearchObj | DAM_OBJ | The object to use for filtering the objects added to the list. If you have taken care of only adding the object that are requested, then set this to NULL. If you want the OpenAccess SDK SQL engine to do the filtering, then pass in the same value as passed into your IP. |
| pktable_qualifier | OAWCHAR * | The name of the database in which the primary key table resides. Can be used to distribute tables into physically different databases. You would normally specify SCHEMA. If you want to expose this field as an empty value then change SQL_MAX_QUALIFIER_NAME entry in the gColArray_info array (found in found in the oacs_info.c and oacs_info.h files in the C memory sample project) from 128 to 0 and specify NULL for this field in the schema definition. |
| pktable_owner | OAWCHAR * | The owner of the primary key table. You would normally set it to system or user. SYSTEM - the table is managed by the OpenAccess SDK SQL engine. OAUSER - the table is managed by the IP. The value for this parameter and in OA_COLUMNS must match. If you want to expose this field as an empty value, then return a 0 when OAIP_getInfo(SQL_MAX_OWNER_NAME) is called and set this field value to NULL. |
| pktable_name | OAWCHAR * | The name of the primary key table. This is how the end user refers to it. |
| pkcolumn_name | OAWCHAR * | The name of the primary key column. |
| fktable_qualifier | OAWCHAR * | The name of the database in which the table exists. |
| fktable_owner | OAWCHAR * | The owner of the foreign key table. You would normally set it to system or user. SYSTEM - the table is managed by the OpenAccess SDK SQL engine. OAUSER - the table is managed by the IP. In future releases, this entry will be used to control access rights to the table and will represent the actual user who owns the table. The entry in here and in the OA_COLUMNS must match. If you want to expose this field as an empty value, then SQL_MAX_OWNER_NAME entry in the gColArray_info array (found in the oacs_info.c and oacs_info.h files in the C memory sample project) should be changed from 128 to 0. Specify NULL for this field in the schema definition. |
| fktable_name | OAWCHAR * | The name of the foreign key table. This is how the end user refers to it. |
| fkcolumn_name | OAWCHAR * | The name of the foreign key column. |
| key_seq | short | The column sequence number in key, starting with 1. |
| update_rule | short | Not used. Set to null. |
| delete_rule | short | Not used. Set to null. |
| fk_name | OAWCHAR * | The foreign key identifier. |
| pk_name | OAWCHAR * | The primary key identifier. |
| RETURN | ||
| int | Function call status:DAM_SUCCESS - values set DAM_FAILURE - values not set. One of the values was null when it cannot be. |