Skip to content

Commit e30a243

Browse files
author
msebolt
committed
file upates and removal of ltm.exe
1 parent ddf7341 commit e30a243

4 files changed

Lines changed: 69 additions & 67 deletions

File tree

docs/data/oledb/fetching-data.md

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
title: "Fetching Data | Microsoft Docs"
33
ms.custom: ""
4-
ms.date: "11/04/2016"
4+
ms.date: "10/19/2018"
55
ms.technology: ["cpp-data"]
66
ms.topic: "reference"
77
dev_langs: ["C++"]
@@ -13,13 +13,13 @@ ms.workload: ["cplusplus", "data-storage"]
1313
---
1414
# Fetching Data
1515

16-
After you open the data source, session, and rowset objects, you can fetch data. Depending on the type of accessor you are using, you might need to bind columns.
16+
After you open the data source, session, and rowset objects, you can fetch data. Depending on the type of accessor you're using, you might need to bind columns.
1717

18-
### To fetch data
18+
## To fetch data
1919

2020
1. Open the rowset using the appropriate **Open** command.
2121

22-
1. If you are using `CManualAccessor`, bind the output columns if you have not already done so. To bind the columns, call `GetColumnInfo`, and then create an accessor with the bindings, as shown in the following example:
22+
1. If you're using `CManualAccessor`, bind the output columns if you haven't already done so. The following example is taken from the [DBViewer](https://github.com/Microsoft/VCSamples/tree/master/VC2008Samples/ATL/OLEDB/Consumer/dbviewer) sample. To bind the columns, call `GetColumnInfo`, and then create an accessor with the bindings, as shown in the following example:
2323

2424
```cpp
2525
// From the DBViewer Sample CDBTreeView::OnQueryEdit
@@ -36,7 +36,7 @@ After you open the data source, session, and rowset objects, you can fetch data.
3636
rs.Bind();
3737
```
3838

39-
1. Write a `while` loop to retrieve the data. In the loop, call `MoveNext` to advance the cursor and test the return value against S_OK, as shown in the following example:
39+
1. Write a **while** loop to retrieve the data. In the loop, call `MoveNext` to advance the cursor and test the return value against S_OK, as shown in the following example:
4040

4141
```cpp
4242
while (rs.MoveNext() == S_OK)
@@ -46,7 +46,7 @@ After you open the data source, session, and rowset objects, you can fetch data.
4646
}
4747
```
4848

49-
1. Within the `while` loop, you can fetch the data according to your accessor type.
49+
1. Within the **while** loop, you can fetch the data according to your accessor type.
5050

5151
- If you use the [CAccessor](../../data/oledb/caccessor-class.md) class, you should have a user record that contains data members. You can access your data using those data members, as shown in the following example:
5252

@@ -60,7 +60,7 @@ After you open the data source, session, and rowset objects, you can fetch data.
6060
}
6161
```
6262

63-
- If you use the `CDynamicAccessor` or `CDynamicParameterAccessor` class, you can fetch data by using the accessing functions `GetValue` and `GetColumn`, as shown in the following example. If you want to determine the type of data you are using, use `GetType`.
63+
- If you use the `CDynamicAccessor` or `CDynamicParameterAccessor` class, you can fetch data by using the accessing functions `GetValue` and `GetColumn`, as shown in the following example. If you want to determine the type of data you're using, use `GetType`.
6464

6565
```cpp
6666
while (rs.MoveNext() == S_OK)
@@ -87,6 +87,6 @@ After you open the data source, session, and rowset objects, you can fetch data.
8787
}
8888
```
8989

90-
## See Also
90+
## See also
9191

9292
[Working with OLE DB Consumer Templates](../../data/oledb/working-with-ole-db-consumer-templates.md)

docs/data/oledb/issuing-a-parameterized-query.md

Lines changed: 29 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
title: "Issuing a Parameterized Query | Microsoft Docs"
33
ms.custom: ""
4-
ms.date: "11/04/2016"
4+
ms.date: "10/19/2018"
55
ms.technology: ["cpp-data"]
66
ms.topic: "reference"
77
dev_langs: ["C++"]
@@ -17,31 +17,41 @@ The following example issues a simple parameterized query that retrieves records
1717

1818
```cpp
1919
#include <atldbcli.h>
20+
#include <iostream>
21+
22+
using namespace std;
23+
24+
int main()
25+
{
26+
CDataSource connection;
27+
CSession session;
28+
CCommand<CAccessor<CArtists>> artists;
29+
LPCSTR clsid; // Initialize CLSID_MSDASQL here
30+
LPCTSTR pName = L"NWind";
2031

21-
CDataSource connection;
22-
CSession session;
23-
CCommand<CAccessor<CArtists>> artists;
24-
25-
// Open the connection, session, and table, specifying authentication
26-
// using Windows NT integrated security. Hard-coding a password is a major
27-
// security weakness.
28-
connection.Open(CLSID_MSDASQL, "NWind", NULL, NULL, DBPROP_AUTH_INTEGRATED);
32+
// Open the connection, session, and table, specifying authentication
33+
// using Windows NT integrated security. Hard-coding a password is a major
34+
// security weakness.
35+
connection.Open(clsid, pName, NULL, NULL, DBPROP_AUTH_INTEGRATED);
2936

30-
session.Open(connection);
37+
session.Open(connection);
3138

32-
// Set the parameter for the query
33-
artists.m_nAge = 30;
34-
artists.Open(session, "select * from artists where age > ?");
39+
// Set the parameter for the query
40+
artists.m_nAge = 30;
41+
artists.Open(session, "select * from artists where age > ?");
3542

36-
// Get data from the rowset
37-
while (artists.MoveNext() == S_OK)
38-
{
39-
cout << artists.m_szFirstName;
40-
cout << artists.m_szLastName;
43+
// Get data from the rowset
44+
while (artists.MoveNext() == S_OK)
45+
{
46+
cout << artists.m_szFirstName;
47+
cout << artists.m_szLastName;
48+
}
49+
50+
return 0;
4151
}
4252
```
4353

44-
The user record, `CArtists`, looks like this:
54+
The user record, `CArtists`, looks like the following:
4555

4656
```cpp
4757
class CArtists

docs/data/oledb/passing-ole-db-conformance-tests.md

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -50,26 +50,6 @@ The code first checks to see whether the property is linked to another. If the p
5050
5151
You might also want to add the `IsValidValue` routine to your code. The templates call `IsValidValue` when attempting to set a property. You would override this method if you require additional processing when setting a property value. You can have one of these methods for each property set.
5252
53-
## Threading Issues
54-
55-
By default, the OLE DB Provider Wizard in the ATL OLE DB Provider Wizard generates code for the provider to run in an apartment model. If you attempt to run this code with the conformance tests, you initially get failures. This is because Ltm.exe, the tool used to run the OLE DB conformance tests, defaults to free threaded. The OLE DB Provider Wizard code defaults to apartment model for performance and ease of use.
56-
57-
To correct this problem, you can either change LTM or change the provider.
58-
59-
### To change LTM to run in apartment threaded mode
60-
61-
1. On the LTM main menu, click **Tools**, and then click **Options**.
62-
63-
1. On the **General** tab, change the threading model from **Free Threaded** to **Apartment Threaded**.
64-
65-
To change your provider to run in free threaded mode:
66-
67-
- In your provider project, search for all instances of `CComSingleThreadModel` and replace it with `CComMultiThreadModel`, which should be in your data source, session, and rowset headers.
68-
69-
- In your .rgs file, change the threading model from **Apartment** to **Both**.
70-
71-
- Follow correct programming rules for free threaded programming (that is, lock on writes).
72-
7353
## See Also
7454
7555
[Advanced Provider Techniques](../../data/oledb/advanced-provider-techniques.md)

docs/data/oledb/traversing-a-simple-rowset.md

Lines changed: 32 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
title: "Traversing a Simple Rowset | Microsoft Docs"
33
ms.custom: ""
4-
ms.date: "11/04/2016"
4+
ms.date: "10/19/2018"
55
ms.technology: ["cpp-data"]
66
ms.topic: "reference"
77
dev_langs: ["C++"]
@@ -13,33 +13,44 @@ ms.workload: ["cplusplus", "data-storage"]
1313
---
1414
# Traversing a Simple Rowset
1515

16-
The following example shows a quick and easy database access that does not involve commands. The following consumer code, in an ATL project, retrieves records from a table called *Artists* in a Microsoft Access database using the Microsoft OLE DB Provider for ODBC. The code creates a [CTable](../../data/oledb/ctable-class.md) table object with an accessor based on the user record class `CArtists`. It opens a connection, opens a session on the connection, and opens the table on the session.
16+
The following example shows quick and easy database access that doesn't involve commands. The following consumer code, in an ATL project, retrieves records from a table called *Artists* in a Microsoft Access database using the Microsoft OLE DB Provider for ODBC. The code creates a [CTable](../../data/oledb/ctable-class.md) table object with an accessor based on the user record class `CArtists`. It opens a connection, opens a session on the connection, and opens the table on the session.
1717

1818
```cpp
1919
#include <atldbcli.h>
20-
21-
CDataSource connection;
22-
CSession session;
23-
CTable<CAccessor<CArtists>> artists;
24-
25-
// Open the connection, session, and table, specifying authentication
26-
// using Windows NT integrated security. Hard-coding a password is a major
27-
// security weakness.
28-
connection.Open(CLSID_MSDASQL, "NWind", NULL, NULL, DBPROP_AUTH_INTEGRATED);
20+
#include <iostream>
21+
22+
using namespace std;
23+
24+
int main()
25+
{
26+
CDataSource connection;
27+
CSession session;
28+
CTable<CAccessor<CArtists>> artists;
29+
30+
LPCSTR clsid; // Initialize CLSID_MSDASQL here
31+
LPCTSTR pName = L"NWind";
2932

30-
session.Open(connection);
33+
// Open the connection, session, and table, specifying authentication
34+
// using Windows NT integrated security. Hard-coding a password is a major
35+
// security weakness.
36+
connection.Open(clsid, pName, NULL, NULL, DBPROP_AUTH_INTEGRATED);
3137

32-
artists.Open(session, "Artists");
38+
session.Open(connection);
39+
40+
artists.Open(session, "Artists");
3341

34-
// Get data from the rowset
35-
while (artists.MoveNext() == S_OK)
36-
{
37-
cout << artists.m_szFirstName;
38-
cout << artists.m_szLastName;
39-
}
42+
// Get data from the rowset
43+
while (artists.MoveNext() == S_OK)
44+
{
45+
cout << artists.m_szFirstName;
46+
cout << artists.m_szLastName;
47+
}
48+
49+
return 0;
50+
}
4051
```
4152

42-
The user record, `CArtists`, looks like this:
53+
The user record, `CArtists`, looks like the following:
4354

4455
```cpp
4556
class CArtists
@@ -56,6 +67,7 @@ BEGIN_COLUMN_MAP(CArtists)
5667
COLUMN_ENTRY(2, m_szLastName)
5768
COLUMN_ENTRY(3, m_nAge)
5869
END_COLUMN_MAP()
70+
};
5971
```
6072
6173
## See Also

0 commit comments

Comments
 (0)