FIX: CCOLUMNSRow Column Names Are Incorrect
ID: Q217188
|
The information in this article applies to:
-
Microsoft Visual C++, 32-bit Editions, version 6.0
SYMPTOMS
The OLE DB Provider Templates define the CCOLUMNSRow class assigned to implement OLE DB's COLUMNS rowset. In the Atldb.h header file where this class is defined, the Provider column map for the class contains column names that are different from the OLE DB specification.
NOTE: It has been reported that Intersolv's Reflector looks for columns having the name according to the OLE DB specification, so customers using this product will encounter a problem with providers generated by the wizard.
RESOLUTION
This file is located in the C:\Program Files\Microsoft Visual Studio\VC98\ATL\Include directory.
The following shows the incorrect code:
BEGIN_PROVIDER_COLUMN_MAP(CCOLUMNSRow)
PROVIDER_COLUMN_ENTRY("TableCatalog", 1, m_szTableCatalog)
PROVIDER_COLUMN_ENTRY("TableSchema", 2, m_szTableSchema)
PROVIDER_COLUMN_ENTRY("TableName", 3, m_szTableName)
PROVIDER_COLUMN_ENTRY("ColumnName", 4, m_szColumnName)
PROVIDER_COLUMN_ENTRY("Column",5, m_guidColumn)
PROVIDER_COLUMN_ENTRY("ColumnPropID",6, m_ulColumnPropID)
PROVIDER_COLUMN_ENTRY("OrdinalPosition",7, m_ulOrdinalPosition)
PROVIDER_COLUMN_ENTRY("ColumnHasDefault",8, m_bColumnHasDefault)
PROVIDER_COLUMN_ENTRY("ColumnDefault",9, m_szColumnDefault)
PROVIDER_COLUMN_ENTRY("ColumnFlags",10, m_ulColumnFlags)
PROVIDER_COLUMN_ENTRY("IsNullable",11, m_bIsNullable)
PROVIDER_COLUMN_ENTRY("DataType",12, m_nDataType)
PROVIDER_COLUMN_ENTRY("Type",13, m_guidType)
PROVIDER_COLUMN_ENTRY("CharMaxLength",14, m_ulCharMaxLength)
PROVIDER_COLUMN_ENTRY("CharOctetLength",15, m_ulCharOctetLength)
PROVIDER_COLUMN_ENTRY("NumericPrecision",16, m_nNumericPrecision)
PROVIDER_COLUMN_ENTRY("NumericScale",17, m_nNumericScale)
PROVIDER_COLUMN_ENTRY("DateTimePrecision",18, m_ulDateTimePrecision)
PROVIDER_COLUMN_ENTRY("CharSetCatalog", 19, m_szCharSetCatalog)
PROVIDER_COLUMN_ENTRY("CharSetSchema", 20, m_szCharSetSchema)
PROVIDER_COLUMN_ENTRY("CharSetName", 21, m_szCharSetName)
PROVIDER_COLUMN_ENTRY("CollationCatalog", 22, m_szCollationCatalog)
PROVIDER_COLUMN_ENTRY("CollationSchema", 23, m_szCollationSchema)
PROVIDER_COLUMN_ENTRY("CollationName", 24, m_szCollationName)
PROVIDER_COLUMN_ENTRY("DomainCatalog", 25, m_szDomainCatalog)
PROVIDER_COLUMN_ENTRY("DomainSchema", 26, m_szDomainSchema)
PROVIDER_COLUMN_ENTRY("DomainName", 27, m_szDomainName)
PROVIDER_COLUMN_ENTRY("Description", 28, m_szDescription)
END_PROVIDER_COLUMN_MAP()<BR/>
The header file needs to be changed to reflect the correct column names. The following shows the corrected code:
BEGIN_PROVIDER_COLUMN_MAP(CCOLUMNSRow)
PROVIDER_COLUMN_ENTRY("TABLE_CATALOG", 1, m_szTableCatalog)
PROVIDER_COLUMN_ENTRY("TABLE_SCHEMA", 2, m_szTableSchema)
PROVIDER_COLUMN_ENTRY("TABLE_NAME", 3, m_szTableName)
PROVIDER_COLUMN_ENTRY("COLUMN_NAME", 4, m_szColumnName)
PROVIDER_COLUMN_ENTRY("COLUMN_GUID",5, m_guidColumn)
PROVIDER_COLUMN_ENTRY("COLUMN_PROPID",6, m_ulColumnPropID)
PROVIDER_COLUMN_ENTRY("ORDINAL_POSITION",7, m_ulOrdinalPosition)
PROVIDER_COLUMN_ENTRY("COLUMN_HASDEFAULT",8, m_bColumnHasDefault)
PROVIDER_COLUMN_ENTRY("COLUMN_DEFAULT",9, m_szColumnDefault)
PROVIDER_COLUMN_ENTRY("COLUMN_FLAGS",10, m_ulColumnFlags)
PROVIDER_COLUMN_ENTRY("IS_NULLABLE",11, m_bIsNullable)
PROVIDER_COLUMN_ENTRY("DATA_TYPE",12, m_nDataType)
PROVIDER_COLUMN_ENTRY("TYPE_GUID",13, m_guidType)
PROVIDER_COLUMN_ENTRY("CHARACTER_MAXIMUM_LENGTH",14, m_ulCharMaxLength)
PROVIDER_COLUMN_ENTRY("CHARACTER_OCTET_LENGTH",15, m_ulCharOctetLength)
PROVIDER_COLUMN_ENTRY("NUMERIC_PRECISION",16, m_nNumericPrecision)
PROVIDER_COLUMN_ENTRY("NUMERIC_SCALE",17, m_nNumericScale)
PROVIDER_COLUMN_ENTRY("DATETIME_PRECISION",18, m_ulDateTimePrecision)
PROVIDER_COLUMN_ENTRY("CHARACTER_SET_CATALOG", 19, m_szCharSetCatalog)
PROVIDER_COLUMN_ENTRY("CHARACTER_SET_SCHEMA", 20, m_szCharSetSchema)
PROVIDER_COLUMN_ENTRY("CHARACTER_SET_NAME", 21, m_szCharSetName)
PROVIDER_COLUMN_ENTRY("COLLATION_CATALOG", 22, m_szCollationCatalog)
PROVIDER_COLUMN_ENTRY("COLLATION_SCHEMA", 23, m_szCollationSchema)
PROVIDER_COLUMN_ENTRY("COLLATION_NAME", 24, m_szCollationName)
PROVIDER_COLUMN_ENTRY("DOMAIN_CATALOG", 25, m_szDomainCatalog)
PROVIDER_COLUMN_ENTRY("DOMAIN_SCHEMA", 26, m_szDomainSchema)
PROVIDER_COLUMN_ENTRY("DOMAIN_NAME", 27, m_szDomainName)
PROVIDER_COLUMN_ENTRY("DESCRIPTION", 28, m_szDescription)
END_PROVIDER_COLUMN_MAP()
STATUS
Microsoft has confirmed this to be a bug in the Microsoft products listed
at the beginning of this article.
This bug was corrected in Visual Studio 6.0 Service Pack 3.
For more information about Visual Studio service packs, please see the following articles in the Microsoft Knowledge Base:
Q194022 INFO: Visual Studio 6.0 Service Packs, What, Where, Why
Q194295 HOWTO: Tell That Visual Studio 6.0 Service Packs Are Installed
MORE INFORMATION
For other changes to Atldb.h, please see the following KB articles:
Q201387 BUG: CTABLESRow Missing TABLE_PROPID Column
Q198520 BUG: ATL OLE DB Provider Fails When Called From SQL 7.0 Query
REFERENCES
Reference COLUMNS Rowset in the OLE DB Programmer's Reference for more information about schema and columns. In addition, see the OLE DB Consumer Templates documentation for information on the schema rowset classes CColumns and CColumnsInfo.
Additional query words:
oledb
Keywords : kbservicepack kbATL kbDatabase kbOLEDB kbProvider kbVC600fix kbVS600sp2 kbVS600SP1 kbVS600sp3fix kbGrpVCDB
Version : winnt:6.0
Platform : winnt
Issue type : kbbug