| Bug #36441 | SQLPrimaryKeys returns mangled strings | ||
|---|---|---|---|
| Submitted: | 30 Apr 2008 23:00 | Modified: | 2 May 2008 9:42 |
| Reporter: | John Water | ||
| Status: | Verified | ||
| Category: | Connector/ODBC | Severity: | S2 (Serious) |
| Version: | 5.01.04/5.1.4 | OS: | Microsoft Windows (XP) |
| Assigned to: | Target Version: | ||
| Tags: | SQLPrimaryKeys, ODBC API | ||
| Triage: | D2 (Serious) | ||
[2 May 2008 9:42]
Tonci Grgin
Hi John and thanks for your report. Verified just as described using MySQL server 50.058PB on WinXP Pro SP2 localhost: SQLPrimaryKeys: In: StatementHandle = 0x00851FE0, CatalogName = "test", NameLength1 = 4, SchemaName = "test", NameLength2 = 4, TableName = "t1234567890123456789", NameLength3 = 20 Return: SQL_SUCCESS=0 Get Data All: "TABLE_CAT", "TABLE_SCHEM", "TABLE_NAME", "COLUMN_NAME", "KEY_SEQ", "PK_NAME" <Null>, <Null>, "t123456789012", "p", 1, "P" <Null>, <Null>, "t123456789012", "c", 2, "P" 2 rows fetched from 6 columns.
[19 Apr 0:51]
a hasse
hi, do you fix the problem in a later release? i have a similar bug using OpenSchema(adSchemaPrimaryKeys, Array(Empty, Empty, "defcontrols")) with the ado-connection-object. if the table has more than one unique key, the returned recordset has not the correct pk-info about table, column and index-name: TABLE_CATALOG Null TABLE_SCHEMA Null TABLE_NAME defc --> correct string: "defcontrols" COLUMN_NAME i --> correct string: "id" COLUMN_GUID Null COLUMN_PROPID Null ORDINAL 1 PK_NAME P --> correct string: "Primary" when using odbc v3.51.21 (or higher), it works...
[19 Apr 1:07]
a hasse
i forgot to let you know: myodbc v5.1.5 is currently installed on win xp sp3...

Description: SQLPrimaryKeysW returns mangled strings for the table name, column name and primary key name (only the first letter been returned). For a table that is defined as create table t1234567890123456789 ( pk_for_table1 integer not null auto_increment, c1_for_table1 varchar( 128 ) not null unique, c2_for_table1 binary( 32 ) null, primary key( pk_for_table1, c1_for_table1 ) ) SQLPrimaryKeysW would return Table Catalog: <NULL> Table Schema: <NULL> Table Name: t123456789012 Column Name: p keySeq: 1 pk Name: P Table Catalog: <NULL> Table Schema: <NULL> Table Name: t123456789012 Column Name: c keySeq: 2 pk Name: P How to repeat: The attached zip file contains odbcbug.c, odbcbug.exe fow Windows. Here are the steps to reproduce this problem: 1) Detached the attached zip file and unzip it; 2) Run odbcbug "dsn=...;uid=...;pwd=..." Then you'll see this problem.