1 /* 2 * Licensed to the Apache Software Foundation (ASF) under one or more 3 * contributor license agreements. See the NOTICE file distributed with 4 * this work for additional information regarding copyright ownership. 5 * The ASF licenses this file to You under the Apache License, Version 2.0 6 * (the "License"); you may not use this file except in compliance with 7 * the License. You may obtain a copy of the License at 8 * 9 * http://www.apache.org/licenses/LICENSE-2.0 10 * 11 * Unless required by applicable law or agreed to in writing, software 12 * distributed under the License is distributed on an "AS IS" BASIS, 13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 * See the License for the specific language governing permissions and 15 * limitations under the License. 16 */ 17 18 package java.sql; 19 20 import java.io.InputStream; 21 import java.io.Reader; 22 import java.math.BigDecimal; 23 import java.net.URL; 24 import java.util.Calendar; 25 26 /** 27 * An interface for a precompiled SQL Statement. 28 * <p> 29 * An SQL Statement is put into a {@code PreparedStatement} and is precompiled 30 * so that it can be executed efficiently multiple times. 31 * <p> 32 * Setter methods are supplied in the {@code PreparedStatement} interface for 33 * the setting of {@code IN} parameters for the statement. The setter method 34 * used for each {@code IN} parameter must match the parameter's type. 35 */ 36 public interface PreparedStatement extends Statement { 37 38 /** 39 * Add a set of parameters to the {@code PreparedStatement}'s command batch. 40 * 41 * @throws SQLException 42 * if a database error happens. 43 */ addBatch()44 public void addBatch() throws SQLException; 45 46 /** 47 * Clear the current parameter values. 48 * <p> 49 * Typically, parameter values are retained for multiple executions of the 50 * {@code Statement}. Setting a parameter value replaces the previous value. This 51 * method clears the values for all parameters, releasing all resources used 52 * by those parameters. 53 * 54 * @throws SQLException 55 * if a database error happens. 56 */ clearParameters()57 public void clearParameters() throws SQLException; 58 59 /** 60 * Executes the SQL statement in this {@code PreparedStatement}. 61 * <p> 62 * A {@code PreparedStatement} may return multiple results. The execute 63 * method executes the {@code PreparedStatement} and returns a flag 64 * indicating the kind of result produced by the action. The methods 65 * {@code getResultSet} or {@code getUpdateCount} are used to retrieve 66 * the first result, and the second and subsequent results are 67 * retrieved with {@code getMoreResults}. 68 * 69 * @return {@code true} if the result of the execution is a {@code 70 * ResultSet}, {@code false} if there is no result or if the result 71 * is an update count. 72 * @throws SQLException 73 * if a database error happens. 74 */ execute()75 public boolean execute() throws SQLException; 76 77 /** 78 * Executes the SQL query in the {@code PreparedStatement} and returns the 79 * {@code ResultSet} generated by the query. 80 * 81 * @return the {@code ResultSet} generated by the query, never {@code null}. 82 * @throws SQLException 83 * if a database error happens or if the SQL statement does not 84 * produce a {@code ResultSet}. 85 */ executeQuery()86 public ResultSet executeQuery() throws SQLException; 87 88 /** 89 * Invokes the SQL command contained within the prepared statement. This 90 * must be {@code INSERT}, {@code UPDATE}, {@code DELETE}, or a command that 91 * returns nothing. 92 * 93 * @return the number of affected rows for {@code INSERT}, {@code UPDATE} or {@code 94 * DELETE} statements, {@code 0} for statements that return nothing. 95 * @throws SQLException 96 * if a database error happens or if the SQL statement returns a 97 * {@code ResultSet}. 98 */ executeUpdate()99 public int executeUpdate() throws SQLException; 100 101 /** 102 * Returns a {@code ResultSetMetaData} describing the {@code 103 * ResultSet} that would be produced by execution of the {@code PreparedStatement}. 104 * <p> 105 * It is possible to know the metadata for the {@code ResultSet} without 106 * executing the {@code PreparedStatement}, because the {@code 107 * PreparedStatement} is precompiled. As a result the metadata can be 108 * queried ahead of time without actually executing the statement. 109 * 110 * @return a {@code ResultSetMetaData} object with the information about the 111 * columns of the {@code ResultSet}, if the driver can return a 112 * {@code ResultSetMetaData}. {@code null} otherwise. 113 * @throws SQLException 114 * if there is a database error. 115 */ getMetaData()116 public ResultSetMetaData getMetaData() throws SQLException; 117 118 /** 119 * Gets information about the parameters of the {@code PreparedStatement}. 120 * 121 * @return a {@code ParameterMetaData} object which holds information about 122 * the number, type, and properties of the parameters of this {@code 123 * PreparedStatement}. 124 * @throws SQLException 125 * if a database error happens. 126 */ getParameterMetaData()127 public ParameterMetaData getParameterMetaData() throws SQLException; 128 129 /** 130 * Sets the value of a specified parameter to the supplied {@code Array}. 131 * 132 * @param parameterIndex 133 * the parameter number index, where the first parameter has 134 * index 1. 135 * @param theArray 136 * a {@code java.sql.Array} giving the new value of the parameter at {@code 137 * parameterIndex}. 138 * @throws SQLException 139 * if a database error happens. 140 * @see Array 141 */ setArray(int parameterIndex, Array theArray)142 public void setArray(int parameterIndex, Array theArray) 143 throws SQLException; 144 145 /** 146 * Sets the value of a specified parameter to the content of a supplied 147 * {@code InputStream}, which has a specified number of bytes. 148 * <p> 149 * This is a good method for setting an SQL {@code LONGVARCHAR} parameter 150 * where the length of the data is large. Data is read from the {@code 151 * InputStream} until end-of-file is reached or the specified number of 152 * bytes is copied. 153 * 154 * @param parameterIndex 155 * the parameter number index, where the first parameter has 156 * index 1. 157 * @param theInputStream 158 * the ASCII {@code InputStream} carrying the data to which the 159 * parameter at {@code parameterIndex} is set. 160 * @param length 161 * the number of bytes in the {@code InputStream} to copy to the 162 * parameter. 163 * @throws SQLException 164 * if a database error happens. 165 */ setAsciiStream(int parameterIndex, InputStream theInputStream, int length)166 public void setAsciiStream(int parameterIndex, InputStream theInputStream, 167 int length) throws SQLException; 168 169 /** 170 * Sets the value of a specified parameter to a supplied {@code 171 * java.math.BigDecimal} value. 172 * 173 * @param parameterIndex 174 * the parameter number index, where the first parameter has 175 * index 1. 176 * @param theBigDecimal 177 * the value to which the parameter at {@code parameterIndex} is 178 * set. 179 * @throws SQLException 180 * if a database error happens. 181 * @see java.math.BigDecimal 182 */ setBigDecimal(int parameterIndex, BigDecimal theBigDecimal)183 public void setBigDecimal(int parameterIndex, BigDecimal theBigDecimal) 184 throws SQLException; 185 186 /** 187 * Sets the value of a specified parameter to the content of a supplied 188 * binary {@code InputStream}, which has a specified number of bytes. 189 * <p> 190 * Use this method when a large amount of data needs to be set into a 191 * {@code LONGVARBINARY} parameter. 192 * 193 * @param parameterIndex 194 * the parameter number index, where the first parameter has 195 * index 1. 196 * @param theInputStream 197 * the binary {@code InputStream} carrying the data to update the 198 * parameter. 199 * @param length 200 * the number of bytes in the {@code InputStream} to copy to the 201 * parameter. 202 * @throws SQLException 203 * if a database error happens. 204 */ setBinaryStream(int parameterIndex, InputStream theInputStream, int length)205 public void setBinaryStream(int parameterIndex, InputStream theInputStream, 206 int length) throws SQLException; 207 208 /** 209 * Sets the value of a specified parameter to the given {@code Blob} object. 210 * 211 * @param parameterIndex 212 * the parameter number index, where the first parameter has 213 * index 1. 214 * @param theBlob 215 * the {@code java.sql.Blob} to which the parameter at {@code 216 * parameterIndex} is set. 217 * @throws SQLException 218 * if a database error happens. 219 * @see Blob 220 */ setBlob(int parameterIndex, Blob theBlob)221 public void setBlob(int parameterIndex, Blob theBlob) throws SQLException; 222 223 /** 224 * Sets the value of a specified parameter to a supplied {@code boolean} 225 * value. 226 * 227 * @param parameterIndex 228 * the parameter number index, where the first parameter has 229 * index 1. 230 * @param theBoolean 231 * the boolean value to which the parameter at {@code 232 * parameterIndex} is set. 233 * @throws SQLException 234 * if a database error happens. 235 */ setBoolean(int parameterIndex, boolean theBoolean)236 public void setBoolean(int parameterIndex, boolean theBoolean) 237 throws SQLException; 238 239 /** 240 * Sets the value of a specified parameter to a supplied {@code byte} value. 241 * 242 * @param parameterIndex 243 * the parameter number index, where the first parameter has 244 * index 1. 245 * @param theByte 246 * the byte value to which the parameter at {@code 247 * parameterIndex} is set. 248 * @throws SQLException 249 * if a database error happens. 250 */ setByte(int parameterIndex, byte theByte)251 public void setByte(int parameterIndex, byte theByte) throws SQLException; 252 253 /** 254 * Sets the value of a specified parameter to a supplied array of bytes. The 255 * array is mapped to a {@code VARBINARY} or {@code LONGVARBINARY} in the 256 * database. 257 * 258 * @param parameterIndex 259 * the parameter number index, where the first parameter has 260 * index 1. 261 * @param theBytes 262 * the array of bytes to which the parameter at {@code 263 * parameterIndex} is set. 264 * @throws SQLException 265 * if a database error happens. 266 */ setBytes(int parameterIndex, byte[] theBytes)267 public void setBytes(int parameterIndex, byte[] theBytes) 268 throws SQLException; 269 270 /** 271 * Sets the value of a specified parameter to the character content of a 272 * {@code Reader} object, with the specified length of character data. 273 * <p> 274 * Data is read from the {@code 275 * Reader} until end-of-file is reached or the specified number of 276 * characters are copied. 277 * 278 * @param parameterIndex 279 * the parameter number index, where the first parameter has 280 * index 1 281 * @param reader 282 * the {@code java.io.Reader} containing the character data. 283 * @param length 284 * the number of characters to be read. 285 * @throws SQLException 286 * if a database error happens. 287 */ setCharacterStream(int parameterIndex, Reader reader, int length)288 public void setCharacterStream(int parameterIndex, Reader reader, int length) 289 throws SQLException; 290 291 /** 292 * Sets the value of a specified parameter to the given {@code Clob} object. 293 * 294 * @param parameterIndex 295 * the parameter number index, where the first parameter has 296 * index 1. 297 * @param theClob 298 * a {@code java.sql.Clob} holding the data to which the 299 * parameter at {@code parameterIndex} is set. 300 * @throws SQLException 301 * if a database error happens. 302 */ setClob(int parameterIndex, Clob theClob)303 public void setClob(int parameterIndex, Clob theClob) throws SQLException; 304 305 /** 306 * Sets the value of a specified parameter to a supplied {@code 307 * java.sql.Date} value. 308 * 309 * @param parameterIndex 310 * the parameter number index, where the first parameter has 311 * index 1. 312 * @param theDate 313 * a {@code java.sql.Date} to which the parameter at {@code 314 * parameterIndex} is set. 315 * @throws SQLException 316 * if a database error happens. 317 */ setDate(int parameterIndex, Date theDate)318 public void setDate(int parameterIndex, Date theDate) throws SQLException; 319 320 /** 321 * Sets the value of a specified parameter to a supplied {@code 322 * java.sql.Date} value, using a supplied {@code Calendar} to map the Date. 323 * The {@code Calendar} allows the application to control the timezone used 324 * to compute the SQL {@code DATE} in the database - without the supplied 325 * {@code Calendar}, the driver uses the VM defaults. 326 * See "<a href="../util/Locale.html#default_locale">Be wary of the default locale</a>". 327 * 328 * @param parameterIndex 329 * the parameter number index, where the first parameter has 330 * index 1. 331 * @param theDate 332 * a {@code java.sql.Date} to which the parameter at {@code 333 * parameterIndex} is set. 334 * @param cal 335 * a {@code Calendar} to use to construct the SQL {@code DATE} 336 * value. 337 * @throws SQLException 338 * if a database error happens. 339 * @see Date 340 * @see java.util.Calendar 341 */ setDate(int parameterIndex, Date theDate, Calendar cal)342 public void setDate(int parameterIndex, Date theDate, Calendar cal) 343 throws SQLException; 344 345 /** 346 * Sets the value of a specified parameter to a supplied {@code double} 347 * value. 348 * 349 * @param parameterIndex 350 * the parameter number index, where the first parameter has 351 * index 1. 352 * @param theDouble 353 * the {@code double} value to which the parameter at {@code 354 * parameterIndex} is set. 355 * @throws SQLException 356 * if a database error happens. 357 */ setDouble(int parameterIndex, double theDouble)358 public void setDouble(int parameterIndex, double theDouble) 359 throws SQLException; 360 361 /** 362 * Sets the value of a specified parameter to to a supplied {@code float} 363 * value. 364 * 365 * @param parameterIndex 366 * the parameter number index, where the first parameter has 367 * index 1. 368 * @param theFloat 369 * the {@code float} value to update the parameter. 370 * @throws SQLException 371 * if a database error happens. 372 */ setFloat(int parameterIndex, float theFloat)373 public void setFloat(int parameterIndex, float theFloat) 374 throws SQLException; 375 376 /** 377 * Sets the value of a specified parameter to a supplied {@code int} value. 378 * 379 * @param parameterIndex 380 * the parameter number index, where the first parameter has 381 * index 1. 382 * @param theInt 383 * the {@code int} value to which the parameter at {@code 384 * parameterIndex} is set. 385 * @throws SQLException 386 * if a database error happens. 387 */ setInt(int parameterIndex, int theInt)388 public void setInt(int parameterIndex, int theInt) throws SQLException; 389 390 /** 391 * Sets the value of a specified parameter to a supplied {@code long} value. 392 * 393 * @param parameterIndex 394 * the parameter number index, where the first parameter has 395 * index 1. 396 * @param theLong 397 * the {@code long} value to which the parameter at {@code 398 * parameterIndex} is set. 399 * @throws SQLException 400 * if a database error happens. 401 */ setLong(int parameterIndex, long theLong)402 public void setLong(int parameterIndex, long theLong) throws SQLException; 403 404 /** 405 * Sets the value of a specified parameter to SQL {@code NULL}. Don't use 406 * this version of {@code setNull} for <i>User Defined Types</i> (UDT) or 407 * for REF type parameters. 408 * 409 * @param parameterIndex 410 * the parameter number index, where the first parameter has 411 * index 1. 412 * @param sqlType 413 * the SQL type of the parameter, as defined in {@code 414 * java.sql.Types}. 415 * @throws SQLException 416 * if a database error happens. 417 */ setNull(int parameterIndex, int sqlType)418 public void setNull(int parameterIndex, int sqlType) throws SQLException; 419 420 /** 421 * Sets the value of a specified parameter to SQL {@code NULL}. This version 422 * of {@code setNull} should be used for <i>User Defined Types</i> (UDTs) 423 * and also REF types. UDTs can be {@code STRUCT}, {@code DISTINCT}, {@code 424 * JAVA_OBJECT} and named array types. 425 * <p> 426 * Applications must provide the SQL type code and also a fully qualified 427 * SQL type name when supplying a {@code NULL} UDT or REF. For a UDT, the 428 * type name is the type name of the parameter itself, but for a REF 429 * parameter the type name is the type name of the referenced type. 430 * 431 * @param paramIndex 432 * the parameter number index, where the first parameter has 433 * index 1. 434 * @param sqlType 435 * the SQL type of the parameter, as defined in {@code 436 * java.sql.Types}. 437 * @param typeName 438 * the fully qualified name of a UDT or REF type - ignored if the 439 * parameter is not a UDT. 440 * @throws SQLException 441 * if a database error happens. 442 * @see Types 443 */ setNull(int paramIndex, int sqlType, String typeName)444 public void setNull(int paramIndex, int sqlType, String typeName) 445 throws SQLException; 446 447 /** 448 * Sets the value of a specified parameter using a supplied object. 449 * <p> 450 * There is a standard mapping from Java types to SQL types, defined in the 451 * JDBC specification. The passed object is then transformed into the 452 * appropriate SQL type, and then transferred to the database. {@code 453 * setObject} can be used to pass abstract data types unique to the 454 * database, by using a JDBC driver specific Java type. If the object's 455 * class implements the interface {@code SQLData}, the JDBC driver calls 456 * {@code SQLData.writeSQL} to write it to the SQL data stream. If the 457 * object's class implements {@code Ref}, {@code Blob}, {@code Clob}, 458 * {@code Struct}, or {@code Array}, the driver passes it to the database as 459 * a value of the corresponding SQL type. 460 * 461 * @param parameterIndex 462 * the parameter number index, where the first parameter has 463 * index 1. 464 * @param theObject 465 * the object containing the value to which the parameter at 466 * {@code parameterIndex} is set. 467 * @throws SQLException 468 * if a database error happens. 469 */ setObject(int parameterIndex, Object theObject)470 public void setObject(int parameterIndex, Object theObject) 471 throws SQLException; 472 473 /** 474 * Sets the value of a specified parameter using a supplied object. 475 * <p> 476 * The object is converted to the given {@code targetSqlType} before it is 477 * sent to the database. If the object has a custom mapping (its class 478 * implements the interface {@code SQLData}), the JDBC driver will call the method 479 * {@code SQLData.writeSQL} to write it to the SQL data stream. If the 480 * object's class implements {@code Ref}, {@code Blob}, {@code Clob}, 481 * {@code Struct}, or {@code Array}, the driver will pass it to the database 482 * in the form of the relevant SQL type. 483 * 484 * @param parameterIndex 485 * the parameter index, where the first parameter has index 1. 486 * @param theObject 487 * the Object containing the value to which the parameter at 488 * {@code parameterIndex} is set. 489 * @param targetSqlType 490 * the SQL type to send to the database, as defined in {@code 491 * java.sql.Types}. 492 * @throws SQLException 493 * if a database error happens. 494 */ setObject(int parameterIndex, Object theObject, int targetSqlType)495 public void setObject(int parameterIndex, Object theObject, 496 int targetSqlType) throws SQLException; 497 498 /** 499 * Sets the value of a specified parameter using a supplied object. 500 * <p> 501 * The object is converted to the given {@code targetSqlType} before it is 502 * sent to the database. If the object has a custom mapping (its class 503 * implements the interface {@code SQLData}), the JDBC driver will call the method 504 * {@code SQLData.writeSQL} to write it to the SQL data stream. If the 505 * object's class implements {@code Ref}, {@code Blob}, {@code Clob}, 506 * {@code Struct}, or {@code Array}, the driver will pass it to the database 507 * in the form of the relevant SQL type. 508 * 509 * @param parameterIndex 510 * the parameter index, where the first parameter has index 1. 511 * @param theObject 512 * the Object containing the value to which the parameter at 513 * {@code parameterIndex} is set. 514 * @param targetSqlType 515 * the SQL type to send to the database, as defined in {@code 516 * java.sql.Types}. 517 * @param scale 518 * the number of digits after the decimal point - only applies to 519 * the types {@code java.sql.Types.DECIMAL} and {@code 520 * java.sql.Types.NUMERIC} - ignored for all other types. 521 * @throws SQLException 522 * if a database error happens. 523 */ setObject(int parameterIndex, Object theObject, int targetSqlType, int scale)524 public void setObject(int parameterIndex, Object theObject, 525 int targetSqlType, int scale) throws SQLException; 526 527 /** 528 * Sets the value of a specified parameter to a supplied {@code 529 * REF(<structured-type>)} value. This is stored as an SQL {@code REF}. 530 * 531 * @param parameterIndex 532 * the parameter number index, where the first parameter has 533 * index 1. 534 * @param theRef 535 * a {@code java.sql.Ref} value to which the parameter at {@code 536 * parameterIndex} is set. 537 * @throws SQLException 538 * if a database error happens. 539 * @see Ref 540 */ setRef(int parameterIndex, Ref theRef)541 public void setRef(int parameterIndex, Ref theRef) throws SQLException; 542 543 /** 544 * Sets the value of a specified parameter to a supplied {@code short} 545 * value. 546 * 547 * @param parameterIndex 548 * the parameter number index, where the first parameter has 549 * index 1. 550 * @param theShort 551 * a {@code short} value to which the parameter at {@code 552 * parameterIndex} is set. 553 * @throws SQLException 554 * if a database error happens. 555 */ setShort(int parameterIndex, short theShort)556 public void setShort(int parameterIndex, short theShort) 557 throws SQLException; 558 559 /** 560 * Sets the value of a specified parameter to a supplied string. 561 * 562 * @param parameterIndex 563 * the parameter number index, where the first parameter has 564 * index 1. 565 * @param theString 566 * the value to which the parameter at {@code parameterIndex} is 567 * set. 568 * @throws SQLException 569 * if a database error happens. 570 */ setString(int parameterIndex, String theString)571 public void setString(int parameterIndex, String theString) 572 throws SQLException; 573 574 /** 575 * Sets the value of a specified parameter to a supplied {@code 576 * java.sql.Time} value. 577 * 578 * @param parameterIndex 579 * the parameter number index, where the first parameter has 580 * index 1. 581 * @param theTime 582 * a {@code java.sql.Time} value to which the parameter at 583 * {@code parameterIndex} is set. 584 * @throws SQLException 585 * if a database error happens. 586 */ setTime(int parameterIndex, Time theTime)587 public void setTime(int parameterIndex, Time theTime) throws SQLException; 588 589 /** 590 * Sets the value of a specified parameter to a supplied {@code 591 * java.sql.Time} value, using a supplied {@code Calendar}. 592 * <p> 593 * The driver uses the supplied {@code Calendar} to create the SQL {@code 594 * TIME} value, which allows it to use a custom timezone - otherwise the 595 * driver uses the VM defaults. 596 * See "<a href="../util/Locale.html#default_locale">Be wary of the default locale</a>". 597 * 598 * @param parameterIndex 599 * the parameter number index, where the first parameter has 600 * index 1. 601 * @param theTime 602 * a {@code java.sql.Time} value to which the parameter at 603 * {@code parameterIndex} is set. 604 * @param cal 605 * a {@code Calendar} to use to construct the SQL {@code TIME} 606 * value. 607 * @throws SQLException 608 * if a database error happens. 609 * @see Time 610 * @see java.util.Calendar 611 */ setTime(int parameterIndex, Time theTime, Calendar cal)612 public void setTime(int parameterIndex, Time theTime, Calendar cal) 613 throws SQLException; 614 615 /** 616 * Sets the value of a specified parameter to a supplied java.sql.Timestamp 617 * value. 618 * 619 * @param parameterIndex 620 * the parameter number index, where the first parameter has 621 * index 1. 622 * @param theTimestamp 623 * the java.sql.Timestamp value to which the parameter at {@code 624 * parameterIndex} is set. 625 * @throws SQLException 626 * if a database error happens. 627 */ setTimestamp(int parameterIndex, Timestamp theTimestamp)628 public void setTimestamp(int parameterIndex, Timestamp theTimestamp) 629 throws SQLException; 630 631 /** 632 * Sets the value of a specified parameter to a supplied {@code 633 * java.sql.Timestamp} value, using the supplied {@code Calendar}. 634 * <p> 635 * The driver uses the supplied {@code Calendar} to create the SQL {@code 636 * TIMESTAMP} value, which allows it to use a custom timezone - otherwise 637 * the driver uses the VM defaults. 638 * See "<a href="../util/Locale.html#default_locale">Be wary of the default locale</a>". 639 * 640 * @param parameterIndex 641 * the parameter number index, where the first parameter has 642 * index 1. 643 * @param theTimestamp 644 * the {@code java.sql.Timestamp} value to which the parameter at 645 * {@code parameterIndex} is set. 646 * @param cal 647 * a {@code Calendar} to use to construct the SQL {@code 648 * TIMESTAMP} value 649 * @throws SQLException 650 * if a database error happens. 651 * @see Timestamp 652 * @see java.util.Calendar 653 */ setTimestamp(int parameterIndex, Timestamp theTimestamp, Calendar cal)654 public void setTimestamp(int parameterIndex, Timestamp theTimestamp, 655 Calendar cal) throws SQLException; 656 657 /** 658 * Sets the value of a specified parameter to the characters from a supplied 659 * {@code InputStream}, with a specified number of bytes. 660 * 661 * @deprecated Use {@link #setCharacterStream(int, Reader, int)} 662 * @param parameterIndex 663 * the parameter number index, where the first parameter has 664 * index 1. 665 * @param theInputStream 666 * the {@code InputStream} with the character data to which the 667 * parameter at {@code parameterIndex} is set. 668 * @param length 669 * the number of bytes to read from the {@code InputStream}. 670 * @throws SQLException 671 * if a database error happens. 672 */ 673 @Deprecated setUnicodeStream(int parameterIndex, InputStream theInputStream, int length)674 public void setUnicodeStream(int parameterIndex, 675 InputStream theInputStream, int length) throws SQLException; 676 677 /** 678 * Sets the value of a specified parameter to a supplied {@code 679 * java.net.URL}. 680 * 681 * @param parameterIndex 682 * the parameter number index, where the first parameter has 683 * index 1. 684 * @param theURL 685 * the {@code URL} to which the parameter at {@code 686 * parameterIndex} is set. 687 * @throws SQLException 688 * if a database error happens. 689 * @see URL 690 */ setURL(int parameterIndex, URL theURL)691 public void setURL(int parameterIndex, URL theURL) throws SQLException; 692 693 /** 694 * Sets the value of a specified parameter to a supplied {@code 695 * java.sql.RowId}. 696 * 697 * @param parameterIndex 698 * the parameter number index, where the first parameter has 699 * index 1. 700 * @param theRowId 701 * the {@code RowId} to which the parameter at {@code 702 * parameterIndex} is set. 703 * @throws SQLException if a database error happens. 704 */ setRowId(int parameterIndex, RowId theRowId)705 public void setRowId(int parameterIndex, RowId theRowId) throws SQLException; 706 707 /** 708 * Sets the value of a specified parameter to a supplied string. 709 * 710 * @param parameterIndex 711 * the parameter number index, where the first parameter has 712 * index 1. 713 * @param theString 714 * the {@code String} to which the parameter at {@code 715 * parameterIndex} is set. 716 * @throws SQLException if a database error happens. 717 */ setNString(int parameterIndex, String theString)718 public void setNString(int parameterIndex, String theString) throws SQLException; 719 720 /** 721 * Sets the value of the specified parameter to the next {@code length} characters 722 * from {@code reader}. 723 * 724 * @param parameterIndex 725 * the parameter number index, where the first parameter has 726 * index 1. 727 * @param reader the {@code Reader} 728 * @param length character count 729 * @throws SQLException if a database error happens. 730 */ setNCharacterStream(int parameterIndex, Reader reader, long length)731 public void setNCharacterStream(int parameterIndex, Reader reader, long length) throws SQLException; 732 733 /** 734 * Sets the value of the specified parameter to {@code value}. 735 * 736 * @param parameterIndex 737 * the parameter number index, where the first parameter has 738 * index 1. 739 * @param value 740 * the {@code NClob} to which the parameter at {@code 741 * parameterIndex} is set. 742 * @throws SQLException if a database error happens. 743 */ setNClob(int parameterIndex, NClob value)744 public void setNClob(int parameterIndex, NClob value) throws SQLException; 745 746 /** 747 * Sets the value of the specified parameter to the next {@code length} characters 748 * from {@code reader}. 749 * 750 * @param parameterIndex 751 * the parameter number index, where the first parameter has 752 * index 1. 753 * @param reader the {@code Reader} 754 * @param length character count 755 * @throws SQLException if a database error happens. 756 */ setClob(int parameterIndex, Reader reader, long length)757 public void setClob(int parameterIndex, Reader reader, long length) throws SQLException; 758 759 /** 760 * Sets the value of the specified parameter to the next {@code length} bytes 761 * from {@code inputStream}. 762 * 763 * @param parameterIndex 764 * the parameter number index, where the first parameter has 765 * index 1. 766 * @param inputStream the {@code InputStream} 767 * @param length character count 768 * @throws SQLException if a database error happens. 769 */ setBlob(int parameterIndex, InputStream inputStream, long length)770 public void setBlob(int parameterIndex, InputStream inputStream, long length) throws SQLException; 771 772 /** 773 * Sets the value of the specified parameter to the next {@code length} characters 774 * from {@code reader}. 775 * 776 * @param parameterIndex 777 * the parameter number index, where the first parameter has 778 * index 1. 779 * @param reader the {@code Reader} 780 * @param length character count 781 * @throws SQLException if a database error happens. 782 */ setNClob(int parameterIndex, Reader reader, long length)783 public void setNClob(int parameterIndex, Reader reader, long length) throws SQLException; 784 785 /** 786 * Sets the value of the specified parameter to the value of {@code xmlObject}. 787 * 788 * @param parameterIndex 789 * the parameter number index, where the first parameter has 790 * index 1. 791 * @param xmlObject the {@code SQLXML} 792 * @throws SQLException if a database error happens. 793 */ setSQLXML(int parameterIndex, SQLXML xmlObject)794 public void setSQLXML(int parameterIndex, SQLXML xmlObject) throws SQLException; 795 796 /** 797 * Sets the value of the specified parameter to the next {@code length} bytes 798 * from {@code inputStream}. 799 * 800 * @param parameterIndex 801 * the parameter number index, where the first parameter has 802 * index 1. 803 * @param inputStream the {@code InputStream} 804 * @param length character count 805 * @throws SQLException if a database error happens. 806 */ setAsciiStream(int parameterIndex, InputStream inputStream, long length)807 public void setAsciiStream(int parameterIndex, InputStream inputStream, long length) throws SQLException; 808 809 /** 810 * Sets the value of the specified parameter to the next {@code length} bytes 811 * from {@code inputStream}. 812 * 813 * @param parameterIndex 814 * the parameter number index, where the first parameter has 815 * index 1. 816 * @param inputStream the {@code InputStream} 817 * @param length character count 818 * @throws SQLException if a database error happens. 819 */ setBinaryStream(int parameterIndex, InputStream inputStream, long length)820 public void setBinaryStream(int parameterIndex, InputStream inputStream, long length) throws SQLException; 821 822 /** 823 * Sets the value of the specified parameter to the next {@code length} characters 824 * from {@code reader}. 825 * 826 * @param parameterIndex 827 * the parameter number index, where the first parameter has 828 * index 1. 829 * @param reader the {@code Reader} 830 * @param length character count 831 * @throws SQLException if a database error happens. 832 */ setCharacterStream(int parameterIndex, Reader reader, long length)833 public void setCharacterStream(int parameterIndex, Reader reader, long length) throws SQLException; 834 835 /** 836 * Sets the value of the specified parameter to the bytes 837 * from {@code inputStream}. 838 * 839 * @param parameterIndex 840 * the parameter number index, where the first parameter has 841 * index 1. 842 * @param inputStream the {@code InputStream} 843 * @throws SQLException if a database error happens. 844 */ setAsciiStream(int parameterIndex, InputStream inputStream)845 public void setAsciiStream(int parameterIndex, InputStream inputStream) throws SQLException; 846 847 /** 848 * Sets the value of the specified parameter to the bytes 849 * from {@code inputStream}. 850 * 851 * @param parameterIndex 852 * the parameter number index, where the first parameter has 853 * index 1. 854 * @param inputStream the {@code InputStream} 855 * @throws SQLException if a database error happens. 856 */ setBinaryStream(int parameterIndex, InputStream inputStream)857 public void setBinaryStream(int parameterIndex, InputStream inputStream) throws SQLException; 858 859 /** 860 * Sets the value of the specified parameter to the characters 861 * from {@code reader}. 862 * 863 * @param parameterIndex 864 * the parameter number index, where the first parameter has 865 * index 1. 866 * @param reader the {@code Reader} 867 * @throws SQLException if a database error happens. 868 */ setCharacterStream(int parameterIndex, Reader reader)869 public void setCharacterStream(int parameterIndex, Reader reader) throws SQLException; 870 871 /** 872 * Sets the value of the specified parameter to the characters 873 * from {@code reader}. 874 * 875 * @param parameterIndex 876 * the parameter number index, where the first parameter has 877 * index 1. 878 * @param reader the {@code Reader} 879 * @throws SQLException if a database error happens. 880 */ setNCharacterStream(int parameterIndex, Reader reader)881 public void setNCharacterStream(int parameterIndex, Reader reader) throws SQLException; 882 883 /** 884 * Sets the value of the specified parameter to the characters 885 * from {@code reader}. 886 * 887 * @param parameterIndex 888 * the parameter number index, where the first parameter has 889 * index 1. 890 * @param reader the {@code Reader} 891 * @throws SQLException if a database error happens. 892 */ setClob(int parameterIndex, Reader reader)893 public void setClob(int parameterIndex, Reader reader) throws SQLException; 894 895 /** 896 * Sets the value of the specified parameter to the bytes 897 * from {@code inputStream}. 898 * 899 * @param parameterIndex 900 * the parameter number index, where the first parameter has 901 * index 1. 902 * @param inputStream the {@code InputStream} 903 * @throws SQLException if a database error happens. 904 */ setBlob(int parameterIndex, InputStream inputStream)905 public void setBlob(int parameterIndex, InputStream inputStream) throws SQLException; 906 907 /** 908 * Sets the value of the specified parameter to the characters 909 * from {@code reader}. 910 * 911 * @param parameterIndex 912 * the parameter number index, where the first parameter has 913 * index 1. 914 * @param reader the {@code Reader} 915 * @throws SQLException if a database error happens. 916 */ setNClob(int parameterIndex, Reader reader)917 public void setNClob(int parameterIndex, Reader reader) throws SQLException; 918 } 919