Purpose:
Use this class to represent a foreign key definition for a component type.
Class summary:
class DKEXPORT DKForeignKeyDefICM { public: DKForeignKeyDefICM(); DKForeignKeyDefICM(dkDatastore* ds); DKForeignKeyDefICM(const DKForeignKeyDefICM& foreignKey); virtual ~DKForeignKeyDefICM(); void setDatastore(dkDatastore* ds); dkDatastore* getDatastore(); void setSourceCompTypeName(const char* srcCompTypeName); DKString getSourceCompTypeName(); void setTargetCompTypeName(const char* tgtCompTypeName); DKString getTargetCompTypeName(); void setTargetTableName(const char* tgtTableName); DKString getTargetTableName(); void setTargetSchemaName(const char* tgtSchemaName); DKString getTargetSchemaName(); void setConstraintName(const char* constraintName); DKString getConstraintName(); void setDeleteRule(short deleteRule); short getDeleteRule(); void setUpdateRule(short updateRule); short getUpdateRule(); void addSrcAndTgtAttrName(const char* srcAttrName, const char* tgtAttrName,long columnSeq); void removeSourceAttrName(const char* srcAttrName); DKString* listSourceAttrNames(long& arraySize); DKString* listTargetAttrNames(long& arraySize); dkCollection* listForeignKeyAttrInfo(); };
Members:
DKForeignKeyDefICM()
Default constructor. Constructs a foreign key object.
DKForeignKeyDefICM(dkDatastore* ds)
Constructs a foreign key object and initialize it with the datastore.
Parameters: ds - A reference to a datastore object where the item type, whose foreign keys this object represents is defined Copy Constructor
DKForeignKeyDefICM(const DKForeignKeyDefICM& foreignKey)
A copy constructor for the foreign key object which make a copy of the specified foreign key.
Parameters: foreignKey- an foreign key object. Destructor
virtual ~DKForeignKeyDefICM()
Parameters: ds - datastore
void setDatastore(dkDatastore* ds);
Returns: dkDatastore datastore
dkDatastore* getDatastore();
Parameters: srcCompTypeName - source component type name
void setSourceCompTypeName(const char* srcCompTypeName);
Returns: source component type name
DKString getSourceCompTypeName();
Parameters: tgtCompTypeName - target component type name which this foreign key references.
Throws: DKException - if error occurs. /DL> See Also: DKSetTargetTableName
void setTargetCompTypeName(const char* tgtCompTypeName);
Returns: target component type name
DKString getTargetCompTypeName();
Parameters: tgtTableName - target table name
Throws: DKException - if error occurs Note: setTargetCompTypeName and setTargetTableName are mutually exclusive. The foreign key can either reference a component type which is internal to the ICM datastore or a external database table.
void setTargetTableName(const char* tgtTableName);
Returns: target table name
DKString getTargetTableName();
Returns: tgtSchemaName - target schema name
void setTargetSchemaName(const char* tgtSchemaName);
Returns: target schema name
DKString getTargetSchemaName();
Parameters: constraintName
void setConstraintName(const char* constraintName);
Returns: constraintName
DKString getConstraintName();
Parameters:
3 : No action
2 : Set null
1 : Cascade
0 : Restrict (default)
void setDeleteRule(short deleteRule);
Returns:delete rule for this foreign key constraint.
short getDeleteRule();
Parameters: updateRule - update rule for this foreign key constraint. The possible values are:
3 : No action
0 : Restrict (default)
void setUpdateRule(short updateRule);
Returns: update rule for this foreign key constraint.
short getUpdateRule();
Throws: DKException and DKAlreadyExistException - if error occurs
void addSrcAndTgtAttrName(const char* srcAttrName, const char* tgtAttrName, long columnSeq);
Parameters: srcAttrName - attrname of the attribute need to be removed
Throws: DKException and DKNotExistException - if error occurs
void removeSourceAttrName(const char* srcAttrName);
Parameters: arraySize - the size of the DKString array being returned
Returns: an array of DKString, which are the names of the source attributes
Throws: DKException - if error occurs
DKString* listSourceAttrNames(long& arraySize);
Parameters: arraySize - the size of the DKString array being returned
Returns: an array of DKString, which are the names of the source attributes
Throws: DKException - if error occurs
DKString* listTargetAttrNames(long& arraySize);
Returns: a dkcollection containing
String[3]: objects
String[0]: column seq
String[1]: source attribute
String[2]: target attribute
dkCollection* listForeignKeyAttrInfo();
(c) Copyright International Business Machines Corporation 1996, 2003. IBM Corp. All rights reserved.