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