1
/* CallableStatement.java -- A statement for calling stored procedures.
2
Copyright (C) 1999, 2000 Free Software Foundation, Inc.
4
This file is part of GNU Classpath.
6
GNU Classpath is free software; you can redistribute it and/or modify
7
it under the terms of the GNU General Public License as published by
8
the Free Software Foundation; either version 2, or (at your option)
11
GNU Classpath is distributed in the hope that it will be useful, but
12
WITHOUT ANY WARRANTY; without even the implied warranty of
13
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14
General Public License for more details.
16
You should have received a copy of the GNU General Public License
17
along with GNU Classpath; see the file COPYING. If not, write to the
18
Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
21
Linking this library statically or dynamically with other modules is
22
making a combined work based on this library. Thus, the terms and
23
conditions of the GNU General Public License cover the whole
26
As a special exception, the copyright holders of this library give you
27
permission to link this library with independent modules to produce an
28
executable, regardless of the license terms of these independent
29
modules, and to copy and distribute the resulting executable under
30
terms of your choice, provided that you also meet, for each linked
31
independent module, the terms and conditions of the license of that
32
module. An independent module is a module which is not derived from
33
or based on this library. If you modify this library, you may extend
34
this exception to your version of the library, but you are not
35
obligated to do so. If you do not wish to do so, delete this
36
exception statement from your version. */
41
import java.io.InputStream;
42
import java.io.Reader;
43
import java.math.BigDecimal;
44
import java.util.Calendar;
48
* This interface provides a mechanism for calling stored procedures.
50
* @author Aaron M. Renn (arenn@urbanophile.com)
52
public interface CallableStatement extends PreparedStatement
55
/*************************************************************************/
58
* This method tests whether the value of the last parameter that was fetched
59
* was actually a SQL NULL value.
61
* @return <code>true</code> if the last parameter fetched was a NULL,
62
* <code>false</code> otherwise.
64
* @exception SQLException If an error occurs.
66
public abstract boolean
67
wasNull() throws SQLException;
69
/*************************************************************************/
72
* This method returns the value of the specified parameter as a Java
73
* <code>String</code>.
75
* @param index The index of the parameter to return.
77
* @return The parameter value as a <code>String</code>.
79
* @exception SQLException If an error occurs.
81
public abstract String
82
getString(int index) throws SQLException;
84
/*************************************************************************/
87
* This method returns the value of the specified parameter as a Java
88
* <code>Object</code>.
90
* @param index The index of the parameter to return.
92
* @return The parameter value as an <code>Object</code>.
94
* @exception SQLException If an error occurs.
96
public abstract Object
97
getObject(int index) throws SQLException;
99
/*************************************************************************/
102
* This method returns the value of the specified parameter as a Java
103
* <code>Object</code>.
105
* @param index The index of the parameter to return.
106
* @param map The mapping to use for conversion from SQL to Java types.
108
* @return The parameter value as an <code>Object</code>.
110
* @exception SQLException If an error occurs.
112
public abstract Object
113
getObject(int index, Map map) throws SQLException;
115
/*************************************************************************/
118
* This method returns the value of the specified parameter as a Java
119
* <code>boolean</code>.
121
* @param index The index of the parameter to return.
123
* @return The parameter value as a <code>boolean</code>.
125
* @exception SQLException If an error occurs.
127
public abstract boolean
128
getBoolean(int index) throws SQLException;
130
/*************************************************************************/
133
* This method returns the value of the specified parameter as a Java
136
* @param index The index of the parameter to return.
138
* @return The parameter value as a <code>byte</code>.
140
* @exception SQLException If an error occurs.
143
getByte(int index) throws SQLException;
145
/*************************************************************************/
148
* This method returns the value of the specified parameter as a Java
149
* <code>short</code>.
151
* @param index The index of the parameter to return.
153
* @return The parameter value as a <code>short</code>.
155
* @exception SQLException If an error occurs.
157
public abstract short
158
getShort(int index) throws SQLException;
160
/*************************************************************************/
163
* This method returns the value of the specified parameter as a Java
166
* @param index The index of the parameter to return.
168
* @return The parameter value as a <code>int</code>.
170
* @exception SQLException If an error occurs.
173
getInt(int index) throws SQLException;
175
/*************************************************************************/
178
* This method returns the value of the specified parameter as a Java
181
* @param index The index of the parameter to return.
183
* @return The parameter value as a <code>long</code>.
185
* @exception SQLException If an error occurs.
188
getLong(int index) throws SQLException;
190
/*************************************************************************/
193
* This method returns the value of the specified parameter as a Java
194
* <code>float</code>.
196
* @param index The index of the parameter to return.
198
* @return The parameter value as a <code>float</code>.
200
* @exception SQLException If an error occurs.
202
public abstract float
203
getFloat(int index) throws SQLException;
205
/*************************************************************************/
208
* This method returns the value of the specified parameter as a Java
209
* <code>double</code>.
211
* @param index The index of the parameter to return.
213
* @return The parameter value as a <code>double</code>.
215
* @exception SQLException If an error occurs.
217
public abstract double
218
getDouble(int index) throws SQLException;
220
/*************************************************************************/
223
* This method returns the value of the specified parameter as a Java
224
* <code>BigDecimal</code>.
226
* @param index The index of the parameter to return.
228
* @return The parameter value as a <code>BigDecimal</code>.
230
* @exception SQLException If an error occurs.
232
public abstract BigDecimal
233
getBigDecimal(int index) throws SQLException;
235
/*************************************************************************/
238
* This method returns the value of the specified parameter as a Java
239
* <code>BigDecimal</code>.
241
* @param index The index of the parameter to return.
242
* @param scale The number of digits to the right of the decimal to return.
244
* @return The parameter value as a <code>BigDecimal</code>.
246
* @exception SQLException If an error occurs.
248
public abstract BigDecimal
249
getBigDecimal(int index, int scale) throws SQLException;
251
/*************************************************************************/
254
* This method returns the value of the specified parameter as a Java
257
* @param index The index of the parameter to return.
259
* @return The parameter value as a byte array
261
* @exception SQLException If an error occurs.
263
public abstract byte[]
264
getBytes(int index) throws SQLException;
266
/*************************************************************************/
269
* This method returns the value of the specified parameter as a Java
270
* <code>java.sql.Date</code>.
272
* @param index The index of the parameter to return.
274
* @return The parameter value as a <code>java.sql.Date</code>.
276
* @exception SQLException If an error occurs.
278
public abstract java.sql.Date
279
getDate(int index) throws SQLException;
281
/*************************************************************************/
284
* This method returns the value of the specified parameter as a Java
285
* <code>java.sql.Date</code>.
287
* @param index The index of the parameter to return.
288
* @param calendar The <code>Calendar</code> to use for timezone and locale.
290
* @return The parameter value as a <code>java.sql.Date</code>.
292
* @exception SQLException If an error occurs.
294
public abstract java.sql.Date
295
getDate(int index, Calendar calendar) throws SQLException;
297
/*************************************************************************/
300
* This method returns the value of the specified parameter as a Java
301
* <code>java.sql.Time</code>.
303
* @param index The index of the parameter to return.
305
* @return The parameter value as a <code>java.sql.Time</code>.
307
* @exception SQLException If an error occurs.
309
public abstract java.sql.Time
310
getTime(int index) throws SQLException;
312
/*************************************************************************/
315
* This method returns the value of the specified parameter as a Java
316
* <code>java.sql.Time</code>.
318
* @param index The index of the parameter to return.
319
* @param calendar The <code>Calendar</code> to use for timezone and locale.
321
* @return The parameter value as a <code>java.sql.Time</code>.
323
* @exception SQLException If an error occurs.
325
public abstract java.sql.Time
326
getTime(int index, Calendar calendar) throws SQLException;
328
/*************************************************************************/
331
* This method returns the value of the specified parameter as a Java
332
* <code>java.sql.Timestamp</code>.
334
* @param index The index of the parameter to return.
336
* @return The parameter value as a <code>java.sql.Timestamp</code>.
338
* @exception SQLException If an error occurs.
340
public abstract java.sql.Timestamp
341
getTimestamp(int index) throws SQLException;
343
/*************************************************************************/
346
* This method returns the value of the specified parameter as a Java
347
* <code>java.sql.Timestamp</code>.
349
* @param index The index of the parameter to return.
350
* @param calendar The <code>Calendar</code> to use for timezone and locale.
352
* @return The parameter value as a <code>java.sql.Timestamp</code>.
354
* @exception SQLException If an error occurs.
356
public abstract java.sql.Timestamp
357
getTimestamp(int index, Calendar calendar) throws SQLException;
359
/*************************************************************************/
362
* This method returns the value of the specified parameter as a Java
365
* @param index The index of the parameter to return.
367
* @return The parameter value as a <code>Ref</code>.
369
* @exception SQLException If an error occurs.
372
getRef(int index) throws SQLException;
374
/*************************************************************************/
377
* This method returns the value of the specified parameter as a Java
380
* @param index The index of the parameter to return.
382
* @return The parameter value as a <code>Blob</code>.
384
* @exception SQLException If an error occurs.
387
getBlob(int index) throws SQLException;
389
/*************************************************************************/
392
* This method returns the value of the specified parameter as a Java
395
* @param index The index of the parameter to return.
397
* @return The parameter value as a <code>Clob</code>.
399
* @exception SQLException If an error occurs.
402
getClob(int index) throws SQLException;
404
/*************************************************************************/
407
* This method returns the value of the specified parameter as a Java
408
* <code>Array</code>.
410
* @param index The index of the parameter to return.
412
* @return The parameter value as a <code>Array</code>.
414
* @exception SQLException If an error occurs.
416
public abstract Array
417
getArray(int index) throws SQLException;
419
/*************************************************************************/
422
* This method registers the specified parameter as an output parameter
423
* of the specified SQL type.
425
* @param index The index of the parameter to register as output.
426
* @param type The SQL type value from <code>Types</code>.
428
* @exception SQLException If an error occurs.
431
registerOutParameter(int index, int type) throws SQLException;
433
/*************************************************************************/
436
* This method registers the specified parameter as an output parameter
437
* of the specified SQL type.
439
* @param index The index of the parameter to register as output.
440
* @param type The SQL type value from <code>Types</code>.
441
* @param name The user defined data type name.
443
* @exception SQLException If an error occurs.
446
registerOutParameter(int index, int type, String name) throws SQLException;
448
/*************************************************************************/
451
* This method registers the specified parameter as an output parameter
452
* of the specified SQL type and scale.
454
* @param index The index of the parameter to register as output.
455
* @param type The SQL type value from <code>Types</code>.
456
* @param scale The scale of the value that will be returned.
458
* @exception SQLException If an error occurs.
461
registerOutParameter(int index, int type, int scale) throws SQLException;
463
} // interface CallableStatement