//File: CosQuery.idl
//Part of the Query Service
//OMG File: 98-10-29

#ifndef _COS_QUERY_IDL_
#define _COS_QUERY_IDL_

#ifdef _PRE_3_0_COMPILER_
#include <orb.idl>
#include <CosQueryCollection.idl>
#pragma prefix "omg.org"
#else
import ::CORBA;
import ::CosQueryCollection;
#endif // _PRE_3_0_COMPILER_

module CosQuery {

#ifndef _PRE_3_0_COMPILER_
	typeprefix CosQuery "omg.org";
#endif // _PRE_3_0_COMPILER_

	exception QueryInvalid {string why;};
	exception QueryProcessingError {string why;};
	exception QueryTypeInvalid {};

	enum QueryStatus {complete, incomplete};

	typedef CosQueryCollection::ParameterList ParameterList;
	typedef CORBA::InterfaceDef QLType;

	interface Query;
	interface QueryLanguageType {};
	interface SQLQuery : QueryLanguageType {};
	interface SQL_92Query : SQLQuery {};
	interface OQL : QueryLanguageType {};
	interface OQLBasic : OQL {};
	interface OQL_93 : OQL {};
	interface OQL_93Basic : OQL_93, OQLBasic {};

	interface QueryEvaluator {
		typedef sequence<QLType> QLTypes;
		readonly attribute QLTypes ql_types;

		readonly attribute QLType default_ql_type;

		any evaluate (in string query, in QLType ql_type, in ParameterList params) raises(QueryTypeInvalid, QueryInvalid, QueryProcessingError);
	};
	
	interface QueryableCollection : QueryEvaluator, CosQueryCollection::Collection {};

	interface QueryManager : QueryEvaluator {
		Query create (in string query, in QLType ql_type, in ParameterList params) raises(QueryTypeInvalid, QueryInvalid);
	};

	interface Query {
		readonly attribute QueryManager query_mgr;

		void prepare (in ParameterList params) raises(QueryProcessingError);
		void execute (in ParameterList params) raises(QueryProcessingError);

		QueryStatus get_status ();
		any get_result ();
	};

};
#endif /* ifndef _COS_QUERY_IDL_ */
