1*cdf0e10cSrcweir/*************************************************************************
2*cdf0e10cSrcweir *
3*cdf0e10cSrcweir * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4*cdf0e10cSrcweir *
5*cdf0e10cSrcweir * Copyright 2000, 2010 Oracle and/or its affiliates.
6*cdf0e10cSrcweir *
7*cdf0e10cSrcweir * OpenOffice.org - a multi-platform office productivity suite
8*cdf0e10cSrcweir *
9*cdf0e10cSrcweir * This file is part of OpenOffice.org.
10*cdf0e10cSrcweir *
11*cdf0e10cSrcweir * OpenOffice.org is free software: you can redistribute it and/or modify
12*cdf0e10cSrcweir * it under the terms of the GNU Lesser General Public License version 3
13*cdf0e10cSrcweir * only, as published by the Free Software Foundation.
14*cdf0e10cSrcweir *
15*cdf0e10cSrcweir * OpenOffice.org is distributed in the hope that it will be useful,
16*cdf0e10cSrcweir * but WITHOUT ANY WARRANTY; without even the implied warranty of
17*cdf0e10cSrcweir * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18*cdf0e10cSrcweir * GNU Lesser General Public License version 3 for more details
19*cdf0e10cSrcweir * (a copy is included in the LICENSE file that accompanied this code).
20*cdf0e10cSrcweir *
21*cdf0e10cSrcweir * You should have received a copy of the GNU Lesser General Public License
22*cdf0e10cSrcweir * version 3 along with OpenOffice.org.  If not, see
23*cdf0e10cSrcweir * <http://www.openoffice.org/license.html>
24*cdf0e10cSrcweir * for a copy of the LGPLv3 License.
25*cdf0e10cSrcweir *
26*cdf0e10cSrcweir ************************************************************************/
27*cdf0e10cSrcweir#ifndef __com_sun_star_sdbc_PreparedStatement_idl__
28*cdf0e10cSrcweir#define __com_sun_star_sdbc_PreparedStatement_idl__
29*cdf0e10cSrcweir
30*cdf0e10cSrcweir#ifndef __com_sun_star_lang_XComponent_idl__
31*cdf0e10cSrcweir#include <com/sun/star/lang/XComponent.idl>
32*cdf0e10cSrcweir#endif
33*cdf0e10cSrcweir
34*cdf0e10cSrcweir#ifndef __com_sun_star_beans_XPropertySet_idl__
35*cdf0e10cSrcweir#include <com/sun/star/beans/XPropertySet.idl>
36*cdf0e10cSrcweir#endif
37*cdf0e10cSrcweir
38*cdf0e10cSrcweir#ifndef __com_sun_star_util_XCancellable_idl__
39*cdf0e10cSrcweir#include <com/sun/star/util/XCancellable.idl>
40*cdf0e10cSrcweir#endif
41*cdf0e10cSrcweir
42*cdf0e10cSrcweir module com {  module sun {  module star {  module sdbc {
43*cdf0e10cSrcweir
44*cdf0e10cSrcweir published interface XPreparedStatement;
45*cdf0e10cSrcweir published interface XPreparedBatchExecution;
46*cdf0e10cSrcweir published interface XParameters;
47*cdf0e10cSrcweir published interface XWarningsSupplier;
48*cdf0e10cSrcweir published interface XMultipleResults;
49*cdf0e10cSrcweir published interface XResultSetMetaDataSupplier;
50*cdf0e10cSrcweir published interface XCloseable;
51*cdf0e10cSrcweir
52*cdf0e10cSrcweir
53*cdf0e10cSrcweir/** represents a precompiled SQL statement.
54*cdf0e10cSrcweir	 <P>
55*cdf0e10cSrcweir	 A SQL statement is pre-compiled and stored in a PreparedStatement object.
56*cdf0e10cSrcweir	 This object can then be used to efficiently execute this statement multiple
57*cdf0e10cSrcweir	 times.
58*cdf0e10cSrcweir	 </P>
59*cdf0e10cSrcweir	 <P>
60*cdf0e10cSrcweir	 <B>
61*cdf0e10cSrcweir	 Note:
62*cdf0e10cSrcweir	 </B>
63*cdf0e10cSrcweir	 The
64*cdf0e10cSrcweir	 <code>setXXX</code>
65*cdf0e10cSrcweir	 methods for setting IN parameter values
66*cdf0e10cSrcweir	 must specify types that are compatible with the defined SQL type of
67*cdf0e10cSrcweir	 the input parameter. For instance, if the IN parameter has SQL type
68*cdf0e10cSrcweir	 Integer, then the method
69*cdf0e10cSrcweir	 <member scope="com::sun::star::sdbc">XParameters::setInt()</member>
70*cdf0e10cSrcweir	 should be used.
71*cdf0e10cSrcweir	 </P>
72*cdf0e10cSrcweir	 <p>
73*cdf0e10cSrcweir	 If arbitrary parameter type conversions are required, the method
74*cdf0e10cSrcweir	 <member scope="com::sun::star::sdbc">XParameters::setObject()</member>
75*cdf0e10cSrcweir	 should be used with a target SQL type.
76*cdf0e10cSrcweir	 </p>
77*cdf0e10cSrcweir	 <p>
78*cdf0e10cSrcweir	 Example of setting a parameter; <code>con</code> is an active connection.
79*cdf0e10cSrcweir	 @example:StarBASIC
80*cdf0e10cSrcweir	 <listing>
81*cdf0e10cSrcweir	 pstmt = con.prepareStatement("UPDATE EMPLOYEES SET SALARY = ? WHERE ID = ?")
82*cdf0e10cSrcweir	 pstmt.setDouble(1, 153833.00)
83*cdf0e10cSrcweir	 pstmt.setLong(2, 110592)
84*cdf0e10cSrcweir	 </listing>
85*cdf0e10cSrcweir	 </p>
86*cdf0e10cSrcweir	 <P>
87*cdf0e10cSrcweir	 Only one
88*cdf0e10cSrcweir	 <type scope="com::sun::star::sdbc">ResultSet</type>
89*cdf0e10cSrcweir	 per
90*cdf0e10cSrcweir	 <type scope="com::sun::star::sdbc">Statement</type>
91*cdf0e10cSrcweir	 can be open at any point in
92*cdf0e10cSrcweir	 time. Therefore, if the reading of one ResultSet is interleaved
93*cdf0e10cSrcweir	 with the reading of another, each must have been generated by
94*cdf0e10cSrcweir	 different Statements. All statement
95*cdf0e10cSrcweir	 <code>execute</code>
96*cdf0e10cSrcweir	 methods implicitly close a statement's current ResultSet if an open one exists.
97*cdf0e10cSrcweir	 </p>
98*cdf0e10cSrcweir */
99*cdf0e10cSrcweirpublished service PreparedStatement
100*cdf0e10cSrcweir{
101*cdf0e10cSrcweir
102*cdf0e10cSrcweir	/** optional for implementation, controls the releasing of resources
103*cdf0e10cSrcweir			 and the notification of registered listeners.
104*cdf0e10cSrcweir	 */
105*cdf0e10cSrcweir	[optional] interface com::sun::star::lang::XComponent;
106*cdf0e10cSrcweir
107*cdf0e10cSrcweir
108*cdf0e10cSrcweir	/** freeing all resources of a statement. A related resultset will be
109*cdf0e10cSrcweir			 freed as well.
110*cdf0e10cSrcweir	 */
111*cdf0e10cSrcweir	interface XCloseable;
112*cdf0e10cSrcweir
113*cdf0e10cSrcweir	// gives access to the properties.
114*cdf0e10cSrcweir	interface com::sun::star::beans::XPropertySet;
115*cdf0e10cSrcweir
116*cdf0e10cSrcweir	/** could be used for cancelling the execution of SQL statements, if both
117*cdf0e10cSrcweir			 the DBMS and the driver support aborting an SQL statement.
118*cdf0e10cSrcweir			 The implementation is optional.
119*cdf0e10cSrcweir	 */
120*cdf0e10cSrcweir	[optional] interface com::sun::star::util::XCancellable;
121*cdf0e10cSrcweir
122*cdf0e10cSrcweir	/** is the interface for executing SQL prepared commands.
123*cdf0e10cSrcweir	 */
124*cdf0e10cSrcweir	interface XPreparedStatement;
125*cdf0e10cSrcweir
126*cdf0e10cSrcweir
127*cdf0e10cSrcweir	/** provides access to the description of the result set which would be generated by executing the
128*cdf0e10cSrcweir        <type>PreparedStatement</type>.
129*cdf0e10cSrcweir	 */
130*cdf0e10cSrcweir	interface XResultSetMetaDataSupplier;
131*cdf0e10cSrcweir
132*cdf0e10cSrcweir
133*cdf0e10cSrcweir	/** is used for setting parameters before execution of the precompiled
134*cdf0e10cSrcweir			 statement.
135*cdf0e10cSrcweir	 */
136*cdf0e10cSrcweir	interface XParameters;
137*cdf0e10cSrcweir
138*cdf0e10cSrcweir
139*cdf0e10cSrcweir	/** provides the ability of batch execution. This interface is optional
140*cdf0e10cSrcweir			 for execution.
141*cdf0e10cSrcweir			 <p>
142*cdf0e10cSrcweir			 A driver implementing batch execution must return
143*cdf0e10cSrcweir			 <TRUE/>
144*cdf0e10cSrcweir			 for
145*cdf0e10cSrcweir			 <member scope= "com::sun::star::sdbc">XDatabaseMetaData::supportsBatchUpdates()</member>
146*cdf0e10cSrcweir			 </p>
147*cdf0e10cSrcweir	 */
148*cdf0e10cSrcweir	[optional] interface XPreparedBatchExecution;
149*cdf0e10cSrcweir
150*cdf0e10cSrcweir
151*cdf0e10cSrcweir	/** controls the chaining of warnings, which may occur on every call
152*cdf0e10cSrcweir			 to the connected database. Chained warnings from previous calls will be
153*cdf0e10cSrcweir			 cleared before processing a new call.
154*cdf0e10cSrcweir	 */
155*cdf0e10cSrcweir	interface XWarningsSupplier;
156*cdf0e10cSrcweir
157*cdf0e10cSrcweir
158*cdf0e10cSrcweir	/** covers the handling of multiple results after executing an SQL command.
159*cdf0e10cSrcweir	 */
160*cdf0e10cSrcweir	interface XMultipleResults;
161*cdf0e10cSrcweir
162*cdf0e10cSrcweir
163*cdf0e10cSrcweir	/** retrieves the number of seconds the driver will wait for a Statement
164*cdf0e10cSrcweir			  to execute. If the limit is exceeded, a SQLException is thrown.
165*cdf0e10cSrcweir			  There is no limitation, if set to zero.
166*cdf0e10cSrcweir	 */
167*cdf0e10cSrcweir	[property] long QueryTimeOut;
168*cdf0e10cSrcweir
169*cdf0e10cSrcweir
170*cdf0e10cSrcweir	/** returns the maximum number of bytes allowed for any column value.
171*cdf0e10cSrcweir			  <p>
172*cdf0e10cSrcweir			  This limit is the maximum number of bytes that can be returned
173*cdf0e10cSrcweir			  for any column value. The limit applies only to
174*cdf0e10cSrcweir			  <member scope= "com::sun::star::sdbc">DataType::BINARY</member>
175*cdf0e10cSrcweir			  ,
176*cdf0e10cSrcweir			  <member scope= "com::sun::star::sdbc">DataType::VARBINARY</member>
177*cdf0e10cSrcweir			  ,
178*cdf0e10cSrcweir			  <member scope= "com::sun::star::sdbc">DataType::LONGVARBINARY</member>
179*cdf0e10cSrcweir			  ,
180*cdf0e10cSrcweir			  <member scope= "com::sun::star::sdbc">DataType::CHAR</member>
181*cdf0e10cSrcweir			  ,
182*cdf0e10cSrcweir			  <member scope= "com::sun::star::sdbc">DataType::VARCHAR</member>
183*cdf0e10cSrcweir			  ,
184*cdf0e10cSrcweir			  and
185*cdf0e10cSrcweir			  <member scope= "com::sun::star::sdbc">DataType::LONGVARCHAR</member>
186*cdf0e10cSrcweir			  columns.
187*cdf0e10cSrcweir			  If the limit is exceeded, the excess data is silently discarded.
188*cdf0e10cSrcweir			  </p>
189*cdf0e10cSrcweir			  <p>
190*cdf0e10cSrcweir			  There is no limitation, if set to zero.
191*cdf0e10cSrcweir			  </p>
192*cdf0e10cSrcweir	 */
193*cdf0e10cSrcweir	[property] long MaxFieldSize;
194*cdf0e10cSrcweir
195*cdf0e10cSrcweir
196*cdf0e10cSrcweir	/** retrieves the maximum number of rows that a ResultSet can contain.
197*cdf0e10cSrcweir			 If the limit is exceeded, the excess rows are silently dropped.
198*cdf0e10cSrcweir			 <br>There is no limitation, if set to zero.
199*cdf0e10cSrcweir	 */
200*cdf0e10cSrcweir	[property] long MaxRows;
201*cdf0e10cSrcweir
202*cdf0e10cSrcweir
203*cdf0e10cSrcweir	/** defines the SQL cursor name that will be used by subsequent Statement
204*cdf0e10cSrcweir			 <code>execute</code>
205*cdf0e10cSrcweir			 methods.
206*cdf0e10cSrcweir			 <p>
207*cdf0e10cSrcweir			 This name can then be used in SQL positioned update/delete statements to
208*cdf0e10cSrcweir			 identify the current row in the ResultSet generated by this statement. If
209*cdf0e10cSrcweir			 the database does not support positioned update/delete, this property is
210*cdf0e10cSrcweir			 a noop. To insure that a cursor has the proper isolation level to support
211*cdf0e10cSrcweir			 updates, the cursor's SELECT statement should be of the form
212*cdf0e10cSrcweir			 'select for update ...'. If the 'for update' phrase is omitted,
213*cdf0e10cSrcweir			 positioned updates may fail.
214*cdf0e10cSrcweir			 </p>
215*cdf0e10cSrcweir			 <P>
216*cdf0e10cSrcweir			 <B>
217*cdf0e10cSrcweir			 Note:
218*cdf0e10cSrcweir			 </B>
219*cdf0e10cSrcweir			 By definition, positioned update/delete
220*cdf0e10cSrcweir		     execution must be done by a different Statement than the one
221*cdf0e10cSrcweir		     which generated the ResultSet being used for positioning. Also,
222*cdf0e10cSrcweir		     cursor names must be unique within a connection.
223*cdf0e10cSrcweir			 </p>
224*cdf0e10cSrcweir	 */
225*cdf0e10cSrcweir	[property] string CursorName;
226*cdf0e10cSrcweir
227*cdf0e10cSrcweir
228*cdf0e10cSrcweir	/** retrieves the result set concurrency.
229*cdf0e10cSrcweir			 @see com::sun::star::sdbc::ResultSetConcurrency
230*cdf0e10cSrcweir	 */
231*cdf0e10cSrcweir	[property] long ResultSetConcurrency;
232*cdf0e10cSrcweir
233*cdf0e10cSrcweir
234*cdf0e10cSrcweir	/** Determine the result set type.
235*cdf0e10cSrcweir			 @see com::sun::star::sdbc::ResultSetType
236*cdf0e10cSrcweir	 */
237*cdf0e10cSrcweir	[property] long ResultSetType;
238*cdf0e10cSrcweir
239*cdf0e10cSrcweir
240*cdf0e10cSrcweir	/** retrieves the direction for fetching rows from database tables
241*cdf0e10cSrcweir			 that is the default for result sets generated from this
242*cdf0e10cSrcweir			 <code>Statement</code>
243*cdf0e10cSrcweir			 object.
244*cdf0e10cSrcweir			 <p>
245*cdf0e10cSrcweir			 If this
246*cdf0e10cSrcweir			 <code>Statement</code>
247*cdf0e10cSrcweir			 object has not set a fetch direction,
248*cdf0e10cSrcweir			 the return value is implementation-specific.
249*cdf0e10cSrcweir			 </p>
250*cdf0e10cSrcweir	 */
251*cdf0e10cSrcweir	[property] long FetchDirection;
252*cdf0e10cSrcweir
253*cdf0e10cSrcweir
254*cdf0e10cSrcweir	/** retrieves the number of result set rows that is the default fetch size
255*cdf0e10cSrcweir			 for result sets generated from this
256*cdf0e10cSrcweir			 <code>Statement</code>
257*cdf0e10cSrcweir			 object.
258*cdf0e10cSrcweir			 <p>
259*cdf0e10cSrcweir			 If this
260*cdf0e10cSrcweir			 <code>Statement</code>
261*cdf0e10cSrcweir			 object has not set a fetch size,
262*cdf0e10cSrcweir			 the return value is implementation-specific.
263*cdf0e10cSrcweir			 </p>
264*cdf0e10cSrcweir	 */
265*cdf0e10cSrcweir	[property] long FetchSize;
266*cdf0e10cSrcweir};
267*cdf0e10cSrcweir
268*cdf0e10cSrcweir//=============================================================================
269*cdf0e10cSrcweir
270*cdf0e10cSrcweir}; }; }; };
271*cdf0e10cSrcweir
272*cdf0e10cSrcweir#endif
273