From 39bb0f098a253d681e304cacf848d2c133cd77e6 Mon Sep 17 00:00:00 2001 From: Kovalenko Dmitry Date: Mon, 13 Mar 2023 23:26:34 +0300 Subject: [PATCH 1/2] Proposal for fix #287 --- .../Win7Samples/dataaccess/oledb/rowsetviewer/crowset.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Samples/Win7Samples/dataaccess/oledb/rowsetviewer/crowset.cpp b/Samples/Win7Samples/dataaccess/oledb/rowsetviewer/crowset.cpp index 9473a84f..be0b4a00 100644 --- a/Samples/Win7Samples/dataaccess/oledb/rowsetviewer/crowset.cpp +++ b/Samples/Win7Samples/dataaccess/oledb/rowsetviewer/crowset.cpp @@ -668,12 +668,12 @@ HRESULT CDataAccess::GetColumnData(const DBBINDING* pBinding, void* pData, DBSTA //(ie: DBTYPE_WSTR = "130". So we need to convert the string to an int, then to //the actual assoicated mapped type name (for ease of viewing without having to //have the header handy when viewing schemas). - DBTYPE wSchemaType; - if(ConvertToLONG(pwszValue, (LONG*)&wSchemaType, 0/*Min*/, LONG_MAX, 0/*Base*/)) + LONG lSchemaType; /*DBTYPE == UI2*/ + if(ConvertToLONG(pwszValue, &lSchemaType, 0/*Min*/, USHRT_MAX, 0/*Base*/)) { //NOTE: on failure we have no choice to leave the column as the original //returned integer. - StringCopy(pwszValue, GetDBTypeName(wSchemaType), ulMaxSize); + StringCopy(pwszValue, GetDBTypeName((DBTYPE)lSchemaType), ulMaxSize); } } } From 6f51cfb7eac3038b32c96e9c7605cd4459ca28d5 Mon Sep 17 00:00:00 2001 From: Kovalenko Dmitry Date: Wed, 22 Mar 2023 09:40:18 +0300 Subject: [PATCH 2/2] A comment on lSchemaType was corrected. --- Samples/Win7Samples/dataaccess/oledb/rowsetviewer/crowset.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Samples/Win7Samples/dataaccess/oledb/rowsetviewer/crowset.cpp b/Samples/Win7Samples/dataaccess/oledb/rowsetviewer/crowset.cpp index be0b4a00..67627f89 100644 --- a/Samples/Win7Samples/dataaccess/oledb/rowsetviewer/crowset.cpp +++ b/Samples/Win7Samples/dataaccess/oledb/rowsetviewer/crowset.cpp @@ -668,7 +668,7 @@ HRESULT CDataAccess::GetColumnData(const DBBINDING* pBinding, void* pData, DBSTA //(ie: DBTYPE_WSTR = "130". So we need to convert the string to an int, then to //the actual assoicated mapped type name (for ease of viewing without having to //have the header handy when viewing schemas). - LONG lSchemaType; /*DBTYPE == UI2*/ + LONG lSchemaType; /* it will be set with DBTYPE (USHORT) value */ if(ConvertToLONG(pwszValue, &lSchemaType, 0/*Min*/, USHRT_MAX, 0/*Base*/)) { //NOTE: on failure we have no choice to leave the column as the original