From 669f966db3cf4a3f30dc574523bf54266189730e Mon Sep 17 00:00:00 2001 From: Rageking8 <106309953+Rageking8@users.noreply.github.com> Date: Wed, 23 Jul 2025 15:52:36 +0800 Subject: [PATCH 1/5] Add backticks in "Dynamically Determining Columns Returned to the Consumer" --- ...ically-determining-columns-returned-to-the-consumer.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/docs/data/oledb/dynamically-determining-columns-returned-to-the-consumer.md b/docs/data/oledb/dynamically-determining-columns-returned-to-the-consumer.md index 9ae135a598..3233a847e1 100644 --- a/docs/data/oledb/dynamically-determining-columns-returned-to-the-consumer.md +++ b/docs/data/oledb/dynamically-determining-columns-returned-to-the-consumer.md @@ -7,9 +7,9 @@ ms.assetid: 58522b7a-894e-4b7d-a605-f80e900a7f5f --- # Dynamically Determining Columns Returned to the Consumer -The PROVIDER_COLUMN_ENTRY macros normally handle the `IColumnsInfo::GetColumnsInfo` call. However, because a consumer might choose to use bookmarks, the provider must be able to change the columns returned depending on whether the consumer asks for a bookmark. +The `PROVIDER_COLUMN_ENTRY` macros normally handle the `IColumnsInfo::GetColumnsInfo` call. However, because a consumer might choose to use bookmarks, the provider must be able to change the columns returned depending on whether the consumer asks for a bookmark. -To handle the `IColumnsInfo::GetColumnsInfo` call, delete the PROVIDER_COLUMN_MAP, which defines a function `GetColumnInfo`, from the `CCustomWindowsFile` user record in *Custom*RS.h and replace it with the definition for your own `GetColumnInfo` function: +To handle the `IColumnsInfo::GetColumnsInfo` call, delete the `PROVIDER_COLUMN_MAP`, which defines a function `GetColumnInfo`, from the `CCustomWindowsFile` user record in *Custom*RS.h and replace it with the definition for your own `GetColumnInfo` function: ```cpp //////////////////////////////////////////////////////////////////////// @@ -36,7 +36,7 @@ Next, implement the `GetColumnInfo` function in *Custom*RS.cpp, as shown in the `GetColumnInfo` checks first to see if the OLE DB property `DBPROP_BOOKMARKS` is set. To get the property, `GetColumnInfo` uses a pointer (`pRowset`) to the rowset object. The `pThis` pointer represents the class that created the rowset, which is the class where the property map is stored. `GetColumnInfo` typecasts the `pThis` pointer to an `RCustomRowset` pointer. -To check for the `DBPROP_BOOKMARKS` property, `GetColumnInfo` uses the `IRowsetInfo` interface, which you can get by calling `QueryInterface` on the `pRowset` interface. As an alternative, you can use an ATL [CComQIPtr](../../atl/reference/ccomqiptr-class.md) method instead. +To check for the `DBPROP_BOOKMARKS` property, `GetColumnInfo` uses the `IRowsetInfo` interface, which you can get by calling `QueryInterface` on the `pRowset` interface. As an alternative, you can use an ATL [`CComQIPtr`](../../atl/reference/ccomqiptr-class.md) method instead. ```cpp //////////////////////////////////////////////////////////////////// @@ -97,7 +97,7 @@ ATLCOLUMNINFO* CCustomWindowsFile::GetColumnInfo(void* pThis, ULONG* pcCols) } ``` -This example uses a static array to hold the column information. If the consumer doesn't want the bookmark column, one entry in the array is unused. To handle the information, you create two array macros: ADD_COLUMN_ENTRY and ADD_COLUMN_ENTRY_EX. ADD_COLUMN_ENTRY_EX takes an extra parameter, *flags*, that is needed if you designate a bookmark column. +This example uses a static array to hold the column information. If the consumer doesn't want the bookmark column, one entry in the array is unused. To handle the information, you create two array macros: `ADD_COLUMN_ENTRY` and `ADD_COLUMN_ENTRY_EX`. `ADD_COLUMN_ENTRY_EX` takes an extra parameter, *`flags`*, that is needed if you designate a bookmark column. ```cpp //////////////////////////////////////////////////////////////////////// From cdd96ad17fa2271513b474d65f5b7fc4cd5353bf Mon Sep 17 00:00:00 2001 From: Rageking8 <106309953+Rageking8@users.noreply.github.com> Date: Wed, 23 Jul 2025 15:55:28 +0800 Subject: [PATCH 2/5] Fix trailing spaces syntax errors in "Dynamically Determining Columns Returned to the Consumer" --- ...mining-columns-returned-to-the-consumer.md | 44 +++++++++---------- 1 file changed, 22 insertions(+), 22 deletions(-) diff --git a/docs/data/oledb/dynamically-determining-columns-returned-to-the-consumer.md b/docs/data/oledb/dynamically-determining-columns-returned-to-the-consumer.md index 3233a847e1..1dad936b13 100644 --- a/docs/data/oledb/dynamically-determining-columns-returned-to-the-consumer.md +++ b/docs/data/oledb/dynamically-determining-columns-returned-to-the-consumer.md @@ -103,29 +103,29 @@ This example uses a static array to hold the column information. If the consumer //////////////////////////////////////////////////////////////////////// // CustomRS.h -#define ADD_COLUMN_ENTRY(ulCols, name, ordinal, colSize, type, precision, scale, guid, dataClass, member) \ - _rgColumns[ulCols].pwszName = (LPOLESTR)name; \ - _rgColumns[ulCols].pTypeInfo = (ITypeInfo*)NULL; \ - _rgColumns[ulCols].iOrdinal = (ULONG)ordinal; \ - _rgColumns[ulCols].dwFlags = 0; \ - _rgColumns[ulCols].ulColumnSize = (ULONG)colSize; \ - _rgColumns[ulCols].wType = (DBTYPE)type; \ - _rgColumns[ulCols].bPrecision = (BYTE)precision; \ - _rgColumns[ulCols].bScale = (BYTE)scale; \ - _rgColumns[ulCols].cbOffset = offsetof(dataClass, member); +#define ADD_COLUMN_ENTRY(ulCols, name, ordinal, colSize, type, precision, scale, guid, dataClass, member) \ + _rgColumns[ulCols].pwszName = (LPOLESTR)name; \ + _rgColumns[ulCols].pTypeInfo = (ITypeInfo*)NULL; \ + _rgColumns[ulCols].iOrdinal = (ULONG)ordinal; \ + _rgColumns[ulCols].dwFlags = 0; \ + _rgColumns[ulCols].ulColumnSize = (ULONG)colSize; \ + _rgColumns[ulCols].wType = (DBTYPE)type; \ + _rgColumns[ulCols].bPrecision = (BYTE)precision; \ + _rgColumns[ulCols].bScale = (BYTE)scale; \ + _rgColumns[ulCols].cbOffset = offsetof(dataClass, member); -#define ADD_COLUMN_ENTRY_EX(ulCols, name, ordinal, colSize, type, precision, scale, guid, dataClass, member, flags) \ - _rgColumns[ulCols].pwszName = (LPOLESTR)name; \ - _rgColumns[ulCols].pTypeInfo = (ITypeInfo*)NULL; \ - _rgColumns[ulCols].iOrdinal = (ULONG)ordinal; \ - _rgColumns[ulCols].dwFlags = flags; \ - _rgColumns[ulCols].ulColumnSize = (ULONG)colSize; \ - _rgColumns[ulCols].wType = (DBTYPE)type; \ - _rgColumns[ulCols].bPrecision = (BYTE)precision; \ - _rgColumns[ulCols].bScale = (BYTE)scale; \ - _rgColumns[ulCols].cbOffset = offsetof(dataClass, member); \ - memset(&(_rgColumns[ulCols].columnid), 0, sizeof(DBID)); \ - _rgColumns[ulCols].columnid.uName.pwszName = (LPOLESTR)name; +#define ADD_COLUMN_ENTRY_EX(ulCols, name, ordinal, colSize, type, precision, scale, guid, dataClass, member, flags) \ + _rgColumns[ulCols].pwszName = (LPOLESTR)name; \ + _rgColumns[ulCols].pTypeInfo = (ITypeInfo*)NULL; \ + _rgColumns[ulCols].iOrdinal = (ULONG)ordinal; \ + _rgColumns[ulCols].dwFlags = flags; \ + _rgColumns[ulCols].ulColumnSize = (ULONG)colSize; \ + _rgColumns[ulCols].wType = (DBTYPE)type; \ + _rgColumns[ulCols].bPrecision = (BYTE)precision; \ + _rgColumns[ulCols].bScale = (BYTE)scale; \ + _rgColumns[ulCols].cbOffset = offsetof(dataClass, member); \ + memset(&(_rgColumns[ulCols].columnid), 0, sizeof(DBID)); \ + _rgColumns[ulCols].columnid.uName.pwszName = (LPOLESTR)name; ``` In the `GetColumnInfo` function, the bookmark macro is used like this: From 813a7d8f14ca17e7db30260866fb8f4c9625b72e Mon Sep 17 00:00:00 2001 From: Rageking8 <106309953+Rageking8@users.noreply.github.com> Date: Wed, 23 Jul 2025 15:57:34 +0800 Subject: [PATCH 3/5] Remove unneeded spaces in "Dynamically Determining Columns Returned to the Consumer" --- ...mining-columns-returned-to-the-consumer.md | 28 +++++++++---------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/docs/data/oledb/dynamically-determining-columns-returned-to-the-consumer.md b/docs/data/oledb/dynamically-determining-columns-returned-to-the-consumer.md index 1dad936b13..5cf5dd2434 100644 --- a/docs/data/oledb/dynamically-determining-columns-returned-to-the-consumer.md +++ b/docs/data/oledb/dynamically-determining-columns-returned-to-the-consumer.md @@ -23,7 +23,7 @@ public: TCHAR szText[iSize]; TCHAR szCommand2[iSize]; TCHAR szText2[iSize]; - + static ATLCOLUMNINFO* GetColumnInfo(void* pThis, ULONG* pcCols); bool operator==(const CCustomWindowsFile& am) { @@ -45,27 +45,27 @@ ATLCOLUMNINFO* CCustomWindowsFile::GetColumnInfo(void* pThis, ULONG* pcCols) { static ATLCOLUMNINFO _rgColumns[5]; ULONG ulCols = 0; - + // Check the property flag for bookmarks; if it is set, set the zero // ordinal entry in the column map with the bookmark information. CCustomRowset* pRowset = (CCustomRowset*) pThis; CComQIPtr spRowsetProps = pRowset; - + CDBPropIDSet set(DBPROPSET_ROWSET); set.AddPropertyID(DBPROP_BOOKMARKS); DBPROPSET* pPropSet = NULL; ULONG ulPropSet = 0; HRESULT hr; - + if (spRowsetProps) hr = spRowsetProps->GetProperties(1, &set, &ulPropSet, &pPropSet); - + if (pPropSet) { CComVariant var = pPropSet->rgProperties[0].vValue; CoTaskMemFree(pPropSet->rgProperties); CoTaskMemFree(pPropSet); - + if (SUCCEEDED(hr) && (var.boolVal == VARIANT_TRUE)) { ADD_COLUMN_ENTRY_EX(ulCols, OLESTR("Bookmark"), 0, sizeof(DWORD), @@ -74,7 +74,7 @@ ATLCOLUMNINFO* CCustomWindowsFile::GetColumnInfo(void* pThis, ULONG* pcCols) ulCols++; } } - + // Next, set the other columns up. ADD_COLUMN_ENTRY(ulCols, OLESTR("Command"), 1, 256, DBTYPE_STR, 0xFF, 0xFF, GUID_NULL, CCustomWindowsFile, szCommand) @@ -82,17 +82,17 @@ ATLCOLUMNINFO* CCustomWindowsFile::GetColumnInfo(void* pThis, ULONG* pcCols) ADD_COLUMN_ENTRY(ulCols, OLESTR("Text"), 2, 256, DBTYPE_STR, 0xFF, 0xFF, GUID_NULL, CCustomWindowsFile, szText) ulCols++; - + ADD_COLUMN_ENTRY(ulCols, OLESTR("Command2"), 3, 256, DBTYPE_STR, 0xFF, 0xFF, GUID_NULL, CCustomWindowsFile, szCommand2) ulCols++; ADD_COLUMN_ENTRY(ulCols, OLESTR("Text2"), 4, 256, DBTYPE_STR, 0xFF, 0xFF, GUID_NULL, CCustomWindowsFile, szText2) ulCols++; - + if (pcCols != NULL) *pcCols = ulCols; - + return _rgColumns; } ``` @@ -100,9 +100,9 @@ ATLCOLUMNINFO* CCustomWindowsFile::GetColumnInfo(void* pThis, ULONG* pcCols) This example uses a static array to hold the column information. If the consumer doesn't want the bookmark column, one entry in the array is unused. To handle the information, you create two array macros: `ADD_COLUMN_ENTRY` and `ADD_COLUMN_ENTRY_EX`. `ADD_COLUMN_ENTRY_EX` takes an extra parameter, *`flags`*, that is needed if you designate a bookmark column. ```cpp -//////////////////////////////////////////////////////////////////////// -// CustomRS.h - +//////////////////////////////////////////////////////////////////////// +// CustomRS.h + #define ADD_COLUMN_ENTRY(ulCols, name, ordinal, colSize, type, precision, scale, guid, dataClass, member) \ _rgColumns[ulCols].pwszName = (LPOLESTR)name; \ _rgColumns[ulCols].pTypeInfo = (ITypeInfo*)NULL; \ @@ -113,7 +113,7 @@ This example uses a static array to hold the column information. If the consumer _rgColumns[ulCols].bPrecision = (BYTE)precision; \ _rgColumns[ulCols].bScale = (BYTE)scale; \ _rgColumns[ulCols].cbOffset = offsetof(dataClass, member); - + #define ADD_COLUMN_ENTRY_EX(ulCols, name, ordinal, colSize, type, precision, scale, guid, dataClass, member, flags) \ _rgColumns[ulCols].pwszName = (LPOLESTR)name; \ _rgColumns[ulCols].pTypeInfo = (ITypeInfo*)NULL; \ From b01130388d97049a383b125cb5cd387540bba2f4 Mon Sep 17 00:00:00 2001 From: Rageking8 <106309953+Rageking8@users.noreply.github.com> Date: Wed, 23 Jul 2025 15:59:09 +0800 Subject: [PATCH 4/5] Simplify redundant links and remove `br` element in "Dynamically Determining Columns Returned to the Consumer" --- ...ynamically-determining-columns-returned-to-the-consumer.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/data/oledb/dynamically-determining-columns-returned-to-the-consumer.md b/docs/data/oledb/dynamically-determining-columns-returned-to-the-consumer.md index 5cf5dd2434..1df579c68f 100644 --- a/docs/data/oledb/dynamically-determining-columns-returned-to-the-consumer.md +++ b/docs/data/oledb/dynamically-determining-columns-returned-to-the-consumer.md @@ -136,8 +136,8 @@ ADD_COLUMN_ENTRY_EX(ulCols, OLESTR("Bookmark"), 0, sizeof(DWORD), DBCOLUMNFLAGS_ISBOOKMARK) ``` -You can now compile and run the enhanced provider. To test the provider, modify the test consumer as described in [Implementing a Simple Consumer](../../data/oledb/implementing-a-simple-consumer.md). Run the test consumer with the provider and verify that the test consumer retrieves the proper strings from the provider. +You can now compile and run the enhanced provider. To test the provider, modify the test consumer as described in [Implementing a Simple Consumer](implementing-a-simple-consumer.md). Run the test consumer with the provider and verify that the test consumer retrieves the proper strings from the provider. ## See also -[Enhancing the Simple Read-Only Provider](../../data/oledb/enhancing-the-simple-read-only-provider.md)
+[Enhancing the Simple Read-Only Provider](enhancing-the-simple-read-only-provider.md) From 5fa0a6d64f68d6b2e24860d18a2ff4c701320662 Mon Sep 17 00:00:00 2001 From: Rageking8 <106309953+Rageking8@users.noreply.github.com> Date: Wed, 23 Jul 2025 16:03:25 +0800 Subject: [PATCH 5/5] Update metadata in "Dynamically Determining Columns Returned to the Consumer" --- ...namically-determining-columns-returned-to-the-consumer.md | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/docs/data/oledb/dynamically-determining-columns-returned-to-the-consumer.md b/docs/data/oledb/dynamically-determining-columns-returned-to-the-consumer.md index 1df579c68f..14175fae5e 100644 --- a/docs/data/oledb/dynamically-determining-columns-returned-to-the-consumer.md +++ b/docs/data/oledb/dynamically-determining-columns-returned-to-the-consumer.md @@ -1,9 +1,8 @@ --- -description: "Learn more about: Dynamically Determining Columns Returned to the Consumer" title: "Dynamically Determining Columns Returned to the Consumer" -ms.date: "10/26/2018" +description: "Learn more about: Dynamically Determining Columns Returned to the Consumer" +ms.date: 10/26/2018 helpviewer_keywords: ["bookmarks [C++], dynamically determining columns", "dynamically determining columns [C++]"] -ms.assetid: 58522b7a-894e-4b7d-a605-f80e900a7f5f --- # Dynamically Determining Columns Returned to the Consumer