How to use SQLPrimaryKeys in ODBC Test

Abstract: How to use SQLPrimaryKeys in ODBC Test

Problem: Don't know how to use SQLPrimaryKeys in ODBC. Solution: IB v4.x Visigenic InterBase ODBC driver v2.00.0903 Because of a bug in the 1.809 driver (see Solvent document #102), we needed a way to verify that the SQLPrimaryKeys worked. This function returns the column names that comprise the primary key for a table. Here is an example of how to use SQLPrimaryKeys in ODBC Test: 1) Connect to a database using an ODBC alias. 2) Select SQLPrimaryKeys... under Catalog. 3) Input table name (such as customer) for name under szTable... 4) You will see something like this once you click OK. Successfully connected to DSN 'InterBase 5.x ODBC Driver'. SQLPrimaryKeys: In: StatementHandle = 0x00301250, CatalogName = SQL_NULL_HANDLE, NameLength1 = 0, SchemaName = SQL_NULL_HANDLE, NameLength2 = 0, TableName = "employee", NameLength3 = 10 Return: SQL_SUCCESS=0 5) Select GetDataAll under Results then you see your data returned. Sample of returned data: Get Data All: "TABLE_QUALIFIER", "TABLE_OWNER", "TABLE_NAME", "COLUMN_NAME", "KEY_SEQ", "PK_NAME" , , "EMPLOYEE", "EMP_NO", 0, "INTEG_27" 1 row fetched from 6 columns.