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