Skip to content

Commit b60ed4c

Browse files
author
msebolt
committed
initial formatting
1 parent b109e8c commit b60ed4c

12 files changed

+48
-55
lines changed

docs/data/oledb/creating-a-project-for-the-provider.md

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
title: "Creating a Project for the Provider | Microsoft Docs"
33
ms.custom: ""
4-
ms.date: "11/04/2016"
4+
ms.date: "10/22/2018"
55
ms.technology: ["cpp-data"]
66
ms.topic: "reference"
77
dev_langs: ["C++"]
@@ -19,7 +19,10 @@ ms.workload: ["cplusplus", "data-storage"]
1919

2020
The **New Project** dialog box appears.
2121

22-
1. In the **Project Types** pane, click the **Visual C++ Projects** folder. In the **Templates** pane, click **ATL Project**.
22+
1. In the **Project Types** pane, click the **Installed** > **Visual C++** > **MFC/ATL** folder. In the **Templates** pane, click **ATL Project**.
23+
24+
> [!NOTE]
25+
> In previous versions of Visual Studio, find the project type under **Installed** > **Templates** > **Visual C++** > **ATL**.
2326
2427
1. In the **Name** box, enter a name for the project, and then click **OK**.
2528

docs/data/oledb/creating-an-updatable-provider.md

Lines changed: 12 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ This topic assumes that you are starting with a workable provider. There are two
2020
Next, you must make sure your provider contains all the functionality to support anything the consumer might request of it. If the consumer wants to update the data store, the provider has to contain code that persists data to the data store. For example, you might use the C Run-Time Library or MFC to perform such operations on your data source. The section "[Writing to the Data Source](#vchowwritingtothedatasource)" describes how to write to the data source, deal with NULL and default values, and set column flags.
2121

2222
> [!NOTE]
23-
> [UpdatePV](https://github.com/Microsoft/VCSamples/tree/master/VC2010Samples/ATL/OLEDB/Provider/UPDATEPV) is an example of an updatable provider. UpdatePV is the same as MyProv but with updatable support.
23+
> [UpdatePV](https://github.com/Microsoft/VCSamples/tree/master/VC2010Samples/ATL/OLEDB/Provider/UPDATEPV) is an example of an updatable provider. UpdatePV is the same as MyProv but with updatable support.
2424
2525
## <a name="vchowmakingprovidersupdatable"></a> Making Providers Updatable
2626

@@ -34,7 +34,7 @@ You must first decide whether to inherit from `IRowsetChangeImpl` or `IRowsetUpd
3434

3535
Note that `IRowsetUpdateImpl` derives from `IRowsetChangeImpl`. Thus, `IRowsetUpdateImpl` gives you change capability plus batch capability.
3636

37-
#### To support updatability in your provider
37+
### To support updatability in your provider
3838

3939
1. In your rowset class, inherit from `IRowsetChangeImpl` or `IRowsetUpdateImpl`. These classes provide appropriate interfaces for changing the data store:
4040

@@ -57,7 +57,7 @@ Note that `IRowsetUpdateImpl` derives from `IRowsetChangeImpl`. Thus, `IRowsetUp
5757
```
5858

5959
> [!NOTE]
60-
> You should remove the `IRowsetChangeImpl` line from your inheritance chain. This one exception to the directive previously mentioned must include the code for `IRowsetChangeImpl`.
60+
> You should remove the `IRowsetChangeImpl` line from your inheritance chain. This one exception to the directive previously mentioned must include the code for `IRowsetChangeImpl`.
6161

6262
1. Add the following to your COM map (`BEGIN_COM_MAP ... END_COM_MAP`):
6363

@@ -96,7 +96,7 @@ Note that `IRowsetUpdateImpl` derives from `IRowsetChangeImpl`. Thus, `IRowsetUp
9696
You can find the values used in these macro calls by looking in Atldb.h for the property IDs and values (if Atldb.h differs from the online documentation, Atldb.h supersedes the documentation).
9797

9898
> [!NOTE]
99-
> Many of the `VARIANT_FALSE` and `VARIANT_TRUE` settings are required by the OLE DB templates; the OLE DB specification says they can be read/write, but the OLE DB templates can only support one value.
99+
> Many of the `VARIANT_FALSE` and `VARIANT_TRUE` settings are required by the OLE DB templates; the OLE DB specification says they can be read/write, but the OLE DB templates can only support one value.
100100

101101
**If you implement IRowsetChangeImpl**
102102

@@ -129,16 +129,14 @@ Note that `IRowsetUpdateImpl` derives from `IRowsetChangeImpl`. Thus, `IRowsetUp
129129
- `DBPROP_MAXPENDINGROWS`.
130130

131131
> [!NOTE]
132-
> If you support notifications, you might also have some other properties as well; see the section on `IRowsetNotifyCP` for this list.
132+
> If you support notifications, you might also have some other properties as well; see the section on `IRowsetNotifyCP` for this list.
133133

134134
## <a name="vchowwritingtothedatasource"></a> Writing to the Data Source
135135

136136
To read from the data source, call the `Execute` function. To write to the data source, call the `FlushData` function. (In a general sense, flush means to save modifications you make to a table or index to disk.)
137137

138138
```cpp
139-
140139
FlushData(HROW, HACCESSOR);
141-
142140
```
143141
144142
The row handle (HROW) and accessor handle (HACCESSOR) arguments allow you to specify the region to write. Typically, you write a single data field at a time.
@@ -179,7 +177,7 @@ Handling NULL values.
179177
180178
### Handling default values.
181179
182-
To implement your own FlushData method, you need to:
180+
To implement your own `FlushData` method, you need to:
183181
184182
- Go to your rowset class.
185183
@@ -194,7 +192,7 @@ To implement your own FlushData method, you need to:
194192

195193
- Provide an implementation of `FlushData`.
196194

197-
A good implementation of FlushData stores only the rows and columns that are actually updated. You can use the HROW and HACCESSOR parameters to determine the current row and column being stored for optimization.
195+
A good implementation of `FlushData` stores only the rows and columns that are actually updated. You can use the HROW and HACCESSOR parameters to determine the current row and column being stored for optimization.
198196

199197
Typically, the biggest challenge is working with your own native data store. If possible, try to:
200198

@@ -206,7 +204,7 @@ Typically, the biggest challenge is working with your own native data store. If
206204

207205
The best thing to do is to have actual specified values in your data store for NULL and default values. It is best if you can extrapolate this data. If not, you are advised not to allow NULL and default values.
208206

209-
The following example shows how `FlushData` is implemented in the RUpdateRowset class in the UpdatePV sample (see Rowset.h in the sample code):
207+
The following example shows how `FlushData` is implemented in the `RUpdateRowset` class in the `UpdatePV` sample (see Rowset.h in the sample code):
210208

211209
```cpp
212210
///////////////////////////////////////////////////////////////////////////
@@ -361,16 +359,15 @@ ATLCOLUMNINFO* CommonGetColInfo(IUnknown* pPropsUnk, ULONG* pcCols, bool bBookma
361359
362360
return _rgColumns;
363361
}
364-
365362
```
366363

367364
### Default Values
368365

369366
As with NULL data, you have the responsibility to deal with changing default values.
370367

371-
The default of FlushData and Execute is to return S_OK. Therefore, if you do not override this function, the changes appear to succeed (S_OK will be returned), but they will not be transmitted to the data store.
368+
The default of `FlushData` and `Execute` is to return S_OK. Therefore, if you do not override this function, the changes appear to succeed (S_OK will be returned), but they will not be transmitted to the data store.
372369

373-
In the UpdatePV sample (in Rowset.h), the `SetDBStatus` method handles default values as follows:
370+
In the `UpdatePV` sample (in Rowset.h), the `SetDBStatus` method handles default values as follows:
374371

375372
```cpp
376373
virtual HRESULT SetDBStatus(DBSTATUS* pdbStatus, CSimpleRow* pRow,
@@ -409,11 +406,11 @@ virtual HRESULT SetDBStatus(DBSTATUS* pdbStatus, CSimpleRow* pRow,
409406
410407
### Column Flags
411408
412-
If you support default values on your columns, you need to set it using metadata in the \<provider class\>SchemaRowset class. Set `m_bColumnHasDefault` = VARIANT_TRUE.
409+
If you support default values on your columns, you need to set it using metadata in the \<provider class\>SchemaRowset class. Set `m_bColumnHasDefault = VARIANT_TRUE`.
413410
414411
You also have the responsibility to set the column flags, which are specified using the DBCOLUMNFLAGS enumerated type. The column flags describe column characteristics.
415412
416-
For example, in the `CUpdateSessionColSchemaRowset` class in UpdatePV (in Session.h), the first column is set up this way:
413+
For example, in the `CUpdateSessionColSchemaRowset` class in `UpdatePV` (in Session.h), the first column is set up this way:
417414
418415
```cpp
419416
// Set up column 1

docs/data/oledb/debugging-your-provider.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ There are two ways to debug your provider:
1919

2020
- You can use the ITEST utility that comes with Visual C++.
2121

22-
### To use the ITEST utility
22+
## To use the ITEST utility
2323

2424
1. Open the provider project.
2525

docs/data/oledb/dynamically-binding-columns-in-your-provider.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ Make sure you really need dynamic column binding. You might need it because:
1919

2020
- You support an element such as bookmarks that adds columns.
2121

22-
### To implement dynamic column binding
22+
## To implement dynamic column binding
2323

2424
1. Remove any `PROVIDER_COLUMN_MAP`s from your code.
2525

docs/data/oledb/dynamically-determining-columns-returned-to-the-consumer.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,11 @@ ms.workload: ["cplusplus", "data-storage"]
1515

1616
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.
1717

18-
To handle the `IColumnsInfo::GetColumnsInfo` call, delete the PROVIDER_COLUMN_MAP, which defines a function `GetColumnInfo`, from the `CAgentMan` user record in MyProviderRS.h and replace it with the definition for your own `GetColumnInfo` function:
18+
To handle the `IColumnsInfo::GetColumnsInfo` call, delete the PROVIDER_COLUMN_MAP, which defines a function `GetColumnInfo`, from the `CAgentMan` user record in *Custom*RS.h and replace it with the definition for your own `GetColumnInfo` function:
1919

2020
```cpp
2121
////////////////////////////////////////////////////////////////////////
22-
// MyProviderRS.H
22+
// CustomRS.H
2323
class CAgentMan
2424
{
2525
public:
@@ -40,13 +40,13 @@ public:
4040

4141
Next, implement the `GetColumnInfo` function in MyProviderRS.cpp, as shown in the following code.
4242

43-
`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 `RMyProviderRowset` pointer.
43+
`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.
4444

4545
To check for the `DBPROP_BOOKMARKS` property, `GetColumnInfo` uses the `IRowsetInfo` interface, which you can obtain by calling `QueryInterface` on the `pRowset` interface. As an alternative, you can use an ATL [CComQIPtr](../../atl/reference/ccomqiptr-class.md) method instead.
4646

4747
```cpp
4848
////////////////////////////////////////////////////////////////////
49-
// MyProviderRS.cpp
49+
// CustomRS.cpp
5050
ATLCOLUMNINFO* CAgentMan::GetColumnInfo(void* pThis, ULONG* pcCols)
5151
{
5252
static ATLCOLUMNINFO _rgColumns[5];
@@ -107,7 +107,7 @@ This example uses a static array to contain the column information. If the consu
107107
108108
```cpp
109109
////////////////////////////////////////////////////////////////////////
110-
// MyProviderRS.h
110+
// CustomRS.h
111111
112112
#define ADD_COLUMN_ENTRY(ulCols, name, ordinal, colSize, type, precision, scale, guid, dataClass, member) \
113113
_rgColumns[ulCols].pwszName = (LPOLESTR)name; \

docs/data/oledb/modifying-the-inheritance-of-rmyproviderrowset.md

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,25 @@
11
---
2-
title: "Modifying the Inheritance of RMyProviderRowset | Microsoft Docs"
2+
title: "Modifying the Inheritance of RCustomRowset | Microsoft Docs"
33
ms.custom: ""
44
ms.date: "11/04/2016"
55
ms.technology: ["cpp-data"]
66
ms.topic: "reference"
77
dev_langs: ["C++"]
8-
helpviewer_keywords: ["RMyProviderRowset", "inheritance [C++]"]
8+
helpviewer_keywords: ["RMyProviderRowset", "inheritance [C++]", "RCustomRowset"]
99
ms.assetid: 33089c90-98a4-43e7-8e67-d4bb137e267e
1010
author: "mikeblome"
1111
ms.author: "mblome"
1212
ms.workload: ["cplusplus", "data-storage"]
1313
---
14-
# Modifying the Inheritance of RMyProviderRowset
14+
# Modifying the Inheritance of RCustomRowset
1515

16-
To add the `IRowsetLocate` interface to the simple read-only provider example, modify the inheritance of `RMyProviderRowset`. Initially, `RMyProviderRowset` inherits from `CRowsetImpl`. You need to modify it to inherit from `CRowsetBaseImpl`.
16+
To add the `IRowsetLocate` interface to the simple read-only provider example, modify the inheritance of `RCustomRowset`. Initially, `RCustomRowset` inherits from `CRowsetImpl`. You need to modify it to inherit from `CRowsetBaseImpl`.
1717

18-
To do this, create a new class, `CMyRowsetImpl`, in MyProviderRS.h:
18+
To do this, create a new class, `CMyRowsetImpl`, in *Custom*RS.h:
1919

2020
```cpp
2121
////////////////////////////////////////////////////////////////////////
22-
// MyProviderRS.h
22+
// CustomRS.h
2323

2424
template <class T, class Storage, class CreatorClass, class ArrayType = CAtlArray<Storage>>
2525
class CMyRowsetImpl:
@@ -29,7 +29,7 @@ class CMyRowsetImpl:
2929
};
3030
```
3131

32-
Now, edit the COM interface map in MyProviderRS.h to be as follows:
32+
Now, edit the COM interface map in *Custom*RS.h to be as follows:
3333

3434
```cpp
3535
BEGIN_COM_MAP(CMyRowsetImpl)
@@ -43,7 +43,7 @@ This creates a COM interface map that tells `CMyRowsetImpl` to call `QueryInterf
4343
Finally, link `RAgentRowset` to `CMyRowsetBaseImpl` by modifying `RAgentRowset` to inherit from `CMyRowsetImpl`, as follows:
4444
4545
```cpp
46-
class RAgentRowset : public CMyRowsetImpl<RAgentRowset, CAgentMan, CMyProviderCommand>
46+
class RAgentRowset : public CMyRowsetImpl<RAgentRowset, CAgentMan, CCustomCommand>
4747
```
4848

4949
`RAgentRowset` can now use the `IRowsetLocate` interface while taking advantage of the rest of the implementation for the rowset class.

docs/data/oledb/reading-strings-into-the-ole-db-provider.md

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -13,22 +13,18 @@ ms.workload: ["cplusplus", "data-storage"]
1313
---
1414
# Reading Strings into the OLE DB Provider
1515

16-
The `RMyProviderRowset::Execute` function opens a file and reads strings. The consumer passes the file name to the provider by calling [ICommandText::SetCommandText](/previous-versions/windows/desktop/ms709757). The provider receives the file name and stores it in the member variable `m_szCommandText`. `Execute` reads the file name from `m_szCommandText`. If the file name is invalid or the file is unavailable, `Execute` returns an error. Otherwise, it opens the file and calls `fgets` to retrieve the strings. For each set of strings it reads, `Execute` creates an instance of the user record (`CAgentMan`) and places it into an array.
16+
The `RCustomRowset::Execute` function opens a file and reads strings. The consumer passes the file name to the provider by calling [ICommandText::SetCommandText](/previous-versions/windows/desktop/ms709757). The provider receives the file name and stores it in the member variable `m_szCommandText`. `Execute` reads the file name from `m_szCommandText`. If the file name is invalid or the file is unavailable, `Execute` returns an error. Otherwise, it opens the file and calls `fgets` to retrieve the strings. For each set of strings it reads, `Execute` creates an instance of the user record (`CAgentMan`) and places it into an array.
1717

1818
If the file cannot be opened, `Execute` must return DB_E_NOTABLE. If it returns E_FAIL instead, the provider will not work with many consumers and will not pass the OLE DB [conformance tests](../../data/oledb/testing-your-provider.md).
1919

2020
## Example
21-
22-
### Description
2321

2422
The edited `Execute` function looks like this:
2523

26-
### Code
27-
2824
```cpp
2925
/////////////////////////////////////////////////////////////////////////
30-
// MyProviderRS.h
31-
class RMyProviderRowset : public CRowsetImpl< RMyProviderRowset, CAgentMan, CRMyProviderCommand>
26+
// CustomRS.h
27+
class RCustomRowset : public CRowsetImpl< RCustomRowset, CAgentMan, CRCustomCommand>
3228
{
3329
public:
3430
HRESULT Execute(DBPARAMS * pParams, LONG* pcRowsAffected)

docs/data/oledb/referencing-a-property-in-your-provider.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,6 @@ HRESULT hr;
5151
if (spRowsetProps)
5252
hr = spRowsetProps->GetProperties(1, &set, &ulPropSet, &pPropSet);
5353

54-
5554
if (pPropSet)
5655
{
5756
CComVariant var = pPropSet->rgProperties[0].vValue;

docs/data/oledb/supporting-notifications.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ Note that you must also implement and register `IRowsetNotify` on the consumer (
2323

2424
In addition, the class must also contain a map that defines the connection point entry, like this:
2525

26-
```
26+
```cpp
2727
BEGIN_CONNECTION_POINT_MAP
2828
CONNECTIONPOINT_ENTRY (IID_IRowsetNotify)
2929
END_CONNECTION_POINT_MAP
@@ -36,7 +36,7 @@ To add `IRowsetNotify`, you need to add `IConnectionPointContainerImpl<rowset-na
3636
For example, here is the inheritance chain for `RUpdateRowset` in [UpdatePV](https://github.com/Microsoft/VCSamples/tree/master/VC2010Samples/ATL/OLEDB/Provider/UPDATEPV):
3737
3838
> [!NOTE]
39-
> The sample code might differ from what is listed here; you should regard the sample code as the more up-to-date version.
39+
> The sample code might differ from what is listed here; you should regard the sample code as the more up-to-date version.
4040
4141
```cpp
4242
///////////////////////////////////////////////////////////////////////////
@@ -55,7 +55,7 @@ public CRowsetImpl< RUpdateRowset, CAgentMan, CUpdateCommand,
5555

5656
You also need to add the following to the COM map in your rowset:
5757

58-
```
58+
```cpp
5959
COM_INTERFACE_ENTRY(IConnectionPointContainer)
6060
COM_INTERFACE_ENTRY_IMPL(IConnectionPointContainer)
6161
```
@@ -66,7 +66,7 @@ These macros allow anyone calling `QueryInterface` for your connection point con
6666
6767
You also need to add a connection point map. It should look something like:
6868
69-
```
69+
```cpp
7070
BEGIN_CONNECTION_POINT_MAP(rowset-name)
7171
CONNECTION_POINT_ENTRY(_uuidof(IRowsetNotify))
7272
END_CONNECTION_POINT_MAP()

0 commit comments

Comments
 (0)