1/**************************************************************
2 *
3 * Licensed to the Apache Software Foundation (ASF) under one
4 * or more contributor license agreements.  See the NOTICE file
5 * distributed with this work for additional information
6 * regarding copyright ownership.  The ASF licenses this file
7 * to you under the Apache License, Version 2.0 (the
8 * "License"); you may not use this file except in compliance
9 * with the License.  You may obtain a copy of the License at
10 *
11 *   http://www.apache.org/licenses/LICENSE-2.0
12 *
13 * Unless required by applicable law or agreed to in writing,
14 * software distributed under the License is distributed on an
15 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16 * KIND, either express or implied.  See the License for the
17 * specific language governing permissions and limitations
18 * under the License.
19 *
20 *************************************************************/
21
22
23#ifndef __com_sun_star_sdb_XSQLQueryComposer_idl__
24#define __com_sun_star_sdb_XSQLQueryComposer_idl__
25
26#ifndef __com_sun_star_beans_XPropertySet_idl__
27#include <com/sun/star/beans/XPropertySet.idl>
28#endif
29
30#ifndef __com_sun_star_beans_PropertyValue_idl__
31#include <com/sun/star/beans/PropertyValue.idl>
32#endif
33
34#ifndef __com_sun_star_sdbc_SQLException_idl__
35#include <com/sun/star/sdbc/SQLException.idl>
36#endif
37
38//=============================================================================
39
40 module com {  module sun {  module star {  module sdb {
41
42//=============================================================================
43
44/** should be provided by a tool which simplifies the handling with SQL select statements.
45
46	<p>
47	The interface can be used for composing SELECT statements without knowing the
48	structure of the used query.
49	</p>
50 */
51published interface XSQLQueryComposer: com::sun::star::uno::XInterface
52{
53
54	/** returns the query used for composing.
55		@returns
56			the query
57	 */
58	string getQuery();
59	//-------------------------------------------------------------------------
60
61	/** sets a new query for the composer, which may be expanded by filters
62		and sort criteria.
63		@param command
64			the command to set
65		@throws com::sun::star::sdbc::SQLException
66			if a database access error occurs.
67	 */
68	void setQuery([in] string command )
69			raises (com::sun::star::sdbc::SQLException);
70	//-------------------------------------------------------------------------
71
72	/** returns the query composed with filters and sort criterias.
73		@returns
74			the composed query
75	 */
76	string getComposedQuery();
77	//-------------------------------------------------------------------------
78
79	/** returns the currently used filter.
80
81		<p>
82		The filter criteria returned is part of the where condition of the
83		select command, but it does not contain the where token.
84		</p>
85		@returns
86			the filter
87	 */
88	string getFilter();
89	//-------------------------------------------------------------------------
90
91	/** returns the currently used filter.
92			 <p>
93			 The filter criteria is split into levels. Each level represents the
94			 OR criterias. Within each level, the filters are provided as an AND criteria
95			 with the name of the column and the filter condition. The filter condition
96			 is of type string.
97			 </p>
98		@returns
99			the structured filter
100	 */
101	sequence< sequence<com::sun::star::beans::PropertyValue> >
102		getStructuredFilter();
103	//-------------------------------------------------------------------------
104
105	/** returns the currently used sort order.
106
107
108		<p>
109		The order criteria returned is part of the ORDER BY clause of the
110		select command, but it does not contain the ORDER BY keyword .
111		</p>
112		@returns
113			the order
114	 */
115	string getOrder();
116	//-------------------------------------------------------------------------
117
118	/** appends a new filter condition by a
119		<type scope="com::sun::star::sdb">DataColumn</type>
120		providing the name and the value for the filter.
121		@param column
122			the column which is used to create a filter
123		@throws com::sun::star::sdbc::SQLException
124			if a database access error occurs.
125	 */
126	void appendFilterByColumn([in] com::sun::star::beans::XPropertySet column)
127			raises (com::sun::star::sdbc::SQLException);
128	//-------------------------------------------------------------------------
129
130	/** appends an additional part to the sort order criteria of the select
131		statement.
132		@param column
133			the column which is used to create a order part
134		@param	ascending
135			<TRUE/> when the order should be ascending, otherwise <FALSE/>
136		@throws com::sun::star::sdbc::SQLException
137			if a database access error occurs.
138	 */
139	void appendOrderByColumn([in] com::sun::star::beans::XPropertySet column,
140			 				 [in] boolean ascending)
141			raises (com::sun::star::sdbc::SQLException);
142	//-------------------------------------------------------------------------
143
144	/** makes it possible to set a filter condition	for the query.
145		@param filter
146			the filter to set
147		@throws com::sun::star::sdbc::SQLException
148			if a database access error occurs.
149	 */
150	void setFilter([in] string filter)
151			raises (com::sun::star::sdbc::SQLException);
152	//-------------------------------------------------------------------------
153
154	/** makes it possibile to set a sort condition for the query.
155		@param order
156			the order part to set
157		@throws com::sun::star::sdbc::SQLException
158			if a database access error occurs.
159	 */
160	void setOrder([in] string order)
161			raises (com::sun::star::sdbc::SQLException);
162};
163
164//=============================================================================
165
166}; }; }; };
167
168/*=============================================================================
169
170=============================================================================*/
171#endif
172