Skip site navigation (1) Skip section navigation (2)

Re: [INTERFACES] SQLPrimaryKeys

From: Byron Nikolaidis <byronn(at)insightdist(dot)com>
To: Stephen Davies <scldad(at)sdc(dot)com(dot)au>
Cc: PostgreSQL Interfaces <pgsql-interfaces(at)postgreSQL(dot)org>, PostgreSQL general <pgsql-general(at)postgreSQL(dot)org>
Subject: Re: [INTERFACES] SQLPrimaryKeys
Date: 1998-09-21 14:23:33
Message-ID: 36066165.8901A60F@insightdist.com (view raw or flat)
Thread:
Lists: pgsql-generalpgsql-interfaces

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);
 }




In response to

pgsql-interfaces by date

Next:From: Byron NikolaidisDate: 1998-09-21 14:27:06
Subject: Re: [INTERFACES] ODBC + Symantec Cafe 2.5 problem
Previous:From: Ivo SimicevicDate: 1998-09-21 13:55:57
Subject: ODBC + Symantec Cafe 2.5 problem

pgsql-general by date

Next:From: Jose Manuel Benitez SanchezDate: 1998-09-21 14:46:29
Subject: Importing Oracle Databases
Previous:From: Franck SGARDDate: 1998-09-21 13:17:40
Subject: compilation problems

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group