DBPROP.CPP

//-------------------------------------------------------------------- 
// Microsoft OLE DB Sample Provider
// (C) Copyright 1994 - 1996 Microsoft Corporation. All Rights Reserved.
//
// @doc
//
// @module DBPROP.CPP | IDBProperties and IDBInfo interface implementations
//
//

// Includes ------------------------------------------------------------------
#include "headers.h"

// Code ----------------------------------------------------------------------

// IDBInfo specific interface methods
// CImpIDBInfo::GetKeywords --------------------------------------------
//
// @mfunc Returns information about keywords used in text commands
//
// @rdesc HRESULT
// @flag E_INVALIDARG | ppwszKeywords was NULL
// @flag E_NOTIMPL| this method is not implemented
//
STDMETHODIMP CImpIDBInfo::GetKeywords
(
LPWSTR*ppwszKeywords
)
{
// check params
if (NULL == ppwszKeywords)
return ResultFromScode( E_INVALIDARG );

// we don't implement this method, fail gracefully
*ppwszKeywords= NULL;

return ResultFromScode( E_NOTIMPL );
}

// CImpIDBInfo::GetLiteralInfo -----------------------------------------
//
// @mfunc Returns information about literals used in text command
//
// @rdesc HRESULT
// @flag E_INVALIDARG | cLiterals not equal to 9 and rgLiterals was NULL or
//| pcLiteralInfo, prgLiteralInfo, or ppCharBuffer was NULL
// @flag E_NOTIMPL| this method is not implemented
//
STDMETHODIMP CImpIDBInfo::GetLiteralInfo
(
ULONG cLiterals, //@parm IN | Number of literals being asked about
const DBLITERAL rgLiterals[], //@parm IN | Array of literals about which to return
// information
ULONG* pcLiteralInfo, //@parm OUT | Number of literals for which info is
// returned
DBLITERALINFO** prgLiteralInfo, //@parm OUT | Array of info structures
WCHAR** ppCharBuffer //@parm OUT | Buffer for characters
)
{
// check params
if ((cLiterals != 0) && (rgLiterals == NULL))
return ResultFromScode( E_INVALIDARG );

if (!pcLiteralInfo || !prgLiteralInfo || !ppCharBuffer)
return ResultFromScode( E_INVALIDARG );

// we don't implement this method, fail gracefully
*pcLiteralInfo = 0;
*prgLiteralInfo = NULL;
*ppCharBuffer = NULL;

return ResultFromScode( E_NOTIMPL );
}



// IDBProperties specific interface methods

// CImpIDBProperties::GetPropertyInfo -----------------------------------------
//
// @mfunc Returns information about rowset and data source properties supported
// by the provider
//
// @rdesc HRESULT
// @flag S_OK | The method succeeded
// @flag E_INVALIDARG | pcPropertyInfo or prgPropertyInfo was NULL
// @flag E_OUTOFMEMORY | Out of memory
//
STDMETHODIMP CImpIDBProperties::GetPropertyInfo
(
ULONGcPropertySets,//@parm IN | Number of properties being asked about
const DBPROPIDSETrgPropertySets[],//@parm IN | Array of cPropertySets properties about
// which to return information
ULONG*pcPropertyInfoSets,//@parm OUT | Number of properties for which information
// is being returned
DBPROPINFOSET**prgPropertyInfoSets,//@parm OUT | Buffer containing default values returned
WCHAR**ppDescBuffer//@parm OUT| Buffer containing property descriptions
)
{
assert( m_pObj );
assert( m_pObj->m_pUtilProp );

// just pass this call on to the utility object that manages our properties
return m_pObj->m_pUtilProp->GetPropertyInfo(
cPropertySets,
rgPropertySets,
pcPropertyInfoSets,
prgPropertyInfoSets,
ppDescBuffer);
}


// IDBProperties::GetProperties ----------------------------------------------------
//
// @mfunc Returns current settings of all properties in the DBPROPFLAGS_DATASOURCE
//property group
//
// @rdesc HRESULT
// @flag S_OK | The method succeeded
// @flag E_INVALIDARG | pcProperties or prgPropertyInfo was NULL
// @flag E_OUTOFMEMORY | Out of memory
//
STDMETHODIMP CImpIDBProperties::GetProperties
(
ULONGcPropertySets,//@parm IN | count of restiction guids
const DBPROPIDSETrgPropertySets[],//@parm IN | restriction guids
ULONG* pcProperties,//@parm OUT | count of properties returned
DBPROPSET**prgProperties//@parm OUT | property information returned
)
{
assert( m_pObj );
assert( m_pObj->m_pUtilProp );

// just pass this call on to the utility object that manages our properties
return m_pObj->m_pUtilProp->GetProperties(
cPropertySets,
rgPropertySets,
pcProperties,
prgProperties );
}


// CImpIDBProperties::SetProperties --------------------------------------------
//
// @mfunc Set properties in the DBPROPFLAGS_DATASOURCE property group
//
// @rdesc HRESULT
// @flag E_INVALIDARG | cProperties was not equal to 0 and rgProperties was NULL
// @flag E_NOTIMPL| this method is not implemented
//
STDMETHODIMP CImpIDBProperties::SetProperties
(
ULONGcProperties,
DBPROPSETrgProperties[]
)
{
assert( m_pObj );
assert( m_pObj->m_pUtilProp );

// just pass this call on to the utility object that manages our properties
return m_pObj->m_pUtilProp->SetProperties(
cProperties,
rgProperties);
}