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
28#ifndef __com_sun_star_sdb_DataAccessDescriptor_idl__
29#define __com_sun_star_sdb_DataAccessDescriptor_idl__
30
31#ifndef __com_sun_star_sdbc_Connection_idl__
32#include <com/sun/star/sdbc/Connection.idl>
33#endif
34
35#ifndef __com_sun_star_sdbc_ResultSet_idl__
36#include <com/sun/star/sdbc/ResultSet.idl>
37#endif
38
39#ifndef __com_sun_star_beans_XPropertySet_idl__
40#include <com/sun/star/beans/XPropertySet.idl>
41#endif
42
43#ifndef __com_sun_star_beans_PropertyValue_idl__
44#include <com/sun/star/beans/PropertyValue.idl>
45#endif
46
47module com {  module sun {  module star {  module sdb {
48
49/** descriptor for accessing basic data access objects.
50
51	<p>Various components interacting with the database access world require to specify (or provide themself) an object
52	such as a query, a table, a result set, a connection to a data source, a column within a table, and so on.<br/>
53	All of these objects are usually not specified with a single property, but with a set of properties, and for
54	various objects, various (but not always different) properties are needed.<br/>
55	The <code>DataAccessDescriptor</code> describes the super set of the properties for the most common
56	data access objects.</p>
57
58	<p>Every component providing or requiring a <type>DataAccessDescriptor</type> for some functionality
59	is urged to specify which properties are mandatory, and which ones optional. Additionally,
60	it's free to specify any additional requirements about the relations of properties.</p>
61
62	@since OOo 1.1.2
63*/
64published service DataAccessDescriptor
65{
66	/** specifies the name of the datasource to access.
67
68		<p>This data source is usually used to create a <type>Connection</type>. If no DataSourceName is given
69		and the <member>DatabaseLocation</member> and the <member>ConnectionResource</member> are emtpy, then an <member>ActiveConnection</member>
70        is required.</p>
71
72		@see com::sun::star::sdb::DatabaseContext
73		@see ActiveConnection
74	 */
75	[optional, property] string DataSourceName;
76
77	/** specifies the URL of the database file.
78
79		<p>This database location is usually used to create a <type>Connection</type>. If no DatabaseLocation is given
80		and the <member>ConnectionResource</member> is emtpy, then an <member>ActiveConnection</member> is reuqired.</p>
81
82		@see com::sun::star::sdb::DatabaseContext
83		@see ActiveConnection
84	 */
85	[optional, property] string DatabaseLocation;
86
87	/** specifies the database URL which locates a database driver.
88
89		<p>This database URL is usually used to create a <type>Connection</type>. If no ConnectionResource is given,
90		then an <member>ActiveConnection</member> is reuqired.</p>
91
92		@see com::sun::star::sdb::DatabaseContext
93		@see ActiveConnection
94	 */
95	[optional, property] string ConnectionResource;
96
97    /** specifies additional info to use when creating a connection from a <code>ConnectionResource</code>
98
99        <p>This member is evaluated only when <code>ConnectionResource</code> is used: In this case,
100        <member scope="com::sun::star::sdbc">XDriverManager::getConnectionWithInfo</member> is used
101        to create a connection for the given connection resource, instead of
102        <member scope="com::sun::star::sdbc">XDriverManager::getConnection</member>.</p>
103
104        <p>If the sequence is empty, it is ignored.</p>
105    */
106    [optional, property] sequence< ::com::sun::star::beans::PropertyValue > ConnectionInfo;
107
108	/** is a connection to use.
109
110		<p>This object is guaranteed to be a <type scope="com::sun::star::sdbc">Connection</type>, but usually
111		it will be a <type>Connection</type> from the module com::sun::star::sdb.<br/>
112		Especially in the case where no <member>DataSourceName</member> is given, but
113		<member>CommandType</member> is <member>CommandType::QUERY</member>, the ActiveConnection needs
114		to fully support the <type>Connection</type> service, to actually retrieve the query specified by
115		<member>Command</member></p>
116
117		<p>If no ActiveConnection is given, then a <member>DataSourceName</member> is required.</p>
118
119		@see DataSourceName
120	 */
121	[optional, property] com::sun::star::sdbc::XConnection ActiveConnection;
122
123	/** specifies the command to execute to retrieve a result set.
124
125		<p>This property is only meaningful together with the <member>CommandType</member>
126		property, thus either <em>both</em> or <em>none</em> of them are present.</p>
127
128		@see CommandType
129	 */
130	[optional, property] string Command;
131
132
133	/** specifies the type of the command to be executed to retrieve a result set.
134
135		<p><member>Command</member> needs to be interpreted depending on the value of this property.</p>
136
137		<p>This property is only meaningfull together with the <member>Command</member>
138		property, thus either <em>both</em> or <em>none</em> of them are present.</p>
139
140		@see com::sun::star::sdb::CommandType
141	 */
142	[optional, property] long CommandType;
143
144	/** specifies an addtional filter to optionally use.
145
146		<p>The Filter string has to form a <code>WHERE</code>-clause, <em>without</em> the
147        <code>WHERE</code>-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	[optional, property] string Filter;
160
161	/** specifies an additional <code>ORDER BY</code> clause which should be applied on top of
162        the given <member>Command</member>.
163
164        <p>The keyword <code>ORDER BY</code> itself is not part of this property.</p>
165	 */
166	[optional, property] string Order;
167
168	/** specifies an additional <code>HAVING</code> clause which should be applied on top of
169        the given <member>Command</member>.
170
171        <p>The keyword <code>HAVING</code> itself is not part of this property.</p>
172	 */
173	[optional, property] string HavingClause;
174
175	/** specifies an additional <code>GROUP BY</code> clause which should be applied on top of
176        the given <member>Command</member>.
177
178        <p>The keyword <code>GROUP BY</code> itself is not part of this property.</p>
179	 */
180	[optional, property] string GroupBy;
181
182	/** specifies if the <member>Command</member> should be analyzed on the client side before sending it
183		to the database server.
184
185		<p>The default value of this property is <TRUE/>. By switching it to <FALSE/>, you can pass
186		backend-specific SQL statements, which are not standard SQL, to your database.</p>
187
188		<p>This property is usually present together with the <member>Command</member> and
189		<member>CommandType</member> properties, and is evaluated if and only if <member>CommandType</member>
190		equals <member>CommandType::COMMAND</member>.</p>
191	*/
192	[optional, property] boolean EscapeProcessing;
193
194	/** specifies an already existent result set to use.
195
196		<p>Usually, you use the properties <member>DataSourceName</member> (alternatively
197		<member>ActiveConnection</member>), <member>Command</member> and <member>CommandType</member> to specify
198		how to <em>obtain</em> a result set. However, in scenarious where the provider of a DataAccessDescriptor
199		has access to an already existent result set, it can pass it along for reusage. This is encouraged
200		to increase performance.</p>
201
202		<p>The object will at least support the <type scope="com::sun::star::sdbc">ResultSet</type> service.</p>
203
204		<p>Note that any superservices of <type scope="com::sun::star::sdbc">ResultSet</type>
205		are also allowed. Especially, this member can denote an instance of the
206		<type scope="com::sun::star::sdb">RowSet</type>, or an instance obtained
207		by calling <member scope="com::sun::star::sdb">XResultSetAccess::createResultSet</member>
208		on such a <type scope="com::sun::star::sdb">RowSet</type>. This becomes important in
209		conjunction with the <member>Selection</member> property.</p>
210
211		@see com::sun::star::sdb::XResultSetAccess
212	*/
213    [optional, property] com::sun::star::sdbc::XResultSet ResultSet;
214
215	/** specifies a selection to confine the records in a result set.
216
217		<p>When you specify a result set either implicitly (<member>DataSourceName</member>, <member>Command</member>,
218		<member>CommandType</member>) or explicitly (<member>ResultSet</member>), the set of results can be
219		additionally refined with this property.</p>
220
221		<p>The single elements of the <member>Selection</member> are either record numbers (see
222		<member scope="com::sun::star::sdbc">XResultSet::getRow</member>), or bookmarks (see
223		<member scope="com::sun::star::sdbcx">XRowLocate::getBookmark</member>).<br/>
224		It is up to the component which provides or requires a DataAccessDescriptor to specify which of the
225		two alternatives it expects. If it does <em>not</em> specify this, then the property
226		<member>BookmarkSelection</member> becomes mandatory.</p>
227
228		<p>If the elements specify bookmarks, and a <member>ResultSet</member> has been specified, then
229		this result set is required to support the <type scope="com::sun::star::sdbcx">XRowLocate</type> interface.</p>
230	*/
231    [optional, property] sequence< any > Selection;
232
233	/** specifies how to interpret <member>Selection</member>
234
235		<p>If present, <member>BookmarkSelection</member> specifies the semantics of <member>Selection</member>. If
236		not present, it's up to the implementing component to specify this semantics.</p>
237
238		<p>If <TRUE/>, then the single elements of the array specified by <member>Selection</member> are
239		bookmarks relative to the result set, if <FALSE/>, they're record numbers.</p>
240
241		@see com::sun::star::sdbcx::XRowLocate
242		@see com::sun::star::sdbc::XResultSet
243		@see com::sun::star::sdb::XResultSetAccess
244	*/
245	[optional, property] boolean BookmarkSelection;
246
247	/** specifies a column name.
248
249		<p>This property is usually used together with the <member>Command</member> and
250		<member>CommandType</member> properties.</p>
251
252		@see Column
253	*/
254	[optional, property] string ColumnName;
255
256	/** specifies a column object
257
258		<p>For reasons of performance and saving resources, a supplier of an DataAccessDescriptor which is
259		used to describe a column object can pass this object directly, instead of specifying it only implicitly
260		with the <member>ColumnName</member> property.</p>
261
262		<p>The object will at least support the <type scope="com::sun::star::sdbcx">Column</type> service, but more
263		often it will even be a <type>Column</type> from the com::sun::star::sdb module.</p>
264	*/
265	[optional, property] com::sun::star::beans::XPropertySet Column;
266};
267
268}; }; }; };
269
270#endif
271