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