1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2000, 2010 Oracle and/or its affiliates.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * This file is part of OpenOffice.org.
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.
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).
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.
26 ************************************************************************/
27 #ifndef __com_sun_star_sdb_RowSet_idl__
28 #define __com_sun_star_sdb_RowSet_idl__
30 #ifndef __com_sun_star_sdbc_RowSet_idl__
31 #include
<com
/sun
/star
/sdbc
/RowSet.idl
>
34 module com
{ module sun
{ module star
{ module sdbc
{
35 published
interface XConnection
;
38 #ifndef __com_sun_star_sdb_ResultSet_idl__
39 #include
<com
/sun
/star
/sdb
/ResultSet.idl
>
42 #ifndef __com_sun_star_sdb_XCompletedExecution_idl__
43 #include
<com
/sun
/star
/sdb
/XCompletedExecution.idl
>
46 module com
{ module sun
{ module star
{ module sdbcx
{
47 published
interface XDeleteRows
;
50 module com
{ module sun
{ module star
{ module sdb
{
52 published
interface XRowSetApproveBroadcaster
;
53 published
interface XResultSetAccess
;
54 published
interface XParametersSupplier
;
57 /** is a client side RowSet, which use retrieves is data based on a database table,
58 a query or a SQL command or by a rowset reader, who mustn't support SQL.
59 The connection of the rowset is typically a named DataSource or a DataAccess component
60 or a previous instanciated connection.
63 <type scope="com::sun::star::sdbc">ResultSetConcurrency</type>
64 , the RowSet caches all data or uses
65 an optimized way for retrieving the data, such as, refetching rows by their keys or
66 if provided, by their bookmarks.
69 In addition, it provides events for RowSet navigation and RowSet modifications
70 to approve the actions and to react on them.
71 @see com::sun::star::sdb::RowChangeAction
72 @see com::sun::star::sdb::RowChangeEvent
73 @see com::sun::star::sdb::RowsChangeEvent
76 <h3>Notifications</h3>
77 <p>A row set is able to be operated in various ways, and additionally it notifies various changes in it's
78 state. Clients of this service can rely on a fixed order of notifications, depending on how they operate
79 on the component.</br>
80 The following describes the general order of all possible notifications which you can encounter when
81 working with a row set:
83 <tr><td valign="top"><em>approving</em></td>
84 <td valign="top">Before anything really happens, any veto listeners are called to approve the operation
85 which is just being done. This may be either a
86 <member>XRowSetApproveListener::approveCursorMove</member> or
87 <member>XRowSetApproveListener::approveRowChange</member> call.
88 @see XRowSetApproveListener
91 <tr><td valign="top"><em>column values</em></td>
92 <td valign="top">If the opration includes changes in the values of the columns of the row set, then these are
93 notified before anything else (except requests for approval).
95 @see com::sun::star::sdbcx::XColumnsSupplier
98 <tr><td valign="top"><em>operation done</em></td>
99 <td valign="top">When the operation is done, you get a notification about this. It may be a
100 <member scope="com::sun::star::sdbc">XRowSetListener::cursorMoved</member> or a
101 <member scope="com::sun::star::sdbc">XRowSetListener::rowChanged</member> call or a
102 <member>XRowsChangeListener::rowsChanged</member> call.
105 <tr><td valign="top"><em>row state</em></td>
106 <td valign="top">If the operation leads to a change in the state of the <member>IsModified</member>
107 and/or <member>IsNew</member> property, this is notified next (in this order).
110 <tr><td valign="top"><em>row count</em></td>
111 <td valign="top">If the operation leads to new knowledge about the number of rows in the result set,
112 the respective changes in the <member>RowCount</member> and <member>IsRowCountFinal</member>
113 are notified last (in this order).
121 <p>The following matrix shows the notifications which apply to the different operations:
122 <table border="1" frame="all">
123 <tr><td/><td><strong>approveCursorMove</strong></td><td><strong>approveRowChange</strong></td>
124 <td><strong>column values</strong></td>
125 <td><strong>cursorMoved</strong></td><td><strong>rowChanged</strong></td>
126 <td><strong>rowsChanged</strong></td>
127 <td><strong>IsModified</strong></td><td><strong>IsNew</strong></td>
128 <td><strong>RowCount</strong></td><td><strong>IsRowCountFinal</strong></td>
131 <tr><td><type scope="com::sun::star::sdbc">XResultSet</type></td><td/><td/><td/><td/><td/><td/><td/><td/></tr>
133 <tr><td align="right"><em>next</em></td><td align="center">X</td><td/><td align="center">X</td><td align="center">X</td><td/><td/><td align="center">X</td><td align="center">X</td><td align="center">X</td><td align="center">X</td>
134 <tr><td align="right"><em>beforeFirst</em></td><td align="center">X</td><td/><td align="center">X</td><td align="center">X</td><td/><td/><td align="center">X</td><td align="center">X</td><td/><td/></tr>
135 <tr><td align="right"><em>afterLast</em></td><td align="center">X</td><td/><td align="center">X</td><td align="center">X</td><td/><td/><td align="center">X</td><td align="center">X</td><td align="center">X</td><td align="center">X</td></tr>
136 <tr><td align="right"><em>first</em></td><td align="center">X</td><td/><td align="center">X</td><td align="center">X</td><td/><td/><td align="center">X</td><td align="center">X</td><td align="center">X</td><td align="center">X</td></tr>
137 <tr><td align="right"><em>last</em></td><td align="center">X</td><td/><td align="center">X</td><td align="center">X</td><td/><td/><td align="center">X</td><td align="center">X</td><td align="center">X</td><td align="center">X</td></tr>
138 <tr><td align="right"><em>absolute</em></td><td align="center">X</td><td/><td align="center">X</td><td align="center">X</td><td/><td/><td align="center">X</td><td align="center">X</td><td align="center">X</td><td align="center">X</td></tr>
139 <tr><td align="right"><em>relative</em></td><td align="center">X</td><td/><td align="center">X</td><td align="center">X</td><td/><td/><td align="center">X</td><td align="center">X</td><td align="center">X</td><td align="center">X</td></tr>
140 <tr><td align="right"><em>previous</em></td><td align="center">X</td><td/><td align="center">X</td><td align="center">X</td><td/><td/><td align="center">X</td><td align="center">X</td><td align="center">X</td><td align="center">X</td></tr>
141 <tr><td align="right"><em>refreshRow</em></td><td/><td/><td align="center">X</td><td/><td/><td/><td align="center">X</td><td align="center">X</td><td/><td/></tr>
142 <tr><td align="right"><em>cancelRowUpdates</em></td><td/><td/><td align="center">X</td><td/><td/><td/><td align="center">X</td><td/><td/><td/></tr>
144 <tr><td><type scope="com::sun::star::sdbc">XResultSetUpdate</type></td><td/><td/><td/><td/><td/><td/><td/><td/></tr>
146 <tr><td align="right"><em>insertRow</em></td><td/><td align="center">X</td><td align="center">X</td><td/><td align="center">X</td><td align="center">X</td><td align="center">X</td><td align="center">X</td><td align="center">X</td><td align="center">X</td></tr>
147 <tr><td align="right"><em>updateRow</em></td><td/><td align="center">X</td><td align="center">X</td><td/><td align="center">X</td><td align="center">X</td><td align="center">X</td><td/><td/><td/></tr>
148 <tr><td align="right"><em>deleteRow</em></td><td/><td align="center">X</td><td/><td/><td align="center">X</td><td align="center">X</td><td align="center">X</td><td align="center">X</td><td align="center">X</td><td align="center">X</td></tr>
149 <tr><td align="right"><em>moveToInsertRow</em></td><td align="center">X</td><td/><td align="center">X</td><td align="center">X</td><td/><td/><td/><td align="center">X</td><td align="center">X</td></tr>
150 <tr><td align="right"><em>moveToCurrentRow</em></td><td align="center">X</td><td/><td/><td align="center">X</td><td/><td/><td align="center">X</td><td align="center">X</td><td/><td/></tr>
152 <tr><td><type scope="com::sun::star::sdbcx">XDeleteRows</type></td><td/><td/><td/><td/><td/><td/><td/><td/></tr>
154 <tr><td align="right"><em>deleteRows</em></td><td/><td align="center">X</td><td/><td/><td align="center">X</td><td align="center">X</td><td align="center">X</td><td align="center">X</td><td align="center">X</td><td align="center">X</td></tr>
156 <tr><td><type scope="com::sun::star::sdbcx">XRowLocate</type></td><td/><td/><td/><td/><td/><td/><td/><td/></tr>
158 <tr><td align="right"><em>moveToBookmark</em></td><td align="center">X</td><td/><td align="center">X</td><td align="center">X</td><td/><td/><td align="center">X</td><td align="center">X</td><td/><td/></tr>
159 <tr><td align="right"><em>moveRelativeToBookmark</em></td><td align="center">X</td><td/><td align="center">X</td><td align="center">X</td><td/><td/><td align="center">X</td><td align="center">X</td><td align="center">X</td><td align="center">X</td></tr>
166 <p>Via <member scope="com::sun::star::sdbc">XResultSetUpdate::deleteRow</member>, you can delete the current row of a
167 <type>RowSet</type>. This deleted row then doesn't vanish immediately, but is still present, and subsequent calls to
168 <member scope="com::sun::star::sdbc">XResultSet::rowDeleted</member> will return <TRUE/>. The deleted row "vanishes" from
169 the <type>RowSet</type> as soon as the cursor is moved away from it.<br/>
170 As a consequence, the behaviour of several other methods is affected:<br/>
172 <dt><member scope="com::sun::star::sdbc">XResultSet::getRow</member></dt>
173 <dd>returns the position of the cursor, which has not been changed by the deletion.</dd>
175 <dt><type scope="com::sun::star::sdbc">XResultSet</type>: <code>next</code>, <code>first</code>, <code>last</code>, <code>absolute</code>,
176 <code>relative</code>, <code>previous</code>, <code>beforeFirst</code>, <code>afterLast</code></dt>
177 <dd>will let the deleted row vanish from the result set. As a consequence, the <member>RowCount</member>
178 will decrease when you do such a move operation after deleting a row.<br/>
179 A special case to note is the <code>next<code> call: When you delete row, say,
180 <code>15</code>, followed by <code>next</code>, then your <type>RowSet</type> afterwards
181 still is on row 15, since the deleted row vanished with the move operation.</dd>
183 <dt><member scope="com::sun::star::sdbc">XResultSet::refreshRow</member></dt>
184 <dd>will throw an exception when the cursor is on a deleted row.</dd>
186 <dt><type scope="com::sun::star::sdbc">XRow</type>: <code>getFoo</code></dt>
187 <dd>will return an empty value when the cursor is on a deleted row.</dd>
189 <dt><member scope="com::sun::star::sdbcx">XRowLocate::getBookmark</member></dt>
190 <dd>will throw an exception when the cursor is on a deleted row.</dd>
192 <dt><type scope="com::sun::star::sdbc">XRowUpdate</type>: <code>updateFoo</code></dt>
193 <dd>will throw an exception when the cursor is on a deleted row.</dd>
195 <dt><member scope="com::sun::star::sdbc">XResultSetUpdate::deleteRow</member></dt>
196 <dd>will throw an exception when the cursor is on a deleted row.</dd>
198 <dt><member scope="com::sun::star::sdbc">XResultSetUpdate::moveToInsertRow</member></dt>
199 <dd>will let the deleted row vanish from the result set. As a consequence, the <member>RowCount</member>
200 will decrease. Also, subsequent calls to
201 <member scope="com::sun::star::sdbc">XResultSetUpdate::moveToCurrentRow</member> will not
202 be able to move back to the deleted row (since it vanished), but only to the
203 row after the deleted row.</dd>
207 published service RowSet
209 service com
::sun
::star
::sdbc
::RowSet
;
211 service com
::sun
::star
::sdb
::ResultSet
;
213 /** can be used to allow an interaction handler to supply missing data during a execute process.
215 <p>If you want a row set to be based on a parametrized query, you will usually use
216 the <type scope="com::sun::star::sdbc">XParameters</type> interface.<br/>
217 However, you can also choose to let an interaction handler supply such data. For this, you may
218 for instance instantiate an <type>InteractionHandler</type>, which asks the user for the
219 data, or you may write your own one, which supplies the data from somewhere else.
220 The default implementation will only ask for parameters which aren't set before through the <type scope="com::sun::star::sdbc">XParameters</type> interface.</p>
222 @see com::sun::star::sdb::InteractionHandler
224 interface com
::sun
::star
::sdb
::XCompletedExecution
;
226 /** approving of actions performed on the rowset.
228 <p>The support of this interface implies a sematical extension to the <type scope="com::sun::star::sdbc">XResultSetUpdate</type>
229 interface which is supported via the <type scope="com::sun::star::sdbc">ResultSet</type>.</p>
231 @see XResultSetUpdate
233 interface XRowSetApproveBroadcaster
;
235 /** is the interface for updating row data to the database.
237 <p>The optional support of this interface is already implied with the support of the <type scope="com::sun::star::sdbc">ResultSet</type> service.</p>
239 <p>However, note that the additional support of the <type>XRowSetApproveBroadcaster</type> interface results
240 in a sematical extension: the methods <member scope="com::sun::star::sdbc">XResultSetUpdate::insertRow</member>,
241 <member scope="com::sun::star::sdbc">XResultSetUpdate::updateRow</member> and <member scope="com::sun::star::sdbc">XResultSetUpdate::deleteRow</member>
242 will now throw the <type>RowSetVetoException</type> if the action which is to be performed was vetoed
243 by one of the <type>XRowSetApproveListener</type>'s.</p>
245 [optional] interface com
::sun
::star
::sdbc
::XResultSetUpdate
;
247 /** is the interface for deleting more than one row, identified by it's bookmark.
249 <p>The optional support of this interface is already implied with the support of the <type scope="com::sun::star::sdbcx">ResultSet</type> service.</p>
251 <p>However, note that the additional support of the <type>XRowSetApproveBroadcaster</type> interface results
252 in a sematical extension: the method <member scope="com::sun::star::sdbcx">XDeleteRows::deleteRows</member>
253 will now throw the <type>RowSetVetoException</type> if the deletion was vetoed
254 by one of the <type>XRowSetApproveListener</type>'s.</p>
256 [optional] interface com
::sun
::star
::sdbcx
::XDeleteRows
;
258 /** creates a second result set which is based on the same data.
260 The new result set is interoperable with the row set which created it,
261 e.g., you can exchange bookmarks between both sets.
264 If the row set is not alive (i.e., it was not executed before),
269 interface XResultSetAccess
;
271 /** gives access to the parameters contained in the SQL statement represented by the component.
273 <p>If your <code>RowSet</code> is bound to an SQL command or query which contains parameters, or has
274 a <member>Filter</member> or <member>Order</member> which contains parameters, then those can be accessed
275 using the <code>XParametersSupplier</code> interface.</p>
277 <p>The returned container contains parameter objects which do allow write access to the parameters (which
278 is equivalent to using the <type scope="com::sun::star::sdbc">XParameters</type> interface inherited from
279 <type scope="com::sun::star::sdbc">RowSet</type>). Additionally, they provide information about the parameters,
280 such as their name (if they have one), their type, and the like.</p>
282 [optional] interface XParametersSupplier
;
284 /** is the connection generated by a DataSource or by a URL. It could
285 also be set from outside. When set from outside the RowSet is not responsible for the closing of the connection.
287 [property
] com
::sun
::star
::sdbc
::XConnection ActiveConnection
;
290 /** is the name of the datasource to use, this could be a named datasource
291 or the URL of a data access component.
293 [property
] string DataSourceName
;
296 /** is the command which should be executed, the type of command depends
299 <p>In case of a <member>CommandType</member> of <member>CommandType::COMMAND</member>,
300 means in case the <member>Command</member> specifies an SQL statement, the inherited
301 <member scope="com::sun::star::sdbc">RowSet::EscapeProcessing</member>
302 becomes relevant:<br/>
303 It then can be to used to specify whether the SQL statement should be analyzed on the
304 client side before sending it to the database server.<br/>
305 The default value for <member scope="com::sun::star::sdbc">RowSet::EscapeProcessing</member>
306 is <TRUE/>. By switching it to <FALSE/>, you can pass backend-specific SQL statements,
307 which are not standard SQL, to your database.</p>
309 @see com::sun::star::sdb::CommandType
310 @see com::sun::star::sdbc::RowSet::EscapeProcessing
312 [property
] string Command
;
314 /** is the type of the command.
315 @see com::sun::star::sdb::CommandType
317 [property
] long CommandType
;
319 /** is the command which is currently used.
320 @see com::sun::star::sdb::CommandType
322 [readonly, property
] string ActiveCommand
;
325 /** indicates whether all results should be discarded or not.
327 [property
] boolean IgnoreResult
;
330 /** additional filter for a rowset.
332 [property
] string Filter
;
335 /** indicates whether the filter should be applied or not,
338 [property
] boolean ApplyFilter
;
340 /** additional having clause for the row set
342 [optional,property
] string HavingClause
;
344 /** additional group by for the row set
346 [optional,property
] string GroupBy
;
348 /** is a additional sort order definition for a rowset.
350 [property
] string Order
;
353 /** indicates the privileges for insert, update, and delete.
354 @see com::sun::star::sdbcx::Privilege
356 [readonly, property
] long Privileges
;
359 /** indicates that the current row is modified.
361 [readonly, property
] boolean IsModified
;
364 /** indicates that the current row is going to be inserted to the database.
366 [readonly, property
] boolean IsNew
;
369 /** contains the number of rows accessed in a the data source.
371 [readonly, property
] long RowCount
;
374 /** indicates that all rows of te row set have been counted.
376 [readonly, property
] boolean IsRowCountFinal
;
379 /** is the name of the table which should be updated, this is usually used
380 for queries which relate to more than one table.
382 [optional, property
] string UpdateTableName
;
384 /** is the name of the table catalog
386 [optional, property
] string UpdateCatalogName
;
389 /** is the name of the table schema.
391 [optional, property
] string UpdateSchemaName
;
394 //=============================================================================
398 /*===========================================================================
399 ===========================================================================*/