+RETCODE SQL_API
+SQLForeignKeys (
+ HSTMT hstmt,
+ UCHAR FAR * szPkTableQualifier,
+ SWORD cbPkTableQualifier,
+ UCHAR FAR * szPkTableOwner,
+ SWORD cbPkTableOwner,
+ UCHAR FAR * szPkTableName,
+ SWORD cbPkTableName,
+ UCHAR FAR * szFkTableQualifier,
+ SWORD cbFkTableQualifier,
+ UCHAR FAR * szFkTableOwner,
+ SWORD cbFkTableOwner,
+ UCHAR FAR * szFkTableName,
+ SWORD cbFkTableName)
+{
+ STMT_t FAR *pstmt = (STMT_t FAR *) hstmt;
+ HPROC hproc = SQL_NULL_HPROC;
+ RETCODE retcode;
+ int sqlstat = en_00000;
+
+ if (hstmt == SQL_NULL_HSTMT || pstmt->hdbc == SQL_NULL_HDBC)
+ {
+ return SQL_INVALID_HANDLE;
+ }
+
+ for (;;)
+ {
+ if ((cbPkTableQualifier < 0 && cbPkTableQualifier != SQL_NTS)
+ || (cbPkTableOwner < 0 && cbPkTableOwner != SQL_NTS)
+ || (cbPkTableName < 0 && cbPkTableName != SQL_NTS)
+ || (cbFkTableQualifier < 0 && cbFkTableQualifier != SQL_NTS)
+ || (cbFkTableOwner < 0 && cbFkTableOwner != SQL_NTS)
+ || (cbFkTableName < 0 && cbFkTableName != SQL_NTS))
+ {
+ sqlstat = en_S1090;
+ break;
+ }
+
+ retcode = _iodbcdm_cata_state_ok (hstmt, en_ForeignKeys);
+
+ if (retcode != SQL_SUCCESS)
+ {
+ return SQL_ERROR;
+ }
+
+ hproc = _iodbcdm_getproc (pstmt->hdbc, en_ForeignKeys);
+
+ if (hproc == SQL_NULL_HPROC)
+ {
+ sqlstat = en_IM001;
+ break;
+ }
+
+ sqlstat = en_00000;
+
+ if (1) /* turn off solaris warning message */
+ break;
+ }
+
+ if (sqlstat != en_00000)
+ {
+ PUSHSQLERR (pstmt->herr, sqlstat);
+
+ return SQL_ERROR;
+ }
+
+ CALL_DRIVER (pstmt->hdbc, retcode, hproc, en_ForeignKeys, (
+ pstmt->dhstmt,
+ szPkTableQualifier,
+ cbPkTableQualifier,
+ szPkTableOwner,
+ cbPkTableOwner,
+ szPkTableName,
+ cbPkTableName,
+ szFkTableQualifier,
+ cbFkTableQualifier,
+ szFkTableOwner,
+ cbFkTableOwner,
+ szFkTableName,
+ cbFkTableName))
+
+ return _iodbcdm_cata_state_tr (hstmt, en_ForeignKeys, retcode);