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