/********************************************************
*                                                       *
*   Copyright (C) Microsoft. All rights reserved.       *
*                                                       *
********************************************************/


//-----------------------------------------------------------------------------
// File:			cmdwpr.idl
//
// Contents: 		OLE DB interface definition
//
// Comments:
//
//-----------------------------------------------------------------------------

cpp_quote("#include <winapifamily.h>")

#pragma region Desktop Family
cpp_quote("#if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP)")

#include "idlmulti.h"
//

	REMOTED_INTERFACE(0c733a64-2a1c-11ce-ade5-00aa0044773d)


interface ICommandWithParameters : IUnknown {

typedef struct tagDBPARAMBINDINFO {
	LPOLESTR pwszDataSourceType;
	LPOLESTR pwszName;
	DBLENGTH ulParamSize;
	DBPARAMFLAGS dwFlags;
	BYTE bPrecision;
	BYTE bScale;
} DBPARAMBINDINFO;

	[local]
	HRESULT GetParameterInfo(
		[in, out, annotation("_Out_")] DB_UPARAMS * pcParams,
		[out, size_is(,*pcParams), annotation("_Outptr_result_buffer_maybenull_(*pcParams)")] DBPARAMINFO ** prgParamInfo,
		[out, annotation("_Outptr_opt_result_z_")] OLECHAR ** ppNamesBuffer
	);

#ifdef _WIN64  //Use casting by ULONG in attribute size_is under 64-bit environment.

#ifndef NO_REMOTE
	[call_as(GetParameterInfo)]
	HRESULT RemoteGetParameterInfo(
		[in, out] DB_UPARAMS * pcParams,
		[out, size_is(,(ULONG)*pcParams)] DBPARAMINFO ** prgParamInfo,
		[out, size_is(,(ULONG)*pcParams)] DBBYTEOFFSET ** prgNameOffsets,
		[in, out] DBLENGTH * pcbNamesBuffer,
		[in, out, unique, size_is(,(ULONG)*pcbNamesBuffer)] OLECHAR ** ppNamesBuffer,
		[out] IErrorInfo ** ppErrorInfoRem
	);
#endif

	[local]
	HRESULT MapParameterNames(
		[in] DB_UPARAMS cParamNames,
		[in, size_is((ULONG)cParamNames), annotation("_In_reads_(cParamNames)")] LPCWSTR rgParamNames[],
		[out, size_is((ULONG)cParamNames), annotation("_Out_writes_(cParamNames)")] DB_LPARAMS rgParamOrdinals[]
	);

	[call_as(MapParameterNames)]
	HRESULT RemoteMapParameterNames(
		[in] DB_UPARAMS cParamNames,
		[in, size_is((ULONG)cParamNames)] LPCOLESTR *rgParamNames,
		[out, size_is((ULONG)cParamNames)] DB_LPARAMS * rgParamOrdinals,
		[out] IErrorInfo ** ppErrorInfoRem
	);

	[local]
	HRESULT SetParameterInfo(
		[in] DB_UPARAMS cParams,
		[in, unique, size_is((ULONG)cParams), annotation("_In_reads_opt_(cParams)")] const DB_UPARAMS rgParamOrdinals[],
		[in, unique, size_is((ULONG)cParams), annotation("_In_reads_opt_(cParams)")] const DBPARAMBINDINFO rgParamBindInfo[]
	);

	[call_as(SetParameterInfo)]
	HRESULT RemoteSetParameterInfo(
		[in] DB_UPARAMS cParams,
		[in, unique, size_is((ULONG)cParams)] const DB_UPARAMS * rgParamOrdinals,
		[in, unique, size_is((ULONG)cParams)] const DBPARAMBINDINFO * rgParamBindInfo,
		[out] IErrorInfo ** ppErrorInfoRem
	);

#else  //No casting by ULONG for 32-bit.

#ifndef NO_REMOTE
	[call_as(GetParameterInfo)]
	HRESULT RemoteGetParameterInfo(
		[in, out] DB_UPARAMS * pcParams,
		[out, size_is(,*pcParams)] DBPARAMINFO ** prgParamInfo,
		[out, size_is(,*pcParams)] DBBYTEOFFSET ** prgNameOffsets,
		[in, out] DBLENGTH * pcbNamesBuffer,
		[in, out, unique, size_is(,*pcbNamesBuffer)] OLECHAR ** ppNamesBuffer,
		[out] IErrorInfo ** ppErrorInfoRem
	);
#endif

	[local]
	HRESULT MapParameterNames(
		[in] DB_UPARAMS cParamNames,
		[in, size_is(cParamNames), annotation("_In_reads_(cParamNames)")] LPCWSTR rgParamNames[],
		[out, size_is(cParamNames), annotation("_Out_writes_(cParamNames)")] DB_LPARAMS rgParamOrdinals[]
	);

	[call_as(MapParameterNames)]
	HRESULT RemoteMapParameterNames(
		[in] DB_UPARAMS cParamNames,
		[in, size_is(cParamNames)] LPCOLESTR *rgParamNames,
		[out, size_is(cParamNames)] DB_LPARAMS * rgParamOrdinals,
		[out] IErrorInfo ** ppErrorInfoRem
	);

	[local]
	HRESULT SetParameterInfo(
		[in] DB_UPARAMS cParams,
		[in, unique, size_is(cParams), annotation("_In_reads_opt_(cParams)")] const DB_UPARAMS rgParamOrdinals[],
		[in, unique, size_is(cParams), annotation("_In_reads_opt_(cParams)")] const DBPARAMBINDINFO rgParamBindInfo[]
	);

	[call_as(SetParameterInfo)]
	HRESULT RemoteSetParameterInfo(
		[in] DB_UPARAMS cParams,
		[in, unique, size_is(cParams)] const DB_UPARAMS * rgParamOrdinals,
		[in, unique, size_is(cParams)] const DBPARAMBINDINFO * rgParamBindInfo,
		[out] IErrorInfo ** ppErrorInfoRem
	);

#endif
}

cpp_quote("#endif /* WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP) */")
#pragma endregion

