2003-12-26 Guilhem Lavaux <guilhem@kaffe.org>
[official-gcc.git] / libjava / java / sql / CallableStatement.java
blob68a22d03aeaad4360bd57d956fddf15909a36810
1 /* CallableStatement.java -- A statement for calling stored procedures.
2 Copyright (C) 1999, 2000, 2002 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)
9 any later version.
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
19 02111-1307 USA.
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
24 combination.
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. */
38 package java.sql;
40 import java.io.InputStream;
41 import java.io.Reader;
42 import java.math.BigDecimal;
43 import java.net.URL;
44 import java.util.Calendar;
45 import java.util.Map;
47 /**
48 * This interface provides a mechanism for calling stored procedures.
50 * @author Aaron M. Renn (arenn@urbanophile.com)
52 public interface CallableStatement extends PreparedStatement
54 /**
55 * This method registers the specified parameter as an output parameter
56 * of the specified SQL type.
58 * @param index The index of the parameter to register as output.
59 * @param type The SQL type value from <code>Types</code>.
60 * @exception SQLException If an error occurs.
61 */
62 void registerOutParameter(int parameterIndex, int sqlType)
63 throws SQLException;
65 /**
66 * This method registers the specified parameter as an output parameter
67 * of the specified SQL type and scale.
69 * @param index The index of the parameter to register as output.
70 * @param type The SQL type value from <code>Types</code>.
71 * @param scale The scale of the value that will be returned.
72 * @exception SQLException If an error occurs.
73 */
74 void registerOutParameter(int parameterIndex, int sqlType, int scale)
75 throws SQLException;
77 /**
78 * This method tests whether the value of the last parameter that was fetched
79 * was actually a SQL NULL value.
81 * @return <code>true</code> if the last parameter fetched was a NULL,
82 * <code>false</code> otherwise.
83 * @exception SQLException If an error occurs.
85 boolean wasNull() throws SQLException;
87 /**
88 * This method returns the value of the specified parameter as a Java
89 * <code>String</code>.
91 * @param index The index of the parameter to return.
92 * @return The parameter value as a <code>String</code>.
93 * @exception SQLException If an error occurs.
95 String getString(int parameterIndex) throws SQLException;
97 /**
98 * This method returns the value of the specified parameter as a Java
99 * <code>boolean</code>.
101 * @param index The index of the parameter to return.
102 * @return The parameter value as a <code>boolean</code>.
103 * @exception SQLException If an error occurs.
105 boolean getBoolean(int parameterIndex) throws SQLException;
108 * This method returns the value of the specified parameter as a Java
109 * <code>byte</code>.
111 * @param index The index of the parameter to return.
112 * @return The parameter value as a <code>byte</code>.
113 * @exception SQLException If an error occurs.
115 byte getByte(int parameterIndex) throws SQLException;
118 * This method returns the value of the specified parameter as a Java
119 * <code>short</code>.
121 * @param index The index of the parameter to return.
122 * @return The parameter value as a <code>short</code>.
123 * @exception SQLException If an error occurs.
125 short getShort(int parameterIndex) throws SQLException;
128 * This method returns the value of the specified parameter as a Java
129 * <code>int</code>.
131 * @param index The index of the parameter to return.
132 * @return The parameter value as a <code>int</code>.
133 * @exception SQLException If an error occurs.
135 int getInt(int parameterIndex) throws SQLException;
138 * This method returns the value of the specified parameter as a Java
139 * <code>long</code>.
141 * @param index The index of the parameter to return.
142 * @return The parameter value as a <code>long</code>.
143 * @exception SQLException If an error occurs.
145 long getLong(int parameterIndex) throws SQLException;
148 * This method returns the value of the specified parameter as a Java
149 * <code>float</code>.
151 * @param index The index of the parameter to return.
152 * @return The parameter value as a <code>float</code>.
153 * @exception SQLException If an error occurs.
155 float getFloat(int parameterIndex) throws SQLException;
158 * This method returns the value of the specified parameter as a Java
159 * <code>double</code>.
161 * @param index The index of the parameter to return.
162 * @return The parameter value as a <code>double</code>.
163 * @exception SQLException If an error occurs.
165 double getDouble(int parameterIndex) throws SQLException;
168 * This method returns the value of the specified parameter as a Java
169 * <code>BigDecimal</code>.
171 * @param parameterIndex The index of the parameter to return.
172 * @param scale The number of digits to the right of the decimal to return.
173 * @return The parameter value as a <code>BigDecimal</code>.
174 * @exception SQLException If an error occurs.
175 * @deprecated Use getBigDecimal(int parameterIndex)
176 * or getBigDecimal(String parameterName) instead.
178 BigDecimal getBigDecimal(int parameterIndex, int scale)
179 throws SQLException;
182 * This method returns the value of the specified parameter as a Java
183 * byte array.
185 * @param parameterIndex The index of the parameter to return.
186 * @return The parameter value as a byte array
187 * @exception SQLException If an error occurs.
189 byte[] getBytes(int parameterIndex) throws SQLException;
192 * This method returns the value of the specified parameter as a Java
193 * <code>java.sql.Date</code>.
195 * @param index The index of the parameter to return.
196 * @return The parameter value as a <code>java.sql.Date</code>.
197 * @exception SQLException If an error occurs.
199 Date getDate(int parameterIndex) throws SQLException;
202 * This method returns the value of the specified parameter as a Java
203 * <code>java.sql.Time</code>.
205 * @param index The index of the parameter to return.
206 * @return The parameter value as a <code>java.sql.Time</code>.
207 * @exception SQLException If an error occurs.
209 Time getTime(int parameterIndex) throws SQLException;
212 * This method returns the value of the specified parameter as a Java
213 * <code>java.sql.Timestamp</code>.
215 * @param index The index of the parameter to return.
216 * @return The parameter value as a <code>java.sql.Timestamp</code>.
217 * @exception SQLException If an error occurs.
219 Timestamp getTimestamp(int parameterIndex) throws SQLException;
222 * This method returns the value of the specified parameter as a Java
223 * <code>Object</code>.
225 * @param parameterIndex The index of the parameter to return.
226 * @return The parameter value as an <code>Object</code>.
227 * @exception SQLException If an error occurs.
228 * @since 1.2
230 Object getObject(int parameterIndex) throws SQLException;
233 * This method returns the value of the specified parameter as a Java
234 * <code>BigDecimal</code>.
236 * @param parameterIndex The index of the parameter to return.
237 * @return The parameter value as a <code>BigDecimal</code>.
238 * @exception SQLException If an error occurs.
239 * @since 1.2
241 BigDecimal getBigDecimal(int parameterIndex) throws SQLException;
244 * This method returns the value of the specified parameter as a Java
245 * <code>Object</code>.
247 * @param index The index of the parameter to return.
248 * @param map The mapping to use for conversion from SQL to Java types.
249 * @return The parameter value as an <code>Object</code>.
250 * @exception SQLException If an error occurs.
251 * @since 1.2
253 Object getObject(int index, Map map) throws SQLException;
256 * This method returns the value of the specified parameter as a Java
257 * <code>Ref</code>.
259 * @param index The index of the parameter to return.
260 * @return The parameter value as a <code>Ref</code>.
261 * @exception SQLException If an error occurs.
262 * @since 1.2
264 Ref getRef(int index) throws SQLException;
267 * This method returns the value of the specified parameter as a Java
268 * <code>Blob</code>.
270 * @param index The index of the parameter to return.
271 * @return The parameter value as a <code>Blob</code>.
272 * @exception SQLException If an error occurs.
273 * @since 1.2
275 Blob getBlob(int index) throws SQLException;
278 * This method returns the value of the specified parameter as a Java
279 * <code>Clob</code>.
281 * @param index The index of the parameter to return.
282 * @return The parameter value as a <code>Clob</code>.
283 * @exception SQLException If an error occurs.
284 * @since 1.2
286 Clob getClob(int index) throws SQLException;
289 * This method returns the value of the specified parameter as a Java
290 * <code>Array</code>.
292 * @param parameterIndex The index of the parameter to return.
293 * @return The parameter value as a <code>Array</code>.
294 * @exception SQLException If an error occurs.
295 * @since 1.2
297 Array getArray(int index) throws SQLException;
300 * This method returns the value of the specified parameter as a Java
301 * <code>java.sql.Date</code>.
303 * @param parameterIndex The index of the parameter to return.
304 * @param cal The <code>Calendar</code> to use for timezone and locale.
305 * @return The parameter value as a <code>java.sql.Date</code>.
306 * @exception SQLException If an error occurs.
307 * @since 1.2
309 Date getDate(int parameterIndex, Calendar cal) throws SQLException;
312 * This method returns the value of the specified parameter as a Java
313 * <code>java.sql.Time</code>.
315 * @param parameterIndex The index of the parameter to return.
316 * @param cal The <code>Calendar</code> to use for timezone and locale.
317 * @return The parameter value as a <code>java.sql.Time</code>.
318 * @exception SQLException If an error occurs.
319 * @since 1.2
321 Time getTime(int parameterIndex, Calendar cal) throws SQLException;
324 * This method returns the value of the specified parameter as a Java
325 * <code>java.sql.Timestamp</code>.
327 * @param index The index of the parameter to return.
328 * @return The parameter value as a <code>java.sql.Timestamp</code>.
329 * @exception SQLException If an error occurs.
330 * @since 1.2
332 Timestamp getTimestamp(int parameterIndex, Calendar cal)
333 throws SQLException;
336 * This method registers the specified parameter as an output parameter
337 * of the specified SQL type.
339 * @param index The index of the parameter to register as output.
340 * @param type The SQL type value from <code>Types</code>.
341 * @param name The user defined data type name.
342 * @exception SQLException If an error occurs.
343 * @since 1.2
345 void registerOutParameter(int paramIndex, int sqlType,
346 String typeName)
347 throws SQLException;
350 * This method registers the specified parameter as an output parameter
351 * of the specified SQL type.
353 * @param parameterName The name of the parameter to register as output.
354 * @param sqlType The SQL type value from <code>Types</code>.
355 * @exception SQLException If an error occurs.
356 * @since 1.4
358 void registerOutParameter(String parameterName, int sqlType)
359 throws SQLException;
362 * This method registers the specified parameter as an output parameter
363 * of the specified SQL type. This version of registerOutParameter is used
364 * for NUMERIC or DECIMAL types.
366 * @param parameterName The name of the parameter to register as output.
367 * @param sqlType The SQL type value from <code>Types</code>.
368 * @param scale Number of digits to the right of the decimal point.
369 * @exception SQLException If an error occurs.
370 * @since 1.4
372 void registerOutParameter(String parameterName, int sqlType,
373 int scale)
374 throws SQLException;
378 * This method registers the specified parameter as an output parameter
379 * of the specified SQL type. This version of registerOutParameter is used
380 * for user-named or REF types. If the type of the output parameter does
381 * not have such a type, the typeName argument is ignored.
383 * @param parameterName The name of the parameter to register as output.
384 * @param sqlType The SQL type value from <code>Types</code>.
385 * @param typeName The SQL structured type name.
386 * @exception SQLException If an error occurs.
387 * @since 1.4
389 void registerOutParameter(String parameterName, int sqlType,
390 String typeName)
391 throws SQLException;
394 * @since 1.4
396 URL getURL(int parameterIndex) throws SQLException;
399 * @since 1.4
401 void setURL(String parameterName, URL val) throws SQLException;
404 * @since 1.4
406 void setNull(String parameterName, int sqlType) throws SQLException;
409 * @since 1.4
411 void setBoolean(String parameterName, boolean x) throws SQLException;
414 * @since 1.4
416 void setByte(String parameterName, byte x) throws SQLException;
419 * @since 1.4
421 void setShort(String parameterName, short x) throws SQLException;
424 * @since 1.4
426 void setInt(String parameterName, int x) throws SQLException;
429 * @since 1.4
431 void setLong(String parameterName, long x) throws SQLException;
434 * @since 1.4
436 void setFloat(String parameterName, float x) throws SQLException;
439 * @since 1.4
441 void setDouble(String parameterName, double x) throws SQLException;
444 * @since 1.4
446 void setBigDecimal(String parameterName, BigDecimal x)
447 throws SQLException;
450 * @since 1.4
452 void setString(String parameterName, String x) throws SQLException;
455 * @since 1.4
457 void setBytes(String parameterName, byte[] x) throws SQLException;
460 * @since 1.4
462 void setDate(String parameterName, Date x) throws SQLException;
465 * @since 1.4
467 void setTime(String parameterName, Time x) throws SQLException;
470 * @since 1.4
472 void setTimestamp(String parameterName, Timestamp x)
473 throws SQLException;
476 * @since 1.4
478 void setAsciiStream(String parameterName, InputStream x, int length)
479 throws SQLException;
482 * @since 1.4
484 void setBinaryStream(String parameterName, InputStream x, int length)
485 throws SQLException;
488 * @since 1.4
490 void setObject(String parameterName, Object x, int targetSqlType,
491 int scale)
492 throws SQLException;
495 * @since 1.4
497 void setObject(String parameterName, Object x, int targetSqlType)
498 throws SQLException;
501 * @since 1.4
503 void setObject(String parameterName, Object x) throws SQLException;
506 * @since 1.4
508 void setCharacterStream(String parameterName, Reader reader,
509 int length)
510 throws SQLException;
513 * @since 1.4
515 void setDate(String parameterName, Date x, Calendar cal)
516 throws SQLException;
519 * @since 1.4
521 void setTime(String parameterName, Time x, Calendar cal)
522 throws SQLException;
525 * @since 1.4
527 void setTimestamp(String parameterName, Timestamp x, Calendar cal)
528 throws SQLException;
531 * @since 1.4
533 void setNull(String parameterName, int sqlType, String typeName)
534 throws SQLException;
537 * @since 1.4
539 String getString(String parameterName) throws SQLException;
542 * @since 1.4
544 boolean getBoolean(String parameterName) throws SQLException;
547 * @since 1.4
549 byte getByte(String parameterName) throws SQLException;
552 * @since 1.4
554 short getShort(String parameterName) throws SQLException;
557 * @since 1.4
559 int getInt(String parameterName) throws SQLException;
562 * @since 1.4
564 long getLong(String parameterName) throws SQLException;
567 * @since 1.4
569 float getFloat(String parameterName) throws SQLException;
572 * @since 1.4
574 double getDouble(String parameterName) throws SQLException;
577 * @since 1.4
579 byte[] getBytes(String parameterName) throws SQLException;
582 * @since 1.4
584 Date getDate(String parameterName) throws SQLException;
587 * @since 1.4
589 Time getTime(String parameterName) throws SQLException;
592 * @since 1.4
594 Timestamp getTimestamp(String parameterName) throws SQLException;
597 * @since 1.4
599 Object getObject(String parameterName) throws SQLException;
602 * @since 1.4
604 BigDecimal getBigDecimal(String parameterName) throws SQLException;
607 * @since 1.4
609 Object getObject(String parameterName, Map map) throws SQLException;
612 * @since 1.4
614 Ref getRef(String parameterName) throws SQLException;
617 * @since 1.4
619 Blob getBlob(String parameterName) throws SQLException;
622 * @since 1.4
624 Clob getClob(String parameterName) throws SQLException;
627 * @since 1.4
629 Array getArray(String parameterName) throws SQLException;
632 * @since 1.4
634 Date getDate(String parameterName, Calendar cal) throws SQLException;
637 * @since 1.4
639 Time getTime(String parameterName, Calendar cal) throws SQLException;
642 * @since 1.4
644 Timestamp getTimestamp(String parameterName, Calendar cal)
645 throws SQLException;
648 * @since 1.4
650 URL getURL(String parameterName) throws SQLException;