//+-------------------------------------------------------------------------
//
//  Monarch / Index Server Parser
//  Copyright (c) Microsoft Corporation, 1997 - 1998.
//
//  File:       MParser.idl
//
//  Contents:   Interface definition
//
//--------------------------------------------------------------------------
#ifdef IMPORT_IDL_DEPENDENTS
import "oaidl.idl";
#endif

#include "idlmulti.h"


cpp_quote("//+---------------------------------------------------------------------------")
cpp_quote("//")
cpp_quote("//  Microsoft Content Index SQL Parser")
cpp_quote("//  Copyright (C) Microsoft Corporation, 1997 - 1998.")
cpp_quote("//")
cpp_quote("//----------------------------------------------------------------------------")
cpp_quote("")
cpp_quote("")
cpp_quote("//----------------------------------------------------------------------------")
cpp_quote("//")
cpp_quote("//  Function Prototypes ")
cpp_quote("//")
cpp_quote("//----------------------------------------------------------------------------")
cpp_quote(" HRESULT __stdcall MakeIParser(IParser** ppIParser); ")
cpp_quote("")
cpp_quote("")

//
// Enumerated values for Properties on IParserTreeProperties
//
enum PTPROPS {
	PTPROPS_SCOPE = 1,
	PTPROPS_DEPTH,
	PTPROPS_CATALOG,
	PTPROPS_MACHINE,
	PTPROPS_CIRESTRICTION,
	PTPROPS_ERR_IDS,
	PTPROPS_ERR_HR,
	PTPROPS_ERR_DISPPARAM,
};

//+-------------------------------------------------------------------------
//
// Supported Dialects
//
//+-------------------------------------------------------------------------
cpp_quote("#ifdef DBINITCONSTANTS")
cpp_quote("extern const GUID DBGUID_MSSQLTEXT = {0x03fb9b70,0x7fba,0x11d0,{0xa2,0x59,0x00,0x80,0xc7,0x8c,0x88,0x95}};")
cpp_quote("extern const GUID DBGUID_MSSQLJAWS = {0xe4ab8511,0x4a52,0x11d1,{0xb6,0xd5,0x00,0xc0,0x4f,0xd6,0x11,0xd0}};")
cpp_quote("#else // !DBINITCONSTANTS")
cpp_quote("extern const GUID DBGUID_MSSQLTEXT;")
cpp_quote("extern const GUID DBGUID_MSSQLJAWS;")
cpp_quote("#endif // DBINITCONSTANTS")


typedef struct tagDBCOMMANDTREE DBCOMMANDTREE;
interface IColumnMapperCreator;

//+-------------------------------------------------------------------------
//
// Interface   : IParserVerify
//
// Description : Callback interface that allows the parser to validate 
// bInterface that encapsulates infromation about a particular
//                 query.
//
//+-------------------------------------------------------------------------
LOCAL_INTERFACE(186442B3-472E-11d1-8952-00C04FD611D7)
interface IParserVerify : IUnknown
{
	HRESULT VerifyMachine(
		[in] LPCWSTR pcwszMachine
	);

	HRESULT VerifyCatalog(
		[in] LPCWSTR pcwszMachine,
		[in] LPCWSTR pcwszCatalog
	);
}


//+-------------------------------------------------------------------------
//
// Interface   : IParserTreeProperties
//
// Description : Interface that encapsulates infromation about a particular
//            	 query.
//
//+-------------------------------------------------------------------------
LOCAL_INTERFACE(186442B2-472E-11d1-8952-00C04FD611D7)
interface IParserTreeProperties : IUnknown
{
	HRESULT GetProperties(
		[in] ULONG eParseProp, 
		[in, out] VARIANT* vParseProp
	);
}


//+-------------------------------------------------------------------------
//
// Interface   : IParserSession
//
// Description : Interface containing methods to create and manipulate trees
//            	 and text.
//
//+-------------------------------------------------------------------------
LOCAL_INTERFACE(186442B1-472E-11d1-8952-00C04FD611D7)
interface IParserSession : IUnknown
{
	HRESULT ToTree(
		[in] LCID lcidVal,
		[in] LPCWSTR pcwszText,
		[out] DBCOMMANDTREE** ppTree,
		[out] IParserTreeProperties** ppPTProperties
	);

	HRESULT FreeTree(
		[in, out] DBCOMMANDTREE** ppTree
	);

	HRESULT SetCatalog(
		[in] LPCWSTR pcwszCatalog
	);
}


//+-------------------------------------------------------------------------
//
// Interface   : IParser
//
// Description : Interface used to configure parser and create session 
//				 context in which to translate the text to tree
//
//+-------------------------------------------------------------------------
LOCAL_INTERFACE(186442B0-472E-11d1-8952-00C04FD611D7)
interface IParser : IUnknown
{
	HRESULT CreateSession(
		[in] const GUID* pguidDialect, 
		[in] LPCWSTR pwszMachine,
		[in] IParserVerify* ppIParserVerfiy,
		[in] IColumnMapperCreator*	pIColMapCreator,
		[out] IParserSession** ppIParserSession
	);
}

