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