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#ifndef __com_sun_star_sdbc_XStatement_idl__
24#define __com_sun_star_sdbc_XStatement_idl__
25
26#ifndef __com_sun_star_uno_XInterface_idl__
27#include <com/sun/star/uno/XInterface.idl>
28#endif
29
30#ifndef __com_sun_star_sdbc_SQLException_idl__
31#include <com/sun/star/sdbc/SQLException.idl>
32#endif
33
34 module com {  module sun {  module star {  module sdbc {
35
36 published interface XConnection;
37 published interface XResultSet;
38
39
40/** is used for executing a static SQL statement and obtaining the results
41	produced by it.
42
43
44
45	<p>
46	Only one ResultSet per Statement can be open at any point in
47	time; therefore, if the reading of one ResultSet is interleaved
48	with the reading of another, each must have been generated by
49	different Statements. All statement
50	<code>execute</code>
51	methods implicitly
52	close a statement's current ResultSet if an open one exists.
53	</p>
54 */
55published interface XStatement: com::sun::star::uno::XInterface
56{
57
58	/** executes a SQL statement that returns a single ResultSet.
59		@param sql
60			the SQL statement which should be executed
61		@returns
62			a ResultSet that contains the data produced by the query; never <NULL/>
63		@throws SQLException
64			if a database access error occurs.
65	 */
66	XResultSet executeQuery([in]string sql) raises (SQLException);
67	//-------------------------------------------------------------------------
68
69	/** executes an SQL INSERT, UPDATE, or DELETE statement. In addition,
70		SQL statements that return nothing, such as SQL DDL statements,
71		can be executed.
72
73		@param sql
74			a SQL INSERT, UPDATE or DELETE statement or a SQL statement that returns nothing
75		@returns
76			either the row count for INSERT, UPDATE or DELETE or 0 for SQL statements that return nothing
77		@throws SQLException
78			if a database access error occurs.
79	 */
80	long executeUpdate([in]string sql) raises (SQLException);
81	//-------------------------------------------------------------------------
82
83	/** executes a SQL statement that may return multiple results.
84
85
86		<p>
87		Under some (uncommon) situations a single SQL statement may return
88		multiple result sets and/or update counts. Normally you can ignore
89		this unless you are (1) executing a stored procedure that you know may
90		return multiple results or (2) you are dynamically executing an
91		unknown SQL string. The navigation through multiple results is covered by
92		<type scope="com::sun::star::sdbc">XMultipleResults</type>.
93		</p>
94		<p>
95		The
96		<code>execute</code>
97		method executes a SQL statement and indicates
98		the form of the first result. You can then use
99		<member scope="com::sun::star::sdbc">XStatement::getResultSet()</member>
100		or
101		<member scope="com::sun::star::sdbc">XStatement::getUpdateCount()</member>
102		to retrieve the result, and
103		<member scope="com::sun::star::sdbc">XStatement::getMoreResults()</member>
104		to move to any subsequent result(s).
105		</p>
106
107		@param sql
108			any SQL statement
109		@returns
110			<TRUE/> if the next result is a ResultSet; <FALSE/> if it is an update count or there are no more results
111		@throws SQLException
112			if a database access error occurs.
113	 */
114	boolean execute([in]string sql) raises (SQLException);
115	//-------------------------------------------------------------------------
116
117	/** returns the
118		<type scope="com::sun::star::sdbc">Connection</type>
119		object
120		that produced this
121		<code>Statement</code>
122		object.
123		@returns
124			the connection that produced this statement
125
126		@throws SQLException
127			if a database access error occurs.
128	 */
129	XConnection getConnection() raises (SQLException);
130};
131
132//=============================================================================
133
134}; }; }; };
135
136/*===========================================================================
137===========================================================================*/
138#endif
139