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