1/*************************************************************************
2 *
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2000, 2010 Oracle and/or its affiliates.
6 *
7 * OpenOffice.org - a multi-platform office productivity suite
8 *
9 * This file is part of OpenOffice.org.
10 *
11 * OpenOffice.org is free software: you can redistribute it and/or modify
12 * it under the terms of the GNU Lesser General Public License version 3
13 * only, as published by the Free Software Foundation.
14 *
15 * OpenOffice.org is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18 * GNU Lesser General Public License version 3 for more details
19 * (a copy is included in the LICENSE file that accompanied this code).
20 *
21 * You should have received a copy of the GNU Lesser General Public License
22 * version 3 along with OpenOffice.org.  If not, see
23 * <http://www.openoffice.org/license.html>
24 * for a copy of the LGPLv3 License.
25 *
26 ************************************************************************/
27#ifndef __com_sun_star_sdb_XSQLQueryComposer_idl__
28#define __com_sun_star_sdb_XSQLQueryComposer_idl__
29
30#ifndef __com_sun_star_beans_XPropertySet_idl__
31#include <com/sun/star/beans/XPropertySet.idl>
32#endif
33
34#ifndef __com_sun_star_beans_PropertyValue_idl__
35#include <com/sun/star/beans/PropertyValue.idl>
36#endif
37
38#ifndef __com_sun_star_sdbc_SQLException_idl__
39#include <com/sun/star/sdbc/SQLException.idl>
40#endif
41
42//=============================================================================
43
44 module com {  module sun {  module star {  module sdb {
45
46//=============================================================================
47
48/** should be provided by a tool which simplifies the handling with SQL select statements.
49
50	<p>
51	The interface can be used for composing SELECT statements without knowing the
52	structure of the used query.
53	</p>
54 */
55published interface XSQLQueryComposer: com::sun::star::uno::XInterface
56{
57
58	/** returns the query used for composing.
59		@returns
60			the query
61	 */
62	string getQuery();
63	//-------------------------------------------------------------------------
64
65	/** sets a new query for the composer, which may be expanded by filters
66		and sort criteria.
67		@param command
68			the command to set
69		@throws com::sun::star::sdbc::SQLException
70			if a database access error occurs.
71	 */
72	void setQuery([in] string command )
73			raises (com::sun::star::sdbc::SQLException);
74	//-------------------------------------------------------------------------
75
76	/** returns the query composed with filters and sort criterias.
77		@returns
78			the composed query
79	 */
80	string getComposedQuery();
81	//-------------------------------------------------------------------------
82
83	/** returns the currently used filter.
84
85		<p>
86		The filter criteria returned is part of the where condition of the
87		select command, but it does not contain the where token.
88		</p>
89		@returns
90			the filter
91	 */
92	string getFilter();
93	//-------------------------------------------------------------------------
94
95	/** returns the currently used filter.
96			 <p>
97			 The filter criteria is split into levels. Each level represents the
98			 OR criterias. Within each level, the filters are provided as an AND criteria
99			 with the name of the column and the filter condition. The filter condition
100			 is of type string.
101			 </p>
102		@returns
103			the structured filter
104	 */
105	sequence< sequence<com::sun::star::beans::PropertyValue> >
106		getStructuredFilter();
107	//-------------------------------------------------------------------------
108
109	/** returns the currently used sort order.
110
111
112		<p>
113		The order criteria returned is part of the ORDER BY clause of the
114		select command, but it does not contain the ORDER BY keyword .
115		</p>
116		@returns
117			the order
118	 */
119	string getOrder();
120	//-------------------------------------------------------------------------
121
122	/** appends a new filter condition by a
123		<type scope="com::sun::star::sdb">DataColumn</type>
124		providing the name and the value for the filter.
125		@param column
126			the column which is used to create a filter
127		@throws com::sun::star::sdbc::SQLException
128			if a database access error occurs.
129	 */
130	void appendFilterByColumn([in] com::sun::star::beans::XPropertySet column)
131			raises (com::sun::star::sdbc::SQLException);
132	//-------------------------------------------------------------------------
133
134	/** appends an additional part to the sort order criteria of the select
135		statement.
136		@param column
137			the column which is used to create a order part
138		@param	ascending
139			<TRUE/> when the order should be ascending, otherwise <FALSE/>
140		@throws com::sun::star::sdbc::SQLException
141			if a database access error occurs.
142	 */
143	void appendOrderByColumn([in] com::sun::star::beans::XPropertySet column,
144			 				 [in] boolean ascending)
145			raises (com::sun::star::sdbc::SQLException);
146	//-------------------------------------------------------------------------
147
148	/** makes it possible to set a filter condition	for the query.
149		@param filter
150			the filter to set
151		@throws com::sun::star::sdbc::SQLException
152			if a database access error occurs.
153	 */
154	void setFilter([in] string filter)
155			raises (com::sun::star::sdbc::SQLException);
156	//-------------------------------------------------------------------------
157
158	/** makes it possibile to set a sort condition for the query.
159		@param order
160			the order part to set
161		@throws com::sun::star::sdbc::SQLException
162			if a database access error occurs.
163	 */
164	void setOrder([in] string order)
165			raises (com::sun::star::sdbc::SQLException);
166};
167
168//=============================================================================
169
170}; }; }; };
171
172/*=============================================================================
173
174=============================================================================*/
175#endif
176