//--------------------------------------------------------------------
// Microsoft OLE DB Sample Provider
// (C) Copyright 1994 - 1996 Microsoft Corporation. All Rights Reserved.
//
// @doc
//
// @module DBSESS.H | CDBSession base object and contained interface
// definitions
//
//
#ifndef _DBSESS_H_
#define _DBSESS_H_
// Forward declarations ------------------------------------------------------
class CImpIGetDataSource;
class CImpIOpenRowset;
classCImpISessionProperties;
typedef CImpIGetDataSource*PIMPIGETDATASOURCE;
typedef CImpIOpenRowset*PIMPIOPENROWSET;
typedef CImpISessionProperties*PIMPISESSIONPROPERTIES;
// Classes -------------------------------------------------------------------
//----------------------------------------------------------------------------
// @class CDBSession | Containing class for all interfaces on the DBSession
// Object
//
class CDBSession : public IUnknown//@base public | IUnknown
{
// contained interfaces are friends
friend class CImpIGetDataSource;
friend class CImpIOpenRowset;
friend class CImpIDataSource;
friend class CImpISessionProperties;
protected: //@access protected
//@cmember Reference count
ULONGm_cRef;
//@cmember Controlling IUnknown
LPUNKNOWNm_pUnkOuter;
//@cmember Path Name
charm_szPath[MAX_PATH];
//@member flag is TRUE if Rowset has been created
BOOL m_fRowsetCreated;
//@member Utility object to manage properties
PCUTILPROP m_pUtilProp;
//@member contained IOpenRowset
PIMPIOPENROWSET m_pIOpenRowset;
//@member contained IGetDataSource
PIMPIGETDATASOURCEm_pIGetDataSource;
//@member contained ISessionProperties
PIMPISESSIONPROPERTIESm_pISessionProperties;
public: //@access public
//@cmember Constructor
CDBSession(LPUNKNOWN);
//@cmember Destructor
~CDBSession(void);
//@mcember parent data source object
PCDATASOURCEm_pCDataSource;
//@cmember Intitialization Routine
BOOL FInit( char* szPath, CDataSource*pCDataSource );
//Object's base IUnknown
//@cmember Request an Interface
STDMETHODIMPQueryInterface(REFIID, LPVOID *);
//@cmember Increments the Reference count
STDMETHODIMP_(ULONG)AddRef(void);
//@cmember Decrements the Reference count
STDMETHODIMP_(ULONG)Release(void);
inline void RowsetDestroyed() { m_fRowsetCreated = FALSE; };
};
typedef CDBSession *PCDBSESSION;
//----------------------------------------------------------------------------------------
// @class CImpIGetDataSource | contained IGetDataSource class
class CImpIGetDataSource : public IGetDataSource //@base public | IGetDataSource
{
private: //@access private
DEFINE_DEFAULT_IUNKNOWN_MEMBER_DATA(CDBSession)
public: //@access public
DEFINE_DEFAULT_IUNKNOWN_CTOR_DTOR(CDBSession, CImpIGetDataSource);
DEFINE_DEFAULT_IUNKNOWN_ADDREF_RELEASE
// IGetDataSource method
//@cmember GetDataSource
STDMETHODIMP GetDataSource( REFIID, IUnknown** );
};
//----------------------------------------------------------------------------------------
// @class CImpIOpenRowset | contained IOpenRowset class
class CImpIOpenRowset : public IOpenRowset //@base public | IOpenRowset
{
private: //@access private
DEFINE_DEFAULT_IUNKNOWN_MEMBER_DATA(CDBSession)
public: //@access public
DEFINE_DEFAULT_IUNKNOWN_CTOR_DTOR(CDBSession, CImpIOpenRowset);
DEFINE_DEFAULT_IUNKNOWN_ADDREF_RELEASE
// IOpenRowset method
//@cmember OpenRowset
STDMETHODIMP OpenRowset( IUnknown*, DBID*, DBID*, REFIID, ULONG, DBPROPSET[], IUnknown** );
};
//----------------------------------------------------------------------------
// @class CImpISessionProperties | Contained ISessionProperties class
//
class CImpISessionProperties : public ISessionProperties//@base public | ISessionProperties
{
private: //@access private
DEFINE_DEFAULT_IUNKNOWN_MEMBER_DATA(CDBSession)
public: //@access public
DEFINE_DEFAULT_IUNKNOWN_CTOR_DTOR(CDBSession, CImpISessionProperties);
DEFINE_DEFAULT_IUNKNOWN_ADDREF_RELEASE
//IDBProperties member functions
//@cmember GetProperties method
STDMETHODIMP GetProperties
(
ULONGcPropertySets,
const DBPROPIDSETrgPropertySets[],
ULONG* pcProperties,
DBPROPSET**prgProperties
);
//@cmember SetProperties method
STDMETHODIMPSetProperties
(
ULONGcProperties,
DBPROPSETrgProperties[]
);
};
#endif