Received: from u1.abs.net (root@u1.abs.net [207.114.0.131]) by hub.org (8.8.8/8.8.8) with ESMTP id KAA20987 for ; Mon, 21 Sep 1998 10:36:40 -0400 (EDT) (envelope-from byronn@insightdist.com) Received: from insightdist.com (nobody@localhost) by u1.abs.net (8.9.0/8.9.0) with UUCP id KAA06537 for pgsql-general@postgreSQL.org; Mon, 21 Sep 1998 10:31:44 -0400 (EDT) X-Authentication-Warning: u1.abs.net: nobody set sender to insightdist.com!byronn using -f Received: from ceodev by insightdist.com (AIX 3.2/UCB 5.64/4.03) id AA20389; Mon, 21 Sep 1998 10:17:57 -0400 Received: from byronn by ceodev (AIX 4.1/UCB 5.64/4.03) id AA77340; Mon, 21 Sep 1998 10:17:56 -0400 Message-Id: <36066165.8901A60F@insightdist.com> Date: Mon, 21 Sep 1998 10:23:33 -0400 From: Byron Nikolaidis X-Mailer: Mozilla 4.05 [en] (Win95; I) Mime-Version: 1.0 To: Stephen Davies Cc: PostgreSQL Interfaces , PostgreSQL general Subject: Re: [INTERFACES] SQLPrimaryKeys References: <199809190733.RAA23325@mustang.sdc.com.au> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Stephen Davies wrote: > Hello again. > > Does the SQLPrimaryKeys facility work with 6.3.2 and ODBC 6.30.0249? > > If so, could someone please send me the declaration and a sample of usage. > > If not, how else can I determine which columns comprise a unique key of a > PostgreSQL table via ODBC? > > (I can successfully access other functions such as SQLColumns. It is just > SQLPrimaryKeys that is causing me grief at the moment.) > It should work. I have used it and I tested it with applications such as Visio. Did you get an error or something? Here is a test usage to get the primary keys of the "t1" table: result = SQLAllocStmt( self, &hstmt1); result = SQLPrimaryKeys(hstmt1, NULL, 0, NULL, 0, "t1", SQL_NTS); result = SQLBindCol(hstmt1, 3, SQL_C_CHAR, pktab, sizeof(pktab), &pktab_len); result = SQLBindCol(hstmt1, 4, SQL_C_CHAR, pkcol, sizeof(pkcol), &pkcol_len); result = SQLBindCol(hstmt1, 5, SQL_C_SHORT, &seq, 0, NULL); result = SQLFetch(hstmt1); while (result != SQL_NO_DATA_FOUND) { qlog("fetch on stmt1: result = %d, pktab='%s', pkcol='%s', seq=%d\n", result, pktab, pkcol, seq); result = SQLFetch(hstmt1); }