UTILPROP.H

//-------------------------------------------------------------------- 
// Microsoft OLE DB Sample Provider
// (C) Copyright 1994 - 1996 Microsoft Corporation. All Rights Reserved.
//
// @doc
//
// @module UTILPROP.H | CUtilProp object definitions
//
//
#ifndef _UTILPROP_H_
#define _UTILPROP_H_


//----------- structs and #defines -------------------------------------------

// @struct PROPSTRUCT | simple table used to store property information. Used in
// our read-only implementation of IDBProperties::GetPropertyInfo and IRowsetInfo::GetProperties
typedef struct _tagPROPSTRUCT
{
DBPROPIDdwPropertyID;
DBPROPFLAGS dwFlags;
VARTYPE vtType;
BOOL boolVal;
SLONG longVal;
PWSTR pwstrVal;
PWSTRpwstrDescBuffer;
} PROPSTRUCT;

// flags for IDBProperties::GetPropertyInfo
#define FLAGS_ROWSETRO(DBPROPFLAGS_ROWSET | DBPROPFLAGS_READ)
#define FLAGS_ROWSETRW(DBPROPFLAGS_ROWSET | DBPROPFLAGS_READ | DBPROPFLAGS_WRITE)
#define FLAGS_DATASOURCE (DBPROPFLAGS_DATASOURCEINFO | DBPROPFLAGS_READ)
#define FLAGS_DBINITRW(DBPROPFLAGS_DBINIT | DBPROPFLAGS_READ | DBPROPFLAGS_WRITE)


// Classes -------------------------------------------------------------------

//----------------------------------------------------------------------------
// @class CUtilProp | Containing class for all interfaces on the UtilProp
// Object
//
class CUtilProp
{
protected: //@access protected
//@cmember Gets index of entry for a given property in global property table
BOOL GetPropIndex
(
DBPROPIDdwPropertyID,
ULONG*pulIndex
);

//@cmember Loads fields of DBPROPINFO struct. Helper for GetPropertyInfo
BOOL LoadDBPROPINFO
(
PROPSTRUCT*pPropStruct,
DBPROPINFO*pPropInfo
);

//@cmember Loads fields of DBPROP struct. Helper for GetProperties
BOOL LoadDBPROP
(
PROPSTRUCT*pPropStruct,
DBPROP*pPropSupport
);

public: //@access public
//@cmember Constructor
CUtilProp(void);
//@cmember Destructor
~CUtilProp(void);

STDMETHODIMP GetProperties
(
ULONGcPropertySets,
const DBPROPIDSETrgPropertySets[],
ULONG* pcProperties,
DBPROPSET**prgProperties
);

STDMETHODIMP GetPropertyInfo
(
ULONGcPropertySets,
const DBPROPIDSETrgPropertySets[],
ULONG*pcPropertyInfoSets,
DBPROPINFOSET**prgPropertyInfoSets,
WCHAR**ppDescBuffer
);

STDMETHODIMP CUtilProp::SetProperties
(
ULONGcProperties,
DBPROPSETrgProperties[]
);

};

typedef CUtilProp *PCUTILPROP;

#endif