|
Home > Archive > Sybase ODBC > June 2005 > Why SQLPrimaryKeys() always return NULL as key name
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
| Author |
Why SQLPrimaryKeys() always return NULL as key name
|
|
| Rafal Kukla 2005-06-03, 7:23 am |
| Hi,
Anybody know, why SQLPrimaryKeys() (and SQLForeignKeys() ) doesn`t
return key name ?
I tested ODBC drivers v. 4.20.0.67, 4.10.0.0 and 3.50.0.10 on ASE 12 and
12.5.1.
Thanks!
Rafal
| |
|
| Hi Rafal,
You need to post more details on your test. How where the keys applied on
the ASE?
Also make sure you run the installmaster associated with that ASE that you
are testing with.
Another thing: In regard to me asking how the keys were applied:
The ODBC Driver indicated uses teh csp sp_fkeys and sp_pkeys to get key
information.
In order for this to work, the keys must have been declared to the table via
the create table or alter table command. The procedures will not return
info on the keys if you used sp_foreignkey ot sp_primarykey ASE stored
procedures. Could this be the case here?
-PV
"Rafal Kukla" <rafalka@klub.chip.pl> wrote in message
news:42a026ce@forums
-2-dub...
> Hi,
> Anybody know, why SQLPrimaryKeys() (and SQLForeignKeys() ) doesn`t
> return key name ?
> I tested ODBC drivers v. 4.20.0.67, 4.10.0.0 and 3.50.0.10 on ASE 12 and
> 12.5.1.
>
> Thanks!
> Rafal
| |
| Rafal Kukla 2005-06-06, 11:23 am |
| Hi,
1. Keys are created as a constraint in CREATE TABLE command.
2. I run instmstr script before test.
3. sp_primarykey report this keys properly
4. Stored procedure sp_pkeys doesn't return key name (see DDL in
systemprocs). There are last three lines of this procedure:
select table_qualifier, table_owner, table_name, column_name, key_seq
from #pkeys
order by table_qualifier, table_owner, table_name, key_seq
I modify this proc manually by adding new column key_name to returned
resultset, but this do nothing (as I expected ;-)
SQLPrimaryKeys() work on with your ODBC driver? Which version do you have?
Thanks,
Rafal
Paul wrote:
> Hi Rafal,
>
> You need to post more details on your test. How where the keys applied on
> the ASE?
>
> Also make sure you run the installmaster associated with that ASE that you
> are testing with.
>
> Another thing: In regard to me asking how the keys were applied:
>
> The ODBC Driver indicated uses teh csp sp_fkeys and sp_pkeys to get key
> information.
> In order for this to work, the keys must have been declared to the table via
> the create table or alter table command. The procedures will not return
> info on the keys if you used sp_foreignkey ot sp_primarykey ASE stored
> procedures. Could this be the case here?
>
> -PV
>
> "Rafal Kukla" <rafalka@klub.chip.pl> wrote in message
> news:42a026ce@forums
-2-dub...
>
>
>
>
| |
|
| Hi Rafal,
Can you show me your create table example? Also, what ASE version are you
using? This works ok for me from 4.20.0067 to 5.00.0056.
-PV
"Rafal Kukla" <rafalka@klub.chip.pl> wrote in message
news:42a467ca@forums
-1-dub...[color=darkred]
> Hi,
> 1. Keys are created as a constraint in CREATE TABLE command.
> 2. I run instmstr script before test.
> 3. sp_primarykey report this keys properly
> 4. Stored procedure sp_pkeys doesn't return key name (see DDL in
> systemprocs). There are last three lines of this procedure:
> select table_qualifier, table_owner, table_name, column_name, key_seq
> from #pkeys
> order by table_qualifier, table_owner, table_name, key_seq
> I modify this proc manually by adding new column key_name to returned
> resultset, but this do nothing (as I expected ;-)
>
> SQLPrimaryKeys() work on with your ODBC driver? Which version do you have?
>
> Thanks,
> Rafal
>
>
> Paul wrote:
on[color=darkred]
you[color=darkred]
via[color=darkred]
| |
| Rafal Kukla 2005-06-07, 7:23 am |
| Hi,
create table example:
create table dbo.serwis (
id_konta int not null,
id_serwisu int not null,
data_poczatku datetime not null,
data_zmiany datetime not null,
data_konca datetime not null,
nr_lad int not null,
constraint pk_serwis PRIMARY KEY CLUSTERED ( id_konta,id_serwisu )
)
ASE versions from select @@version
Server 1:
Adaptive Server Enterprise/12.5.0.1/SWR 10291 IR/P/NT (IX86)/OS
4.0/rel12501/1778/32-bit/OPT/Fri May 17 00:59:18 2002
Server 2:
Adaptive Server Enterprise/12.0/P/NT (IX86)/OS 4.0/1576/32bit/OPT/Wed
Nov 03 22:35:30 1999
If ODBC functions really using catalog procedures like sp_pkeys or
sp_fkeys, I worry that SQLPrimaryKeys() never return key name because
sp_fkeys doesn't return required column (see function definition and/or
description on sybooks)
I wrote sample program pk_test (partialy based on odbcsql.c from MS SDK
examples), that display result of SQLPrimaryKeys() in this form
TABLE_CAT |TABLE_SCHE|TABLE_NA
ME |COLUMN_NAME
|KEY_SEQ|PK_NAME
CKK |dbo |serwis |id_konta
|1 |<NULL>
CKK |dbo |serwis |id_serwisu
|2 |<NULL>
Below, I include the source code (if you want, i can send you binary
version).
Can you create table serwis, run pk_test and send me your results
Thanks,
Rafal
--------------------------------------- START OF pk_test.c
/ ********************
********************
********************
*******************
* pk_test: a sample program that shows SQLPrimaryKeys() funtion results
* USAGE:
* pk_test <DSN> <user> <pass> <table>
* Written by: Rafal Kukla 2005 (based on odbcsql.c from MS SDK examples)
********************
********************
********************
*******************/
#include <windows.h>
#include <sql.h>
#include <sqlext.h>
#include <stdio.h>
#include <stdlib.h>
void HandleError(SQLHANDL
E hHandle, SQLSMALLINT hType, RETCODE RetCode);
#define TRYODBC(h,ht,x) {RETCODE iRet=x;\
if (iRet != SQL_SUCCESS) { HandleError(h,ht,iRe
t); } \
if (iRet == SQL_ERROR) { \
fprintf(stderr,"Error in " #x "\n"); \
goto Exit; \
} \
}
#define MAX_LEN 256
#define DISP_FORMAT "%-10.10s|%-10.10s|%-30.30s|%-30.30s|%-7.7s|%s\n"
int main(int argc, char* argv[])
{
HENV lpEnv = NULL;
HDBC lpDbc = NULL;
HSTMT lpStmt = NULL;
UCHAR t1[MAX_LEN]={0}; SQLINTEGER i1=0;
UCHAR t2[MAX_LEN]={0}; SQLINTEGER i2=0;
UCHAR t3[MAX_LEN]={0}; SQLINTEGER i3=0;
UCHAR t4[MAX_LEN]={0}; SQLINTEGER i4=0;
UCHAR t5[MAX_LEN]={0}; SQLINTEGER i5=0;
UCHAR t6[MAX_LEN]={0}; SQLINTEGER i6=0;
#define COLVAR(_nr_) ((i##_nr_ == -1)?"<NULL>":t##_nr_)
if (argc<5) {
fprintf(stderr,"Not enough parameters\nUsage: pk_test <DSN> <user>
<pass> <table>\n");
exit(-1);
}
if (SQLAllocHandle(SQL_
HANDLE_ENV,SQL_NULL_
HANDLE,&lpEnv) == SQL_ERROR){
fprintf(stderr,"Unable to allocate an environment handle\n");
exit(-1);
}
// Register this as an application that expects 2.x behavior,
TRYODBC(lpEnv,SQL_HA
NDLE_ENV,
SQLSetEnvAttr(lpEnv,
SQL_ATTR_ODBC_VERSIO
N,(SQLPOINTER)SQL_OV
_ODBC2,0) );
// Allocate a connection
TRYODBC(lpEnv,SQL_HA
NDLE_ENV,
SQLAllocHandle(SQL_H
ANDLE_DBC,lpEnv,&lpDbc) );
//Try connect
TRYODBC(lpDbc,SQL_HA
NDLE_DBC,
SQLConnect(lpDbc,arg
v[1],SQL_NTS,argv[2],SQL_NTS,argv[3],SQL_NTS) );
fprintf(stderr,"Connected!\n");
TRYODBC(lpDbc,SQL_HA
NDLE_DBC,
SQLAllocHandle(SQL_H
ANDLE_STMT,lpDbc,&lpStmt));
//Bind columns
TRYODBC(lpStmt,SQL_H
ANDLE_STMT,SQLBindCo
l(lpStmt,1,SQL_C_CHA
R,t1,MAX_LEN,&i1)
);
TRYODBC(lpStmt,SQL_H
ANDLE_STMT,SQLBindCo
l(lpStmt,2,SQL_C_CHA
R,t2,MAX_LEN,&i2)
);
TRYODBC(lpStmt,SQL_H
ANDLE_STMT,SQLBindCo
l(lpStmt,3,SQL_C_CHA
R,t3,MAX_LEN,&i3)
);
TRYODBC(lpStmt,SQL_H
ANDLE_STMT,SQLBindCo
l(lpStmt,4,SQL_C_CHA
R,t4,MAX_LEN,&i4)
);
TRYODBC(lpStmt,SQL_H
ANDLE_STMT,SQLBindCo
l(lpStmt,5,SQL_C_CHA
R,t5,MAX_LEN,&i5)
);
TRYODBC(lpStmt,SQL_H
ANDLE_STMT,SQLBindCo
l(lpStmt,6,SQL_C_CHA
R,t6,MAX_LEN,&i6)
);
TRYODBC(lpStmt,SQL_H
ANDLE_STMT,
SQLPrimaryKeys(lpStm
t,NULL,0,NULL,0,(SQL
CHAR*) argv[4],SQL_NTS) );
// Dislay results
printf(DISP_FORMAT,"TABLE_CAT","TABLE_SCHEM","TABLE_NAME","COLUMN_NAME","KEY_SEQ","PK_NAME");
do {
RETCODE RetCode;
TRYODBC(lpStmt,SQL_H
ANDLE_STMT, RetCode = SQLFetch(lpStmt));
if (RetCode == SQL_NO_DATA_FOUND) break;
printf(DISP_FORMAT,C
OLVAR(1),COLVAR(2),C
OLVAR(3),COLVAR(4),C
OLVAR(5),COLVAR(6)
);
} while (1);
printf("-- Done.\n");
Exit:
// Free ODBC handles and exit
if (lpDbc) {
SQLDisconnect(lpDbc)
;
SQLFreeConnect(lpDbc
);
}
if (lpEnv) SQLFreeEnv(lpEnv);
printf("Disconnected.\n");
return 0;
}
void HandleError(SQLHANDL
E hHandle, SQLSMALLINT hType, RETCODE RetCode)
{
SQLSMALLINT iRec = 0;
SQLINTEGER iError;
UCHAR szMessage[1000];
UCHAR szState& #91;SQL_SQLSTATE_SIZ
E];
if (RetCode == SQL_INVALID_HANDLE) {
fprintf(stderr,"Invalid handle!\n");
return;
}
while (SQLGetDiagRec(hType
, hHandle, ++iRec,szState,
&iError,szMessage,
(SQLSMALLINT)(sizeof
(szMessage) / sizeof(TCHAR)),
(SQLSMALLINT *)NULL) == SQL_SUCCESS)
{
// Hide data truncated..
if (strncmp(szState,"01004",5))
fprintf(stderr,"[%5.5s] %s (%d)\n" ,szState,szMessage,i
Error);
}
}
--------------------------------------- END OF pk_test.c
Paul wrote:
> Hi Rafal,
>
> Can you show me your create table example? Also, what ASE version are you
> using? This works ok for me from 4.20.0067 to 5.00.0056.
>
> -PV
> "Rafal Kukla" <rafalka@klub.chip.pl> wrote in message
> news:42a467ca@forums
-1-dub...
>
>
> on
>
>
> you
>
>
> via
>
>
>
| |
|
| Hi Rafal,
OK - so you are wanting to get the Key name of the constraint? I get the
same result using ODBC Test:
Using the ESD08 5.00.0056 build on ASE 12.5.3 (most current CSP - the
scripts that perform the catalog functions):
SQLPrimaryKeys:
In: StatementHandle = 0x00981910, CatalogName = SQL_NULL_HANDLE,
NameLength1 = 0, SchemaName = SQL_NULL_HANDLE, NameLength2 = 0,
TableName = "serwis",
NameLength3 = 6
Return: SQL_SUCCESS=0
Get Data All:
"TABLE_CAT", "TABLE_SCHEM", "TABLE_NAME", "COLUMN_NAME", "KEY_SEQ",
"PK_NAME"
"odbc", "dbo", "serwis", "id_konta", 1, <Null>
"odbc", "dbo", "serwis", "id_serwisu", 2, <Null>
2 rows fetched from 6 columns.
So this is what happens when sp_pkeys is called. This driver, Sybase ASE
ODBC Driver is the OEM driver that has been in the PC Client distribution
"forever". You should log a Sybase tech support case so it can be
investigated and changed.
However, Sybase has released a new version of the ASE ODBC Driver - to
prepare for the ASE 15.0 release, and it too is included in the SDK ESD08
(ASE ODBC Driver by Sybase - found in %SYBASE%\DataAccess\
odbc. The driver
name is "Adaptive Server Enterprise").
I find that this driver works:
SQLPrimaryKeys:
In: StatementHandle = 0x00981910, CatalogName = SQL_NULL_HANDLE,
NameLength1 = 0, SchemaName = SQL_NULL_HANDLE, NameLength2 = 0,
TableName = "serwis",
NameLength3 = 6
Return: SQL_SUCCESS=0
Get Data All:
"TABLE_CAT", "TABLE_SCHEM", "TABLE_NAME", "COLUMN_NAME", "KEY_SEQ",
"PK_NAME"
"odbc", "dbo", "serwis", "id_konta", 1, "pk_serwis"
"odbc", "dbo", "serwis", "id_serwisu", 2, "pk_serwis"
2 rows fetched from 6 columns.
Is this what you are expecting?
This calls a different CSP:
sp_odbc_primarykey
If you log the tech support case we can make sure that the sp_pkeys script
is changed to work according to the ODBC Spec.
-Paul
"Rafal Kukla" <rafalka@klub.chip.pl> wrote in message
news:42a577cf$1@foru
ms-1-dub...
> Hi,
> create table example:
> create table dbo.serwis (
> id_konta int not null,
> id_serwisu int not null,
> data_poczatku datetime not null,
> data_zmiany datetime not null,
> data_konca datetime not null,
> nr_lad int not null,
> constraint pk_serwis PRIMARY KEY CLUSTERED ( id_konta,id_serwisu )
> )
>
> ASE versions from select @@version
> Server 1:
> Adaptive Server Enterprise/12.5.0.1/SWR 10291 IR/P/NT (IX86)/OS
> 4.0/rel12501/1778/32-bit/OPT/Fri May 17 00:59:18 2002
> Server 2:
> Adaptive Server Enterprise/12.0/P/NT (IX86)/OS 4.0/1576/32bit/OPT/Wed
> Nov 03 22:35:30 1999
>
>
>
>
> If ODBC functions really using catalog procedures like sp_pkeys or
> sp_fkeys, I worry that SQLPrimaryKeys() never return key name because
> sp_fkeys doesn't return required column (see function definition and/or
> description on sybooks)
> I wrote sample program pk_test (partialy based on odbcsql.c from MS SDK
> examples), that display result of SQLPrimaryKeys() in this form
> TABLE_CAT |TABLE_SCHE|TABLE_NA
ME |COLUMN_NAME
> |KEY_SEQ|PK_NAME
> CKK |dbo |serwis |id_konta
> |1 |<NULL>
> CKK |dbo |serwis |id_serwisu
> |2 |<NULL>
>
> Below, I include the source code (if you want, i can send you binary
> version).
> Can you create table serwis, run pk_test and send me your results
> Thanks,
> Rafal
>
> --------------------------------------- START OF pk_test.c
>
/ ********************
********************
********************
***************
****
> * pk_test: a sample program that shows SQLPrimaryKeys() funtion results
> * USAGE:
> * pk_test <DSN> <user> <pass> <table>
> * Written by: Rafal Kukla 2005 (based on odbcsql.c from MS SDK examples)
>
>
********************
********************
********************
****************
***/
>
> #include <windows.h>
> #include <sql.h>
> #include <sqlext.h>
> #include <stdio.h>
> #include <stdlib.h>
>
>
> void HandleError(SQLHANDL
E hHandle, SQLSMALLINT hType, RETCODE
RetCode);
> #define TRYODBC(h,ht,x) {RETCODE iRet=x;\
> if (iRet != SQL_SUCCESS) { HandleError(h,ht,iRe
t); } \
> if (iRet == SQL_ERROR) { \
> fprintf(stderr,"Error in " #x "\n"); \
> goto Exit; \
> } \
> }
>
>
> #define MAX_LEN 256
> #define DISP_FORMAT "%-10.10s|%-10.10s|%-30.30s|%-30.30s|%-7.7s|%s\n"
> int main(int argc, char* argv[])
> {
> HENV lpEnv = NULL;
> HDBC lpDbc = NULL;
> HSTMT lpStmt = NULL;
> UCHAR t1[MAX_LEN]={0}; SQLINTEGER i1=0;
> UCHAR t2[MAX_LEN]={0}; SQLINTEGER i2=0;
> UCHAR t3[MAX_LEN]={0}; SQLINTEGER i3=0;
> UCHAR t4[MAX_LEN]={0}; SQLINTEGER i4=0;
> UCHAR t5[MAX_LEN]={0}; SQLINTEGER i5=0;
> UCHAR t6[MAX_LEN]={0}; SQLINTEGER i6=0;
> #define COLVAR(_nr_) ((i##_nr_ == -1)?"<NULL>":t##_nr_)
> if (argc<5) {
> fprintf(stderr,"Not enough parameters\nUsage: pk_test <DSN> <user>
> <pass> <table>\n");
> exit(-1);
> }
>
> if (SQLAllocHandle(SQL_
HANDLE_ENV,SQL_NULL_
HANDLE,&lpEnv) ==
SQL_ERROR)& #123;
> fprintf(stderr,"Unable to allocate an environment handle\n");
> exit(-1);
> }
>
> // Register this as an application that expects 2.x behavior,
> TRYODBC(lpEnv,SQL_HA
NDLE_ENV,
>
> SQLSetEnvAttr(lpEnv,
SQL_ATTR_ODBC_VERSIO
N,(SQLPOINTER)SQL_OV
_ODBC2,0) );
>
> // Allocate a connection
> TRYODBC(lpEnv,SQL_HA
NDLE_ENV,
> SQLAllocHandle(SQL_H
ANDLE_DBC,lpEnv,&lpDbc) );
>
> //Try connect
> TRYODBC(lpDbc,SQL_HA
NDLE_DBC,
>
SQLConnect(lpDbc,arg
v[1],SQL_NTS,argv[2],SQL_NTS,argv[3],SQL_NTS) );
>
> fprintf(stderr,"Connected!\n");
>
> TRYODBC(lpDbc,SQL_HA
NDLE_DBC,
> SQLAllocHandle(SQL_H
ANDLE_STMT,lpDbc,&lpStmt));
>
> //Bind columns
>
>
TRYODBC(lpStmt,SQL_H
ANDLE_STMT,SQLBindCo
l(lpStmt,1,SQL_C_CHA
R,t1,MAX_LEN,&i1
)
> );
>
>
TRYODBC(lpStmt,SQL_H
ANDLE_STMT,SQLBindCo
l(lpStmt,2,SQL_C_CHA
R,t2,MAX_LEN,&i2
)
> );
>
>
TRYODBC(lpStmt,SQL_H
ANDLE_STMT,SQLBindCo
l(lpStmt,3,SQL_C_CHA
R,t3,MAX_LEN,&i3
)
> );
>
>
TRYODBC(lpStmt,SQL_H
ANDLE_STMT,SQLBindCo
l(lpStmt,4,SQL_C_CHA
R,t4,MAX_LEN,&i4
)
> );
>
>
TRYODBC(lpStmt,SQL_H
ANDLE_STMT,SQLBindCo
l(lpStmt,5,SQL_C_CHA
R,t5,MAX_LEN,&i5
)
> );
>
>
TRYODBC(lpStmt,SQL_H
ANDLE_STMT,SQLBindCo
l(lpStmt,6,SQL_C_CHA
R,t6,MAX_LEN,&i6
)
> );
>
> TRYODBC(lpStmt,SQL_H
ANDLE_STMT,
> SQLPrimaryKeys(lpStm
t,NULL,0,NULL,0,(SQL
CHAR*) argv[4],SQL_NTS) );
>
> // Dislay results
>
>
printf(DISP_FORMAT,"TABLE_CAT","TABLE_SCHEM","TABLE_NAME","COLUMN_NAME","KEY
_SEQ","PK_NAME");
> do {
> RETCODE RetCode;
>
> TRYODBC(lpStmt,SQL_H
ANDLE_STMT, RetCode = SQLFetch(lpStmt));
> if (RetCode == SQL_NO_DATA_FOUND) break;
>
>
>
printf(DISP_FORMAT,C
OLVAR(1),COLVAR(2),C
OLVAR(3),COLVAR(4),C
OLVAR(5),COLVAR(
6)[color=darkred]
> );
> } while (1);
>
> printf("-- Done.\n");
> Exit:
> // Free ODBC handles and exit
> if (lpDbc) {
> SQLDisconnect(lpDbc)
;
> SQLFreeConnect(lpDbc
);
> }
> if (lpEnv) SQLFreeEnv(lpEnv);
>
> printf("Disconnected.\n");
>
> return 0;
> }
>
>
> void HandleError(SQLHANDL
E hHandle, SQLSMALLINT hType, RETCODE RetCode)
> {
> SQLSMALLINT iRec = 0;
> SQLINTEGER iError;
> UCHAR szMessage[1000];
> UCHAR szState& #91;SQL_SQLSTATE_SIZ
E];
>
> if (RetCode == SQL_INVALID_HANDLE) {
> fprintf(stderr,"Invalid handle!\n");
> return;
> }
>
> while (SQLGetDiagRec(hType
, hHandle, ++iRec,szState,
> &iError,szMessage,
> (SQLSMALLINT)(sizeof
(szMessage) / sizeof(TCHAR)),
> (SQLSMALLINT *)NULL) == SQL_SUCCESS)
> {
> // Hide data truncated..
> if (strncmp(szState,"01004",5))
> fprintf(stderr,"[%5.5s] %s (%d)\n" ,szState,szMessage,i
Error);
> }
> }
>
> --------------------------------------- END OF pk_test.c
>
>
>
>
> Paul wrote:
you[color=darkred]
key_seq[color=darkre
d]
have?[color=darkred]
table[color=darkred]
return[color=darkred
]
and[color=darkred]
| |
| Rafal Kukla 2005-06-08, 7:23 am |
| Hi,
I log this bug on Sybase tech support.
Thanks for help.
Rafal
Paul wrote:
> Hi Rafal,
>
> OK - so you are wanting to get the Key name of the constraint? I get the
> same result using ODBC Test:
>
> Using the ESD08 5.00.0056 build on ASE 12.5.3 (most current CSP - the
> scripts that perform the catalog functions):
>
> SQLPrimaryKeys:
> In: StatementHandle = 0x00981910, CatalogName = SQL_NULL_HANDLE,
> NameLength1 = 0, SchemaName = SQL_NULL_HANDLE, NameLength2 = 0,
> TableName = "serwis",
> NameLength3 = 6
> Return: SQL_SUCCESS=0
>
> Get Data All:
> "TABLE_CAT", "TABLE_SCHEM", "TABLE_NAME", "COLUMN_NAME", "KEY_SEQ",
> "PK_NAME"
> "odbc", "dbo", "serwis", "id_konta", 1, <Null>
> "odbc", "dbo", "serwis", "id_serwisu", 2, <Null>
> 2 rows fetched from 6 columns.
>
> So this is what happens when sp_pkeys is called. This driver, Sybase ASE
> ODBC Driver is the OEM driver that has been in the PC Client distribution
> "forever". You should log a Sybase tech support case so it can be
> investigated and changed.
>
> However, Sybase has released a new version of the ASE ODBC Driver - to
> prepare for the ASE 15.0 release, and it too is included in the SDK ESD08
> (ASE ODBC Driver by Sybase - found in %SYBASE%\DataAccess\
odbc. The driver
> name is "Adaptive Server Enterprise").
>
> I find that this driver works:
>
> SQLPrimaryKeys:
> In: StatementHandle = 0x00981910, CatalogName = SQL_NULL_HANDLE,
> NameLength1 = 0, SchemaName = SQL_NULL_HANDLE, NameLength2 = 0,
> TableName = "serwis",
> NameLength3 = 6
> Return: SQL_SUCCESS=0
>
> Get Data All:
> "TABLE_CAT", "TABLE_SCHEM", "TABLE_NAME", "COLUMN_NAME", "KEY_SEQ",
> "PK_NAME"
> "odbc", "dbo", "serwis", "id_konta", 1, "pk_serwis"
> "odbc", "dbo", "serwis", "id_serwisu", 2, "pk_serwis"
> 2 rows fetched from 6 columns.
>
>
> Is this what you are expecting?
>
> This calls a different CSP:
>
> sp_odbc_primarykey
>
> If you log the tech support case we can make sure that the sp_pkeys script
> is changed to work according to the ODBC Spec.
>
> -Paul
>
> "Rafal Kukla" <rafalka@klub.chip.pl> wrote in message
> news:42a577cf$1@foru
ms-1-dub...
>
>
> / ********************
********************
********************
***************
> ****
>
>
> ********************
********************
********************
****************
> ***/
>
>
> RetCode);
>
>
> SQL_ERROR){
>
>
> SQLConnect(lpDbc,arg
v[1],SQL_NTS,argv[2],SQL_NTS,argv[3],SQL_NTS) );
>
>
> TRYODBC(lpStmt,SQL_H
ANDLE_STMT,SQLBindCo
l(lpStmt,1,SQL_C_CHA
R,t1,MAX_LEN,&i1
> )
>
>
> TRYODBC(lpStmt,SQL_H
ANDLE_STMT,SQLBindCo
l(lpStmt,2,SQL_C_CHA
R,t2,MAX_LEN,&i2
> )
>
>
> TRYODBC(lpStmt,SQL_H
ANDLE_STMT,SQLBindCo
l(lpStmt,3,SQL_C_CHA
R,t3,MAX_LEN,&i3
> )
>
>
> TRYODBC(lpStmt,SQL_H
ANDLE_STMT,SQLBindCo
l(lpStmt,4,SQL_C_CHA
R,t4,MAX_LEN,&i4
> )
>
>
> TRYODBC(lpStmt,SQL_H
ANDLE_STMT,SQLBindCo
l(lpStmt,5,SQL_C_CHA
R,t5,MAX_LEN,&i5
> )
>
>
> TRYODBC(lpStmt,SQL_H
ANDLE_STMT,SQLBindCo
l(lpStmt,6,SQL_C_CHA
R,t6,MAX_LEN,&i6
> )
>
>
> printf(DISP_FORMAT,"TABLE_CAT","TABLE_SCHEM","TABLE_NAME","COLUMN_NAME","KEY
> _SEQ","PK_NAME");
>
>
> printf(DISP_FORMAT,C
OLVAR(1),COLVAR(2),C
OLVAR(3),COLVAR(4),C
OLVAR(5),COLVAR(
> 6)
>
>
> you
>
>
> key_seq
>
>
> have?
>
>
> table
>
>
> return
>
>
> and
>
>
>
|
|
|
|
|