ATLMTO: Dynamically Acquires Column Definitions

Click to open or copy the ATLMTO project files.

The ATLMTO sample demonstrates a provider that dynamically acquires its column definitions (meta data). Its purpose is to enable two-tier clients to operate in a three-tier environment. The provider does so by delegating its work to a COM object that either resides on the local machine or at a location accessible by DCOM. The provider then receives a special cookie from the COM object (third-tier) that contains connection information and column meta data. Once the provider acquires the meta data, it calls through a dual interface to acquire a BSTR representation of the rowset data. With the stream (BSTR) of data and the column meta data, the provider is capable of carrying on a two-tier OLE DB conversation with an OLE DB template consumer or with an ADO client.

This provider will override the following: GetColumnInfo of its user record (CRemoteRecord), and the ArrayType parameter of IRowsetImpl. Further, it demonstrates the process of holding column data in a CSimpleArray<ATLCOLUMNINFO> to enable dynamic determination of the column meta data.

The provider can only work with COM objects that support a special "hidden" BSTR on their callable methods and that expose the IMTOData interface. A sample consumer called TestMTO, a COM object that supports the needed interface and parameter, is included as subproject of the ATLMTO sample.

Building and Running the Sample