블로그 이미지
fiadot_old

칼퇴근을 위한 게임 서버 개발 방법론에 대한 심도있는 고찰 및 성찰을 위한 블로그!

Rss feed Tistory
Technical Article/펌 2004. 7. 27. 12:30

Using Multiple Accessors on a Rowset

Using Multiple Accessors on a Rowset
This example uses multiple accessors to retrieve one set of data. An application might use multiple accessors to optimize data access. The rowset retrieves one block of data that can be used by multiple accessors. (The accessor is defined in OLE DB User Records.)

#include

CDataSource connection;
CSession session;
CTable > artists;

// Connect the database, session, and accessors
connection.Open(CLSID_MSDASQL, "NWind", "sa", "");
session.Open(connection);
artists.Open(session, "artists");

// Retrieve the data
while (artists.MoveNext() == S_OK)
{
cout << artists.m_szFirstName;
cout << artists.m_szLastName;
artists.GetData(1); // Retrieve data for other accessor
cout << artists.m_nAge;
}

The user record looks like this:

class CMultiArtists
{
public:
// Data Elements
CHAR m_szFirstName[20];
CHAR m_szLastName[30];
short m_nAge;

// output binding map
BEGIN_ACCESSOR_MAP(CMultiArtists, 2)
BEGIN_ACCESSOR(0, true)
COLUMN_ENTRY(1, m_szFirstName)
COLUMN_ENTRY(2, m_szLastName)
END_ACCESSOR(0)
BEGIN_ACCESSOR(1, false) // not an auto accessor
COLUMN_ENTRY(3, m_nAge)
END_ACCESSOR()
END_ACCESSOR_MAP()
};




OLEDB접근할때 ATL Consumer를 이용해서 멀티플 엑세서를 사용하는 방법이다. 스크립하고 잘만 연동시키면 view를 대체할수 있는 방법이 되지 않을까 싶다.
,
TOTAL TODAY