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_report_XDatabaseDataProvider_idl__
24#define __com_sun_star_report_XDatabaseDataProvider_idl__
25
26#ifndef __com_sun_star_container_NoSuchElementException_idl__
27#include <com/sun/star/container/NoSuchElementException.idl>
28#endif
29#include <com/sun/star/beans/XPropertySet.idl>
30#include <com/sun/star/beans/UnknownPropertyException.idl>
31#include <com/sun/star/lang/XInitialization.idl>
32#include <com/sun/star/lang/XComponent.idl>
33#include <com/sun/star/sdbc/XConnection.idl>
34#include <com/sun/star/sdbc/XParameters.idl>
35#include <com/sun/star/sdbc/XRowSet.idl>
36#include <com/sun/star/chart2/data/XDataProvider.idl>
37#include <com/sun/star/chart2/data/XRangeXMLConversion.idl>
38
39//=============================================================================
40
41 module com {  module sun {  module star {  module chart2 { module data {
42
43//=============================================================================
44
45/** identifies a <type>XDataProvider</type> for result sets.
46
47	@see XDataProvider
48    @see DataProvider
49 */
50interface XDatabaseDataProvider
51{
52	/** For accessing data a component provides for being used by
53        charts.
54     */
55	interface XDataProvider;
56
57    /** allows you to convert the ranges a data provider deals with
58        internally into valid XML.
59     */
60    interface XRangeXMLConversion;
61
62    /** allows access to the properties of the instance.
63	*/
64	interface com::sun::star::lang::XInitialization;
65
66    /** allows life-time control of the database data provider.
67	 */
68    interface com::sun::star::lang::XComponent;
69
70	/** allows access to the properties of the instance.
71	*/
72	interface com::sun::star::beans::XPropertySet;
73
74    interface com::sun::star::sdbc::XParameters;
75    interface com::sun::star::sdbc::XRowSet;
76
77    /** is used for subreports and contains the names of columns of the parent report.
78	<p> These columns are typically the foreign key fields of the parent report.
79	The values of theses columns are used to identify the data for the subreport.
80	Each time the parent report changes it's current row, the subreport requeries
81	it's data based on the values of the master fields.</p>
82	<p>If the report is no sub report (e.g. it's parent is not a report itself), this
83	property is not evaluated.</p>
84
85	*/
86    [attribute,bound] sequence<string> MasterFields;
87
88	/**is used for subreports and contains the names of the columns of the subreport
89	which are related to the master fields of the parent report.
90	<p>Entries in this sequence can either denote column names in the sub report,
91	or paramater names.<br/>
92	For instance, you could base the report on the SQL statement
93	<code>SELECT * FROM invoices WHERE cust_ref = :cid</code>, and add <code>cid</code>
94	to the DetailFields property. In this case, the parameter will be filled from
95	the corresponding master field.<br/>
96	Alternatively, you could simply base your report on the table <code>invoices</code>,
97	and add the column name <code>cust_ref</code> to the DetailFields. In this case,
98	and implicit filter clause <code>WHERE cust_ref = :&lt;new_param_name&gt;</code> will
99	be created, and the artificial parameter will be filled from the corresponding
100	master field.<br/>
101	If a string in this property denotes both a column name and a parameter name, it
102	is undefined which way it is interpreted, but implementations of the service are required
103	to either decide for the parameter or the column, and proceed as usual.
104	</p>
105	<p>The columns specified herein typically represent a part of the primary key
106	fields or their aliases of the detail report.</p>
107	<p>If the report is no sub report (e.g. it's parent is not a report itself), this
108	property is not evaluated.</p>
109	*
110	*/
111    [attribute,bound] sequence<string> DetailFields;
112
113    /** is the command which should be executed, the type of command depends
114	on the CommandType.
115	<p>In case of a <member>CommandType</member> of <member>CommandType::COMMAND</member>,
116	means in case the <member>Command</member> specifies an SQL statement, the inherited
117	<member scope="com::sun::star::sdbc">RowSet::EscapeProcessing</member>
118	becomes relevant:<br/>
119	It then can be to used to specify whether the SQL statement should be analyzed on the
120	client side before sending it to the database server.<br/>
121	The default value for <member scope="com::sun::star::sdbc">RowSet::EscapeProcessing</member>
122	is <TRUE/>. By switching it to <FALSE/>, you can pass backend-specific SQL statements,
123	which are not standard SQL, to your database.</p>
124
125
126	@see com::sun::star::sdb::CommandType
127	*/
128    [attribute,bound] string Command;
129
130	/** specifies the type of the command to be executed to retrieve a result set.
131
132		<p><member>Command</member> needs to be interpreted depending on the value of this property.</p>
133
134		<p>This property is only meaningfull together with the <member>Command</member>
135		property, thus either <em>both</em> or <em>none</em> of them are present.</p>
136
137		@see com::sun::star::sdb::CommandType
138	 */
139    [attribute,bound] long CommandType;
140
141	/** specifies an additional filter to optinally use.
142
143		<p>The Filter string has to form a SQL WHERE-clause, <em>without</em> the WHERE-string itself.</p>
144
145		<p>If a <member>DataSourceName</member>, <member>Command</member> and <member>CommandType</member>
146		are specified, a <type>RowSet</type> can be created with this information. If the results provided by the
147		row set are to be additionally filtered, the Filter property can be used.</p>
148
149		<p>Note that the Filter property does not make sense if a <member>ResultSet</member> has been specified
150		in the DataAccessDescriptor.</p>
151
152		@see com::sun::star::sdb::RowSet
153		@see ResultSet
154	*/
155	[attribute,bound] string Filter;
156
157    /** indicates whether the filter should be applied or not,
158		default is <FALSE/>.
159	 */
160	[attribute,bound] boolean ApplyFilter;
161
162    /** additional having clause for the row set
163	 */
164	[attribute,bound] string HavingClause
165    {
166        set raises (com::sun::star::beans::UnknownPropertyException);
167    };
168
169	/** additional group by for the row set
170	 */
171	[attribute,bound] string GroupBy
172    {
173        set raises (com::sun::star::beans::UnknownPropertyException);
174    };
175
176	/** is a additional sort order definition for a rowset.
177	 */
178	[attribute,bound] string Order;
179
180	/** specifies if the <member>Command</member> should be analyzed on the client side before sending it
181		to the database server.
182
183		<p>The default value of this property is <TRUE/>. By switching it to <FALSE/>, you can pass
184		backend-specific SQL statements, which are not standard SQL, to your database.</p>
185
186		<p>This property is usually present together with the <member>Command</member> and
187		<member>CommandType</member> properties, and is evaluated if and only if <member>CommandType</member>
188		equals <member>CommandType::COMMAND</member>.</p>
189	*/
190	[attribute,bound] boolean EscapeProcessing;
191
192    /** specifies the maximal count of rows which should be fetched.
193        <p>A value of zero implies that no limit exists.</p>
194    */
195    [attribute,bound] long RowLimit;
196
197    /** specifies the active connection which is used to create the resulting report.
198	*/
199    [attribute,bound] com::sun::star::sdbc::XConnection ActiveConnection
200    {
201        set raises (com::sun::star::lang::IllegalArgumentException);
202    };
203    /** is the name of the datasource to use, this could be a named datasource
204		or the URL of a data access component.
205	 */
206	[attribute,bound] string DataSourceName;
207};
208
209//=============================================================================
210
211 }; }; }; };  };
212
213/*=============================================================================
214
215=============================================================================*/
216#endif
217