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