Bug #56207 SQLStatistics() returns bad index type
Submitted: 24 Aug 2010 4:24 Modified: 24 Aug 2010 7:59
Reporter: Federico Omoto Email Updates:
Status: Verified Impact on me:
None 
Category:Connector / ODBC Severity:S4 (Feature request)
Version:5.1.6 OS:Windows (Tested on Windows, maybe other OSes too)
Assigned to: Assigned Account CPU Architecture:Any

[24 Aug 2010 4:24] Federico Omoto
Description:
When you call SQLStatistics() for a table, the TYPE column of the result set is always SQL_INDEX_OTHER (3), even for BTREE indexes.

How to repeat:
Just call SQLStatistics() for any table and look at the TYPE column of the result set, it'll always be SQL_INDEX_OTHER regardless of the real index type.
[24 Aug 2010 7:44] Tonci Grgin
Hi Federico and thanks for your report.

Verified as described, INDEX_TYPE is hardcoded in catalog.c MySQLStatistics, ln ~1131:
    my_int2str(SQL_INDEX_OTHER,SS_type,10,0);

Please lower the severity to S4 as this is, actually, a feature request to support SQLStatistics(W) fully. Definitely, there is NO "severe loss of service" nor there is a "significant functionality missing".

	Successfully connected to DSN '5-1-6-on-opensol'.
SQLStatistics:
	In:StatementHandle = 0x00566068, CatalogName = "test", NameLength1 = 4, SchemaName = "test", NameLength2 = 4, TableName = "testkeys", NameLength3 = 8, Unique = SQL_INDEX_ALL=1, Reserved = SQL_QUICK=0
	Return:	SQL_SUCCESS=0

Get Data All:
"TABLE_CAT", "TABLE_SCHEM", "TABLE_NAME", "NON_UNIQUE", "INDEX_QUALIFIER", "INDEX_NAME", "TYPE", "ORDINAL_POSITION", "COLUMN_NAME", "ASC_OR_DESC", "CARDINALITY", "PAGES", "FILTER_CONDITION"
"test", <Null>, "testkeys", 0, <Null>, "PRIMARY", 3, 1, "Id", "A", 0, <Null>, <Null>
"test", <Null>, "testkeys", 0, <Null>, "Ndx_Uni", 3, 1, "FldUKP1", "A", <Null>, <Null>, <Null>
"test", <Null>, "testkeys", 0, <Null>, "Ndx_Uni", 3, 2, "FldUKP2", "A", 0, <Null>, <Null>
"test", <Null>, "testkeys", 1, <Null>, "Key_Ord", 3, 1, "Fld3OrdIndex", "A", <Null>, <Null>, <Null>
4 rows fetched from 13 columns.

SQLStatistics:
	In:StatementHandle = 0x00566068, CatalogName = "test", NameLength1 = 4, SchemaName = "test", NameLength2 = 4, TableName = "testkeys", NameLength3 = 8, Unique = SQL_INDEX_UNIQUE=0, Reserved = SQL_QUICK=0
	Return:	SQL_SUCCESS=0

Get Data All:
"TABLE_CAT", "TABLE_SCHEM", "TABLE_NAME", "NON_UNIQUE", "INDEX_QUALIFIER", "INDEX_NAME", "TYPE", "ORDINAL_POSITION", "COLUMN_NAME", "ASC_OR_DESC", "CARDINALITY", "PAGES", "FILTER_CONDITION"
"test", <Null>, "testkeys", 0, <Null>, "PRIMARY", 3, 1, "Id", "A", 0, <Null>, <Null>
"test", <Null>, "testkeys", 0, <Null>, "Ndx_Uni", 3, 1, "FldUKP1", "A", <Null>, <Null>, <Null>
"test", <Null>, "testkeys", 0, <Null>, "Ndx_Uni", 3, 2, "FldUKP2", "A", 0, <Null>, <Null>
3 rows fetched from 13 columns.
[24 Aug 2010 7:59] Federico Omoto
Hi Tonci,

I've lowered the severity to S4, sorry for that. Thank you for your fast reply!