| 1 | /* CallableStatement.java -- A statement for calling stored procedures.
|
|---|
| 2 | Copyright (C) 1999, 2000 Free Software Foundation, Inc.
|
|---|
| 3 |
|
|---|
| 4 | This file is part of GNU Classpath.
|
|---|
| 5 |
|
|---|
| 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.
|
|---|
| 10 |
|
|---|
| 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.
|
|---|
| 15 |
|
|---|
| 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.
|
|---|
| 20 |
|
|---|
| 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.
|
|---|
| 25 |
|
|---|
| 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. */
|
|---|
| 37 |
|
|---|
| 38 |
|
|---|
| 39 | package java.sql;
|
|---|
| 40 |
|
|---|
| 41 | import java.io.InputStream;
|
|---|
| 42 | import java.io.Reader;
|
|---|
| 43 | import java.math.BigDecimal;
|
|---|
| 44 | import java.util.Calendar;
|
|---|
| 45 | import java.util.Map;
|
|---|
| 46 |
|
|---|
| 47 | /**
|
|---|
| 48 | * This interface provides a mechanism for calling stored procedures.
|
|---|
| 49 | *
|
|---|
| 50 | * @author Aaron M. Renn ([email protected])
|
|---|
| 51 | */
|
|---|
| 52 | public interface CallableStatement extends PreparedStatement
|
|---|
| 53 | {
|
|---|
| 54 |
|
|---|
| 55 | /*************************************************************************/
|
|---|
| 56 |
|
|---|
| 57 | /**
|
|---|
| 58 | * This method tests whether the value of the last parameter that was fetched
|
|---|
| 59 | * was actually a SQL NULL value.
|
|---|
| 60 | *
|
|---|
| 61 | * @return <code>true</code> if the last parameter fetched was a NULL,
|
|---|
| 62 | * <code>false</code> otherwise.
|
|---|
| 63 | *
|
|---|
| 64 | * @exception SQLException If an error occurs.
|
|---|
| 65 | */
|
|---|
| 66 | public abstract boolean
|
|---|
| 67 | wasNull() throws SQLException;
|
|---|
| 68 |
|
|---|
| 69 | /*************************************************************************/
|
|---|
| 70 |
|
|---|
| 71 | /**
|
|---|
| 72 | * This method returns the value of the specified parameter as a Java
|
|---|
| 73 | * <code>String</code>.
|
|---|
| 74 | *
|
|---|
| 75 | * @param index The index of the parameter to return.
|
|---|
| 76 | *
|
|---|
| 77 | * @return The parameter value as a <code>String</code>.
|
|---|
| 78 | *
|
|---|
| 79 | * @exception SQLException If an error occurs.
|
|---|
| 80 | */
|
|---|
| 81 | public abstract String
|
|---|
| 82 | getString(int index) throws SQLException;
|
|---|
| 83 |
|
|---|
| 84 | /*************************************************************************/
|
|---|
| 85 |
|
|---|
| 86 | /**
|
|---|
| 87 | * This method returns the value of the specified parameter as a Java
|
|---|
| 88 | * <code>Object</code>.
|
|---|
| 89 | *
|
|---|
| 90 | * @param index The index of the parameter to return.
|
|---|
| 91 | *
|
|---|
| 92 | * @return The parameter value as an <code>Object</code>.
|
|---|
| 93 | *
|
|---|
| 94 | * @exception SQLException If an error occurs.
|
|---|
| 95 | */
|
|---|
| 96 | public abstract Object
|
|---|
| 97 | getObject(int index) throws SQLException;
|
|---|
| 98 |
|
|---|
| 99 | /*************************************************************************/
|
|---|
| 100 |
|
|---|
| 101 | /**
|
|---|
| 102 | * This method returns the value of the specified parameter as a Java
|
|---|
| 103 | * <code>Object</code>.
|
|---|
| 104 | *
|
|---|
| 105 | * @param index The index of the parameter to return.
|
|---|
| 106 | * @param map The mapping to use for conversion from SQL to Java types.
|
|---|
| 107 | *
|
|---|
| 108 | * @return The parameter value as an <code>Object</code>.
|
|---|
| 109 | *
|
|---|
| 110 | * @exception SQLException If an error occurs.
|
|---|
| 111 | */
|
|---|
| 112 | public abstract Object
|
|---|
| 113 | getObject(int index, Map map) throws SQLException;
|
|---|
| 114 |
|
|---|
| 115 | /*************************************************************************/
|
|---|
| 116 |
|
|---|
| 117 | /**
|
|---|
| 118 | * This method returns the value of the specified parameter as a Java
|
|---|
| 119 | * <code>boolean</code>.
|
|---|
| 120 | *
|
|---|
| 121 | * @param index The index of the parameter to return.
|
|---|
| 122 | *
|
|---|
| 123 | * @return The parameter value as a <code>boolean</code>.
|
|---|
| 124 | *
|
|---|
| 125 | * @exception SQLException If an error occurs.
|
|---|
| 126 | */
|
|---|
| 127 | public abstract boolean
|
|---|
| 128 | getBoolean(int index) throws SQLException;
|
|---|
| 129 |
|
|---|
| 130 | /*************************************************************************/
|
|---|
| 131 |
|
|---|
| 132 | /**
|
|---|
| 133 | * This method returns the value of the specified parameter as a Java
|
|---|
| 134 | * <code>byte</code>.
|
|---|
| 135 | *
|
|---|
| 136 | * @param index The index of the parameter to return.
|
|---|
| 137 | *
|
|---|
| 138 | * @return The parameter value as a <code>byte</code>.
|
|---|
| 139 | *
|
|---|
| 140 | * @exception SQLException If an error occurs.
|
|---|
| 141 | */
|
|---|
| 142 | public abstract byte
|
|---|
| 143 | getByte(int index) throws SQLException;
|
|---|
| 144 |
|
|---|
| 145 | /*************************************************************************/
|
|---|
| 146 |
|
|---|
| 147 | /**
|
|---|
| 148 | * This method returns the value of the specified parameter as a Java
|
|---|
| 149 | * <code>short</code>.
|
|---|
| 150 | *
|
|---|
| 151 | * @param index The index of the parameter to return.
|
|---|
| 152 | *
|
|---|
| 153 | * @return The parameter value as a <code>short</code>.
|
|---|
| 154 | *
|
|---|
| 155 | * @exception SQLException If an error occurs.
|
|---|
| 156 | */
|
|---|
| 157 | public abstract short
|
|---|
| 158 | getShort(int index) throws SQLException;
|
|---|
| 159 |
|
|---|
| 160 | /*************************************************************************/
|
|---|
| 161 |
|
|---|
| 162 | /**
|
|---|
| 163 | * This method returns the value of the specified parameter as a Java
|
|---|
| 164 | * <code>int</code>.
|
|---|
| 165 | *
|
|---|
| 166 | * @param index The index of the parameter to return.
|
|---|
| 167 | *
|
|---|
| 168 | * @return The parameter value as a <code>int</code>.
|
|---|
| 169 | *
|
|---|
| 170 | * @exception SQLException If an error occurs.
|
|---|
| 171 | */
|
|---|
| 172 | public abstract int
|
|---|
| 173 | getInt(int index) throws SQLException;
|
|---|
| 174 |
|
|---|
| 175 | /*************************************************************************/
|
|---|
| 176 |
|
|---|
| 177 | /**
|
|---|
| 178 | * This method returns the value of the specified parameter as a Java
|
|---|
| 179 | * <code>long</code>.
|
|---|
| 180 | *
|
|---|
| 181 | * @param index The index of the parameter to return.
|
|---|
| 182 | *
|
|---|
| 183 | * @return The parameter value as a <code>long</code>.
|
|---|
| 184 | *
|
|---|
| 185 | * @exception SQLException If an error occurs.
|
|---|
| 186 | */
|
|---|
| 187 | public abstract long
|
|---|
| 188 | getLong(int index) throws SQLException;
|
|---|
| 189 |
|
|---|
| 190 | /*************************************************************************/
|
|---|
| 191 |
|
|---|
| 192 | /**
|
|---|
| 193 | * This method returns the value of the specified parameter as a Java
|
|---|
| 194 | * <code>float</code>.
|
|---|
| 195 | *
|
|---|
| 196 | * @param index The index of the parameter to return.
|
|---|
| 197 | *
|
|---|
| 198 | * @return The parameter value as a <code>float</code>.
|
|---|
| 199 | *
|
|---|
| 200 | * @exception SQLException If an error occurs.
|
|---|
| 201 | */
|
|---|
| 202 | public abstract float
|
|---|
| 203 | getFloat(int index) throws SQLException;
|
|---|
| 204 |
|
|---|
| 205 | /*************************************************************************/
|
|---|
| 206 |
|
|---|
| 207 | /**
|
|---|
| 208 | * This method returns the value of the specified parameter as a Java
|
|---|
| 209 | * <code>double</code>.
|
|---|
| 210 | *
|
|---|
| 211 | * @param index The index of the parameter to return.
|
|---|
| 212 | *
|
|---|
| 213 | * @return The parameter value as a <code>double</code>.
|
|---|
| 214 | *
|
|---|
| 215 | * @exception SQLException If an error occurs.
|
|---|
| 216 | */
|
|---|
| 217 | public abstract double
|
|---|
| 218 | getDouble(int index) throws SQLException;
|
|---|
| 219 |
|
|---|
| 220 | /*************************************************************************/
|
|---|
| 221 |
|
|---|
| 222 | /**
|
|---|
| 223 | * This method returns the value of the specified parameter as a Java
|
|---|
| 224 | * <code>BigDecimal</code>.
|
|---|
| 225 | *
|
|---|
| 226 | * @param index The index of the parameter to return.
|
|---|
| 227 | *
|
|---|
| 228 | * @return The parameter value as a <code>BigDecimal</code>.
|
|---|
| 229 | *
|
|---|
| 230 | * @exception SQLException If an error occurs.
|
|---|
| 231 | */
|
|---|
| 232 | public abstract BigDecimal
|
|---|
| 233 | getBigDecimal(int index) throws SQLException;
|
|---|
| 234 |
|
|---|
| 235 | /*************************************************************************/
|
|---|
| 236 |
|
|---|
| 237 | /**
|
|---|
| 238 | * This method returns the value of the specified parameter as a Java
|
|---|
| 239 | * <code>BigDecimal</code>.
|
|---|
| 240 | *
|
|---|
| 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.
|
|---|
| 243 | *
|
|---|
| 244 | * @return The parameter value as a <code>BigDecimal</code>.
|
|---|
| 245 | *
|
|---|
| 246 | * @exception SQLException If an error occurs.
|
|---|
| 247 | */
|
|---|
| 248 | public abstract BigDecimal
|
|---|
| 249 | getBigDecimal(int index, int scale) throws SQLException;
|
|---|
| 250 |
|
|---|
| 251 | /*************************************************************************/
|
|---|
| 252 |
|
|---|
| 253 | /**
|
|---|
| 254 | * This method returns the value of the specified parameter as a Java
|
|---|
| 255 | * byte array.
|
|---|
| 256 | *
|
|---|
| 257 | * @param index The index of the parameter to return.
|
|---|
| 258 | *
|
|---|
| 259 | * @return The parameter value as a byte array
|
|---|
| 260 | *
|
|---|
| 261 | * @exception SQLException If an error occurs.
|
|---|
| 262 | */
|
|---|
| 263 | public abstract byte[]
|
|---|
| 264 | getBytes(int index) throws SQLException;
|
|---|
| 265 |
|
|---|
| 266 | /*************************************************************************/
|
|---|
| 267 |
|
|---|
| 268 | /**
|
|---|
| 269 | * This method returns the value of the specified parameter as a Java
|
|---|
| 270 | * <code>java.sql.Date</code>.
|
|---|
| 271 | *
|
|---|
| 272 | * @param index The index of the parameter to return.
|
|---|
| 273 | *
|
|---|
| 274 | * @return The parameter value as a <code>java.sql.Date</code>.
|
|---|
| 275 | *
|
|---|
| 276 | * @exception SQLException If an error occurs.
|
|---|
| 277 | */
|
|---|
| 278 | public abstract java.sql.Date
|
|---|
| 279 | getDate(int index) throws SQLException;
|
|---|
| 280 |
|
|---|
| 281 | /*************************************************************************/
|
|---|
| 282 |
|
|---|
| 283 | /**
|
|---|
| 284 | * This method returns the value of the specified parameter as a Java
|
|---|
| 285 | * <code>java.sql.Date</code>.
|
|---|
| 286 | *
|
|---|
| 287 | * @param index The index of the parameter to return.
|
|---|
| 288 | * @param calendar The <code>Calendar</code> to use for timezone and locale.
|
|---|
| 289 | *
|
|---|
| 290 | * @return The parameter value as a <code>java.sql.Date</code>.
|
|---|
| 291 | *
|
|---|
| 292 | * @exception SQLException If an error occurs.
|
|---|
| 293 | */
|
|---|
| 294 | public abstract java.sql.Date
|
|---|
| 295 | getDate(int index, Calendar calendar) throws SQLException;
|
|---|
| 296 |
|
|---|
| 297 | /*************************************************************************/
|
|---|
| 298 |
|
|---|
| 299 | /**
|
|---|
| 300 | * This method returns the value of the specified parameter as a Java
|
|---|
| 301 | * <code>java.sql.Time</code>.
|
|---|
| 302 | *
|
|---|
| 303 | * @param index The index of the parameter to return.
|
|---|
| 304 | *
|
|---|
| 305 | * @return The parameter value as a <code>java.sql.Time</code>.
|
|---|
| 306 | *
|
|---|
| 307 | * @exception SQLException If an error occurs.
|
|---|
| 308 | */
|
|---|
| 309 | public abstract java.sql.Time
|
|---|
| 310 | getTime(int index) throws SQLException;
|
|---|
| 311 |
|
|---|
| 312 | /*************************************************************************/
|
|---|
| 313 |
|
|---|
| 314 | /**
|
|---|
| 315 | * This method returns the value of the specified parameter as a Java
|
|---|
| 316 | * <code>java.sql.Time</code>.
|
|---|
| 317 | *
|
|---|
| 318 | * @param index The index of the parameter to return.
|
|---|
| 319 | * @param calendar The <code>Calendar</code> to use for timezone and locale.
|
|---|
| 320 | *
|
|---|
| 321 | * @return The parameter value as a <code>java.sql.Time</code>.
|
|---|
| 322 | *
|
|---|
| 323 | * @exception SQLException If an error occurs.
|
|---|
| 324 | */
|
|---|
| 325 | public abstract java.sql.Time
|
|---|
| 326 | getTime(int index, Calendar calendar) throws SQLException;
|
|---|
| 327 |
|
|---|
| 328 | /*************************************************************************/
|
|---|
| 329 |
|
|---|
| 330 | /**
|
|---|
| 331 | * This method returns the value of the specified parameter as a Java
|
|---|
| 332 | * <code>java.sql.Timestamp</code>.
|
|---|
| 333 | *
|
|---|
| 334 | * @param index The index of the parameter to return.
|
|---|
| 335 | *
|
|---|
| 336 | * @return The parameter value as a <code>java.sql.Timestamp</code>.
|
|---|
| 337 | *
|
|---|
| 338 | * @exception SQLException If an error occurs.
|
|---|
| 339 | */
|
|---|
| 340 | public abstract java.sql.Timestamp
|
|---|
| 341 | getTimestamp(int index) throws SQLException;
|
|---|
| 342 |
|
|---|
| 343 | /*************************************************************************/
|
|---|
| 344 |
|
|---|
| 345 | /**
|
|---|
| 346 | * This method returns the value of the specified parameter as a Java
|
|---|
| 347 | * <code>java.sql.Timestamp</code>.
|
|---|
| 348 | *
|
|---|
| 349 | * @param index The index of the parameter to return.
|
|---|
| 350 | * @param calendar The <code>Calendar</code> to use for timezone and locale.
|
|---|
| 351 | *
|
|---|
| 352 | * @return The parameter value as a <code>java.sql.Timestamp</code>.
|
|---|
| 353 | *
|
|---|
| 354 | * @exception SQLException If an error occurs.
|
|---|
| 355 | */
|
|---|
| 356 | public abstract java.sql.Timestamp
|
|---|
| 357 | getTimestamp(int index, Calendar calendar) throws SQLException;
|
|---|
| 358 |
|
|---|
| 359 | /*************************************************************************/
|
|---|
| 360 |
|
|---|
| 361 | /**
|
|---|
| 362 | * This method returns the value of the specified parameter as a Java
|
|---|
| 363 | * <code>Ref</code>.
|
|---|
| 364 | *
|
|---|
| 365 | * @param index The index of the parameter to return.
|
|---|
| 366 | *
|
|---|
| 367 | * @return The parameter value as a <code>Ref</code>.
|
|---|
| 368 | *
|
|---|
| 369 | * @exception SQLException If an error occurs.
|
|---|
| 370 | */
|
|---|
| 371 | public abstract Ref
|
|---|
| 372 | getRef(int index) throws SQLException;
|
|---|
| 373 |
|
|---|
| 374 | /*************************************************************************/
|
|---|
| 375 |
|
|---|
| 376 | /**
|
|---|
| 377 | * This method returns the value of the specified parameter as a Java
|
|---|
| 378 | * <code>Blob</code>.
|
|---|
| 379 | *
|
|---|
| 380 | * @param index The index of the parameter to return.
|
|---|
| 381 | *
|
|---|
| 382 | * @return The parameter value as a <code>Blob</code>.
|
|---|
| 383 | *
|
|---|
| 384 | * @exception SQLException If an error occurs.
|
|---|
| 385 | */
|
|---|
| 386 | public abstract Blob
|
|---|
| 387 | getBlob(int index) throws SQLException;
|
|---|
| 388 |
|
|---|
| 389 | /*************************************************************************/
|
|---|
| 390 |
|
|---|
| 391 | /**
|
|---|
| 392 | * This method returns the value of the specified parameter as a Java
|
|---|
| 393 | * <code>Clob</code>.
|
|---|
| 394 | *
|
|---|
| 395 | * @param index The index of the parameter to return.
|
|---|
| 396 | *
|
|---|
| 397 | * @return The parameter value as a <code>Clob</code>.
|
|---|
| 398 | *
|
|---|
| 399 | * @exception SQLException If an error occurs.
|
|---|
| 400 | */
|
|---|
| 401 | public abstract Clob
|
|---|
| 402 | getClob(int index) throws SQLException;
|
|---|
| 403 |
|
|---|
| 404 | /*************************************************************************/
|
|---|
| 405 |
|
|---|
| 406 | /**
|
|---|
| 407 | * This method returns the value of the specified parameter as a Java
|
|---|
| 408 | * <code>Array</code>.
|
|---|
| 409 | *
|
|---|
| 410 | * @param index The index of the parameter to return.
|
|---|
| 411 | *
|
|---|
| 412 | * @return The parameter value as a <code>Array</code>.
|
|---|
| 413 | *
|
|---|
| 414 | * @exception SQLException If an error occurs.
|
|---|
| 415 | */
|
|---|
| 416 | public abstract Array
|
|---|
| 417 | getArray(int index) throws SQLException;
|
|---|
| 418 |
|
|---|
| 419 | /*************************************************************************/
|
|---|
| 420 |
|
|---|
| 421 | /**
|
|---|
| 422 | * This method registers the specified parameter as an output parameter
|
|---|
| 423 | * of the specified SQL type.
|
|---|
| 424 | *
|
|---|
| 425 | * @param index The index of the parameter to register as output.
|
|---|
| 426 | * @param type The SQL type value from <code>Types</code>.
|
|---|
| 427 | *
|
|---|
| 428 | * @exception SQLException If an error occurs.
|
|---|
| 429 | */
|
|---|
| 430 | public abstract void
|
|---|
| 431 | registerOutParameter(int index, int type) throws SQLException;
|
|---|
| 432 |
|
|---|
| 433 | /*************************************************************************/
|
|---|
| 434 |
|
|---|
| 435 | /**
|
|---|
| 436 | * This method registers the specified parameter as an output parameter
|
|---|
| 437 | * of the specified SQL type.
|
|---|
| 438 | *
|
|---|
| 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.
|
|---|
| 442 | *
|
|---|
| 443 | * @exception SQLException If an error occurs.
|
|---|
| 444 | */
|
|---|
| 445 | public abstract void
|
|---|
| 446 | registerOutParameter(int index, int type, String name) throws SQLException;
|
|---|
| 447 |
|
|---|
| 448 | /*************************************************************************/
|
|---|
| 449 |
|
|---|
| 450 | /**
|
|---|
| 451 | * This method registers the specified parameter as an output parameter
|
|---|
| 452 | * of the specified SQL type and scale.
|
|---|
| 453 | *
|
|---|
| 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.
|
|---|
| 457 | *
|
|---|
| 458 | * @exception SQLException If an error occurs.
|
|---|
| 459 | */
|
|---|
| 460 | public abstract void
|
|---|
| 461 | registerOutParameter(int index, int type, int scale) throws SQLException;
|
|---|
| 462 |
|
|---|
| 463 | } // interface CallableStatement
|
|---|
| 464 |
|
|---|
| 465 |
|
|---|