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