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_ucb_ContentResultSet_idl__
28#define __com_sun_star_ucb_ContentResultSet_idl__
29
30#ifndef __com_sun_star_lang_XComponent_idl__
31#include <com/sun/star/lang/XComponent.idl>
32#endif
33
34#ifndef __com_sun_star_beans_XPropertySet_idl__
35#include <com/sun/star/beans/XPropertySet.idl>
36#endif
37
38#ifndef __com_sun_star_sdbc_XResultSet_idl__
39#include <com/sun/star/sdbc/XResultSet.idl>
40#endif
41
42#ifndef __com_sun_star_sdbc_XResultSetMetaDataSupplier_idl__
43#include <com/sun/star/sdbc/XResultSetMetaDataSupplier.idl>
44#endif
45
46#ifndef __com_sun_star_sdbc_XRow_idl__
47#include <com/sun/star/sdbc/XRow.idl>
48#endif
49
50#ifndef __com_sun_star_sdbc_XCloseable_idl__
51#include <com/sun/star/sdbc/XCloseable.idl>
52#endif
53
54#ifndef __com_sun_star_ucb_XContentAccess_idl__
55#include <com/sun/star/ucb/XContentAccess.idl>
56#endif
57
58#ifndef __com_sun_star_sdbc_ResultSet_idl__
59#include <com/sun/star/sdbc/ResultSet.idl>
60#endif
61
62//=============================================================================
63
64module com { module sun { module star { module ucb {
65
66//=============================================================================
67/** provides access to the children of a folder content.
68
69    <p>It can be understand as a table containing a row for	each child. The
70	table columns may contain values of properties of the children.
71*/
72published service ContentResultSet
73{
74	//-------------------------------------------------------------------------
75	/** must be implemented to make it possible to resolve cyclic object
76	    references ( i.e. between an implementation of
77		<type scope="com::sun::star::beans">XPropertySet</type>
78		- which may	hold property change listeners - and
79		<type scope="com::sun::star::beans">XPropertyChangeListener</type>
80		- which may hold the property set ).
81
82		<p>This interface is required.
83	 */
84	interface com::sun::star::lang::XComponent;
85
86	/** provides access to the result set meta data. Meta data are for
87	    example the number of columns of the result set, information
88		on the data types of columns, column names, and more.
89
90		<p>This interface is required.
91	 */
92	interface com::sun::star::sdbc::XResultSetMetaDataSupplier;
93
94	//-------------------------------------------------------------------------
95	/** enables travelling through the result set members ( the contents ).
96		This interface mainly provides a cursor for the result set.
97
98		<p>Note that every method of this interface implementation additionally
99		may throw a	<type>ResultSetException</type> ( which is derived from
100		<type scope="com::sun::star::sdbc">SQLException</type> to be compatible
101		to that interface ). The new exception transports another exception,
102		which indicates the reason for the failure of the method call.
103
104		<p>This interface is required.
105	 */
106	interface com::sun::star::sdbc::XResultSet;
107
108	//-------------------------------------------------------------------------
109	/**	provides access to data of the content the cursor is pointing to.
110
111		<p>Note that every method of this interface implementation additionally
112		may throw a	<type>ResultSetException</type> ( which is derived from
113		<type scope="com::sun::star::sdbc">SQLException</type> to be compatible
114		to that interface ). The new exception transports another exception,
115		which indicates the reason for the failure of the method call.
116
117		<p>This interface is required.
118	 */
119	interface com::sun::star::sdbc::XRow;
120
121	//-------------------------------------------------------------------------
122	/** makes it possible to abort running activities ( i.e. to cancel
123	    retrieving data from a server ).
124
125		<p>Note that every method of this interface implementation additionally
126		may throw a	<type>ResultSetException</type> ( which is derived from
127		<type scope="com::sun::star::sdbc">SQLException</type> to be compatible
128		to that interface ). The new exception transports another exception,
129		which indicates the reason for the failure of the method call.
130
131		<p>This interface is required.
132	 */
133	interface com::sun::star::sdbc::XCloseable;
134
135	//-------------------------------------------------------------------------
136	/** holds properties of the resultset.
137
138		<p>This interface is required.
139	 */
140	interface com::sun::star::beans::XPropertySet;
141
142	//-------------------------------------------------------------------------
143	/** controls the travel mode of the resultset cursor.
144
145		<p>There are two possible travel modes:
146
147		<p><table border=1>
148		<tr><td><member>CursorTravelMode::BLOCKING</member></td>
149			<td>Each travel method of the resultset will not return until the
150			    data for the new position were retrieved.</td></tr>
151		<tr><td><member>CursorTravelMode::NONBLOCKING</member></td>
152			<td>The implementation will throw a
153				<code>CursorWouldBlockException</code>, if the data for the new
154				position are not retrieved yet.</td></tr>
155		</table>
156
157		<p>The following pseudo-code illustrates the usage of a non-blocking
158		cursor:
159
160		<p><pre>
161    	bProcessedAllRows = false
162    	while ( !bProcessedAllRows )
163    	{
164        	cursor.setPropertyValue( "CursorTravelMode", BLOCKING )
165
166        	cursor.travelSomeWhere()
167        	collectRowData()
168
169        	cursor.setPropertyValue( "CursorTravelMode", NONBLOCKING )
170
171        	bGoOn = true;
172        	while ( bGoOn )
173        	{
174            	try
175            	{
176                	cursor.travelSomeWhere()
177                	collectRowData()
178            	}
179            	catch ( CursorWouldBlockException )
180            	{
181                	// No more data at the moment.
182               	bGoOn = false
183            	}
184        	}
185
186        	doSomethingWithCollectedRowData()
187
188        	bProcessedAllRows = ...
189    	}
190		</pre>
191
192		<p>
193	 	If this property is not supported, the implementation needs to provide
194		a blocking cursor.
195		</p>
196
197		<p>
198		The implementation initially needs to set the value of this property
199		to <member>CursorTravelMode::BLOCKING</member>.
200		</p>
201
202		@see CursorTravelMode
203	 */
204	[optional, property] long CursorTravelMode;
205
206	/** contains the number of rows obtained (so far) from the data source. */
207	[readonly, property] long RowCount;
208
209	/** indicates that all rows of te resultset have been obtained. */
210	[readonly, property] boolean IsRowCountFinal;
211
212	//-------------------------------------------------------------------------
213	/**	provides access to the content identifier and the content object
214		itself.
215
216		<p>This interface is required.
217	 */
218	interface XContentAccess;
219
220	//-------------------------------------------------------------------------
221	/** can be implemented to provide a complete JDBC conform result set
222		interface for the implementation of this service.
223
224		<p>The implememtation of this service is optional.
225	 */
226	service com::sun::star::sdbc::ResultSet;
227};
228
229//=============================================================================
230
231}; }; }; };
232
233#endif
234