OC GET FOREIGN KEY LIST

4D - Documentation   Français   English   German   4D ODBC, Command Theme List   4D ODBC, Command Alphabetical List   Back   Previous   Next

version 6.5


OC GET FOREIGN KEY LIST (cursor_ID; pkTableTarget; fkTableTarget; pkTableQualifier; pkTableOwner; pkTableName; pkColumnName; fkTableQualifier; fkTableOwner; fkTableName; fkColumnName; keySeq; updateRule; deleteRule; fkName; pkName)

ParameterTypeDescription
cursor_IDLongintConnection Identifier
pkTableTargetStringName of the primary key table target
fkTableTargetStringName of the foreign key table target
pkTableQualifierStringName of 4D array
pkTableOwnerStringName of 4D array
pkTableNameStringName of 4D array
pkColumnNameStringName of 4D array
fkTableQualifierStringName of 4D array
fkTableOwnerStringName of 4D array
fkTableNameStringName of 4D array
fkColumnNameStringName of 4D array
keySeqStringName of 4D array
updateRuleStringName of 4D array
deleteRuleStringName of 4D array
fkNameStringName of 4D array
pkNameStringName of 4D array

Description

The command OC GET FOREIGN KEY LIST returns a list of foreign keys in the specified table that refer to primary keys in other tables or a list of foreign keys in other tables that refer to the primary key in the specified table.

If pkTableTarget contains a table name, OC GET FOREIGN KEY LIST returns a result set containing the primary key of the specified table and all the foreign keys that refer to it.

If fkTableTarget contains a table name, OC GET FOREIGN KEY LIST returns a result set containing all the foreign keys in the specified table and the primary keys in other tables to which they refer.

If both pkTableTarget and fkTableTarget contain a table name, OC GET FOREIGN KEY LIST returns the foreign keys in the table specified in fkTableTarget that refer to the primary key of the table specified in pkTableTarget. This should be one key at most.

cursor_ID must be a valid cursor.

pkTableTarget is a table containing the primary key.

fkTableTarget is a table containing the foreign key.

pkTableQualifier is the primary key table qualifier identifier. An empty string is returned if not applicable to the data source.

pkTableOwner is the primary key table owner identifier. An empty string is returned if not applicable to the data source.

pkTableName is the primary key table identifier.

pkColumnName is the primary key column identifier.

fkTableQualifier is the foreign key table qualifier identifier. An empty string is returned if not applicable to the data source.

fkTableOwner is the foreign key table owner identifier. An empty string is returned if not applicable to the data source.

fkTableName is the foreign key table identifier.

fkColumnName is the foreign key column identifier.

keySeq is the column sequence number in the key (starting with 1).

updateRule is the action to be applied to the foreign key when the SQL operation is UPDATE:

0 -> SQL_CASCADE
1 -> SQL_RESTRICT
2 -> SQL_SET_NULL

An empty string is returned if not applicable to the data source.

deleteRule is the action to be applied to the foreign key when the SQL operation is DELETE:

0 -> SQL_CASCADE
1 -> SQL_RESTRICT
2 -> SQL_SET_NULL

An empty string is returned if not applicable to the data source.

fkName is the foreign key identifier. An empty string is returned if not applicable to the data source.

pkName is the primary key identifier. An empty string is returned if not applicable to the data source.

Example

      `Declare the needed arrays
   ARRAY STRING(15;apkTableQualifier;0)
   ARRAY STRING(15;apkTableOwner;0)
   ARRAY STRING(15;apkTableName;0)
   ARRAY STRING(15;apkColumnName;0)
   ARRAY STRING(15;afkTableQualifier;0)
   ARRAY STRING(15;afkTableOwner;0)
   ARRAY STRING(15;afkTableName;0)
   ARRAY STRING(15;afkColumnName;0)
   ARRAY STRING(15;aKeySeq;0)
   ARRAY STRING(15;aUpdateRule;0)
   ARRAY STRING(15;aDeleteRule;0)
   ARRAY STRING(15;afkName;0)
   ARRAY STRING(15;apkName;0)
   loginID:=OC Login ("sa";"";"MSSQL65")
   cursor:=OC Create cursor (loginID)
   OC GET FOREIGN KEY LIST(cursor;"titres";"titreauteur";"apkTableQualifier";"apkTableOwner";
                  "apkTableName";"apkColumnName";"afkTableQualifier";"afkTableOwner";"afkTableName";
                  "afkColumnName";"aKeySeq";"aUpdateRule";"aDeleteRule";"afkName";"apkName")
   OC DROP CURSOR (cursor)
   OC LOGOUT (loginID)

See Also

OC GET PRIMARY KEY LIST.


4D - Documentation   Français   English   German   4D ODBC, Command Theme List   4D ODBC, Command Alphabetical List   Back   Previous   Next