Select the product you need help with
FIX: IRowsetImpl::GetData() Does Not Handle Nulls CorrectlyArticle ID: 217185 - View products that this article applies to. This article was previously published under Q217185 On This PageSYMPTOMS
When an OLE DB Provider returns a DBSTATUS of DBSTATUS_S_ISNULL for a text field created using the ATL OLE DB Provider templates then the length of the field returned to the OLE DB consumer is not explicitly set to zero. This behavior follows the OLE DB specification, but can cause problems if an OLE DB consumer application utilizes the field length without checking the DBSTATUS of the column first. For example, a consumer application may assume that a non-zero field length means that the field is not NULL which is a common assumption when using text fields.
CAUSE
IRowsetImpl::GetData does not explicitly set the length for the column to zero if the DBSTATUS of the column is set to DBSTATUS_S_ISNULL.
STATUSMicrosoft has confirmed that this is a bug in the Microsoft products that are 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: 194022 INFO: Visual Studio 6.0 Service Packs, What, Where, Why
(http://support.microsoft.com/kb/194022/EN-US/
)
194295 HOWTO: Tell That Visual Studio 6.0 Service Packs Are Installed
(http://support.microsoft.com/kb/194295/EN-US/
)
MORE INFORMATION
When implementing an CRowsetImpl derived class using the ATL OLE DB Provider template class, you can override the GetDBStatus function to provide DBSTATUS information for each field returned by the OLE DB Provider. If you return DBSTATUS_S_ISNULL from the GetDBStatus function for a particular field, this indicates to the OLE DB consumer that the particular field is NULL. Internally, IRowsetImpl::GetData checks the DBSTATUS value you set for each field when returning the data to the consumer. If you set DBSTATUS to DBSTATUS_S_ISNULL, IRowsetImpl::GetData does not update the length indicator for a text field to 0. IRowsetImpl::GetData returns an unmodified length indicator to the client if you set the DBSTATUS of a field to DBSTATUS_S_ISNULL. Steps to reproduce
Properties |


Back to the top








