Level 2 subroutine
Return the column name(s) for a table's primary key.
call EDSPrimaryKeys(HSTMT_IV, TABLE_STRUCT, MAXROWS_IV, NUMROWS_IV, ARRAY_STRUCT)
•HSTMT_IV An input integer value that indicates the statement handle.
•TABLE_STRUCT An input EDSTABLE_STRUCT structure containing the usage fields TABLE.QUALIFIER, TABLE.OWNER, and TABLE.NAME.
•MAXROWS_IV An input integer value indicating the maximum number of rows in the result array.
•NUMROWS_IV An output integer value indicating the actual number of rows in the result array.
•ARRAY_STRUCT An output array of EDSPKEY_STRUCT structures.
Description
EDSPrimaryKeys returns results as an array of EDSPKEY_STRUCT structures. The following table lists the values returned in each structure in the array.
Column Name |
Data Type |
Comments |
TABLE_QUALIFIER |
string |
Primary key table qualifier identifier; NULL if not applicable to the data source. |
TABLE_OWNER |
string |
Primary key table owner identifier; NULL if not applicable to the data source. |
TABLE_NAME |
string |
Primary key table identifier. |
COLUMN_NAME |
string |
Primary key column identifier. |
KEY_SEQ |
integer |
Column sequence number in key (starting with 1). |
If MAXROWS_IV=NUMROWS_IV, then there were more rows of data to fetch than there were structures in the array. To retrieve the full set of results, the user must RESIZE the array and call the function again.
Return Value
EDSPrimaryKeys returns EDS_SUCCESS, EDS_ERROR, or EDS_INVALID_HANDLE.
When EDSGetPrimaryKeys returns EDS_ERROR, you can obtain an associated SQLSTATE value with more specific information by calling EDSError. The following table lists each typical SQLSTATE value and explains each one in the context of the command EDSPrimaryKeys.
The following table lists possible SQLSTATE values:
SQL STATE |
Error |
Description |
08S01 |
Communication link failure |
The communication link between the driver and the data source to which the driver was connected failed before the function completed processing. |
24000 |
Invalid cursor state |
Results were pending on the statement handle from a previous SELECT statement or a cursor associated with the statement handle had not been closed. |
IM001 |
Driver does not support this function |
The driver associated with the statement handle does not support the function. |
S1000 |
General error |
An error occurred for which there was no specific SQLSTATE and for which no implementation-specific SQLSTATE was defined. The error message returned by EDSError in the argument ERRORTEXT describes the error and its cause. |
S1001 |
Memory allocation failure |
The driver was unable to allocate the memory required to support execution or completion of the function. |
S1008 |
Operation cancelled |
Asynchronous processing was enabled for the statement handle. The function was called and before it completed execution, EDSCancel was called on the statement handle. Then the function was called again on the statement handle. |
S1010 |
Function sequence error |
An asynchronously executing function (not this one) was called for the statement handle and was still executing when this function was called. |
S1C00 |
Driver not capable |
A table qualifier or a table owner was specified and the driver or data source does not support one or both of the qualifiers. |
S1T00 |
Timeout expired |
The timeout period expired before the data source returned the requested result set. The timeout period is set through EDSSetStmtOption, EDS_QUERY_TIMEOUT. |
See Also
EDSForeignKeys returns columns in a foreign key.