1 /* 2 * Copyright (c) 2003, 2019, Oracle and/or its affiliates. All rights reserved. 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 * 5 * This code is free software; you can redistribute it and/or modify it 6 * under the terms of the GNU General Public License version 2 only, as 7 * published by the Free Software Foundation. Oracle designates this 8 * particular file as subject to the "Classpath" exception as provided 9 * by Oracle in the LICENSE file that accompanied this code. 10 * 11 * This code is distributed in the hope that it will be useful, but WITHOUT 12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 14 * version 2 for more details (a copy is included in the LICENSE file that 15 * accompanied this code). 16 * 17 * You should have received a copy of the GNU General Public License version 18 * 2 along with this work; if not, write to the Free Software Foundation, 19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 20 * 21 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 22 * or visit www.oracle.com if you need additional information or have any 23 * questions. 24 */ 25 26 package javax.sql.rowset; 27 28 import java.sql.*; 29 import javax.sql.*; 30 import java.util.*; 31 import java.io.*; 32 import java.math.*; 33 import java.io.Serializable; 34 35 import javax.sql.rowset.serial.*; 36 37 /** 38 * An abstract class providing a <code>RowSet</code> object with its basic functionality. 39 * The basic functions include having properties and sending event notifications, 40 * which all JavaBeans components must implement. 41 * 42 * <h2>1.0 Overview</h2> 43 * The <code>BaseRowSet</code> class provides the core functionality 44 * for all <code>RowSet</code> implementations, 45 * and all standard implementations <b>may</b> use this class in combination with 46 * one or more <code>RowSet</code> interfaces in order to provide a standard 47 * vendor-specific implementation. To clarify, all implementations must implement 48 * at least one of the <code>RowSet</code> interfaces (<code>JdbcRowSet</code>, 49 * <code>CachedRowSet</code>, <code>JoinRowSet</code>, <code>FilteredRowSet</code>, 50 * or <code>WebRowSet</code>). This means that any implementation that extends 51 * the <code>BaseRowSet</code> class must also implement one of the <code>RowSet</code> 52 * interfaces. 53 * <p> 54 * The <code>BaseRowSet</code> class provides the following: 55 * 56 * <UL> 57 * <LI><b>Properties</b> 58 * <ul> 59 * <li>Fields for storing current properties 60 * <li>Methods for getting and setting properties 61 * </ul> 62 * 63 * <LI><b>Event notification</b> 64 * 65 * <LI><b>A complete set of setter methods</b> for setting the parameters in a 66 * <code>RowSet</code> object's command 67 * 68 * <LI> <b>Streams</b> 69 * <ul> 70 * <li>Fields for storing stream instances 71 * <li>Constants for indicating the type of a stream 72 * </ul> 73 * </UL> 74 * 75 * <h2>2.0 Setting Properties</h2> 76 * All rowsets maintain a set of properties, which will usually be set using 77 * a tool. The number and kinds of properties a rowset has will vary, 78 * depending on what the <code>RowSet</code> implementation does and how it gets 79 * its data. For example, 80 * rowsets that get their data from a <code>ResultSet</code> object need to 81 * set the properties that are required for making a database connection. 82 * If a <code>RowSet</code> object uses the <code>DriverManager</code> facility to make a 83 * connection, it needs to set a property for the JDBC URL that identifies the 84 * appropriate driver, and it needs to set the properties that give the 85 * user name and password. 86 * If, on the other hand, the rowset uses a <code>DataSource</code> object 87 * to make the connection, which is the preferred method, it does not need to 88 * set the property for the JDBC URL. Instead, it needs to set the property 89 * for the logical name of the data source along with the properties for 90 * the user name and password. 91 * <P> 92 * NOTE: In order to use a <code>DataSource</code> object for making a 93 * connection, the <code>DataSource</code> object must have been registered 94 * with a naming service that uses the Java Naming and Directory 95 * Interface (JNDI) API. This registration 96 * is usually done by a person acting in the capacity of a system administrator. 97 * 98 * <h2>3.0 Setting the Command and Its Parameters</h2> 99 * When a rowset gets its data from a relational database, it executes a command (a query) 100 * that produces a <code>ResultSet</code> object. This query is the command that is set 101 * for the <code>RowSet</code> object's command property. The rowset populates itself with data by reading the 102 * data from the <code>ResultSet</code> object into itself. If the query 103 * contains placeholders for values to be set, the <code>BaseRowSet</code> setter methods 104 * are used to set these values. All setter methods allow these values to be set 105 * to <code>null</code> if required. 106 * <P> 107 * The following code fragment illustrates how the 108 * <code>CachedRowSet</code> 109 * object <code>crs</code> might have its command property set. Note that if a 110 * tool is used to set properties, this is the code that the tool would use. 111 * <PRE>{@code 112 * crs.setCommand("SELECT FIRST_NAME, LAST_NAME, ADDRESS FROM CUSTOMERS" + 113 * "WHERE CREDIT_LIMIT > ? AND REGION = ?"); 114 * }</PRE> 115 * <P> 116 * In this example, the values for <code>CREDIT_LIMIT</code> and 117 * <code>REGION</code> are placeholder parameters, which are indicated with a 118 * question mark (?). The first question mark is placeholder parameter number 119 * <code>1</code>, the second question mark is placeholder parameter number 120 * <code>2</code>, and so on. Any placeholder parameters must be set with 121 * values before the query can be executed. To set these 122 * placeholder parameters, the <code>BaseRowSet</code> class provides a set of setter 123 * methods, similar to those provided by the <code>PreparedStatement</code> 124 * interface, for setting values of each data type. A <code>RowSet</code> object stores the 125 * parameter values internally, and its <code>execute</code> method uses them internally 126 * to set values for the placeholder parameters 127 * before it sends the command to the DBMS to be executed. 128 * <P> 129 * The following code fragment demonstrates 130 * setting the two parameters in the query from the previous example. 131 * <PRE>{@code 132 * crs.setInt(1, 5000); 133 * crs.setString(2, "West"); 134 * }</PRE> 135 * If the <code>execute</code> method is called at this point, the query 136 * sent to the DBMS will be: 137 * <PRE>{@code 138 * "SELECT FIRST_NAME, LAST_NAME, ADDRESS FROM CUSTOMERS" + 139 * "WHERE CREDIT_LIMIT > 5000 AND REGION = 'West'" 140 * }</PRE> 141 * NOTE: Setting <code>Array</code>, <code>Clob</code>, <code>Blob</code> and 142 * <code>Ref</code> objects as a command parameter, stores these values as 143 * <code>SerialArray</code>, <code>SerialClob</code>, <code>SerialBlob</code> 144 * and <code>SerialRef</code> objects respectively. 145 * 146 * <h2>4.0 Handling of Parameters Behind the Scenes</h2> 147 * 148 * NOTE: The <code>BaseRowSet</code> class provides two kinds of setter methods, 149 * those that set properties and those that set placeholder parameters. The setter 150 * methods discussed in this section are those that set placeholder parameters. 151 * <P> 152 * The placeholder parameters set with the <code>BaseRowSet</code> setter methods 153 * are stored as objects in an internal <code>Hashtable</code> object. 154 * Primitives are stored as their <code>Object</code> type. For example, <code>byte</code> 155 * is stored as <code>Byte</code> object, and <code>int</code> is stored as 156 * an <code>Integer</code> object. 157 * When the method <code>execute</code> is called, the values in the 158 * <code>Hashtable</code> object are substituted for the appropriate placeholder 159 * parameters in the command. 160 * <P> 161 * A call to the method <code>getParams</code> returns the values stored in the 162 * <code>Hashtable</code> object as an array of <code>Object</code> instances. 163 * An element in this array may be a simple <code>Object</code> instance or an 164 * array (which is a type of <code>Object</code>). The particular setter method used 165 * determines whether an element in this array is an <code>Object</code> or an array. 166 * <P> 167 * The majority of methods for setting placeholder parameters take two parameters, 168 * with the first parameter 169 * indicating which placeholder parameter is to be set, and the second parameter 170 * giving the value to be set. Methods such as <code>setInt</code>, 171 * <code>setString</code>, <code>setBoolean</code>, and <code>setLong</code> fall into 172 * this category. After these methods have been called, a call to the method 173 * <code>getParams</code> will return an array with the values that have been set. Each 174 * element in the array is an <code>Object</code> instance representing the 175 * values that have been set. The order of these values in the array is determined by the 176 * <code>int</code> (the first parameter) passed to the setter method. The values in the 177 * array are the values (the second parameter) passed to the setter method. 178 * In other words, the first element in the array is the value 179 * to be set for the first placeholder parameter in the <code>RowSet</code> object's 180 * command. The second element is the value to 181 * be set for the second placeholder parameter, and so on. 182 * <P> 183 * Several setter methods send the driver and DBMS information beyond the value to be set. 184 * When the method <code>getParams</code> is called after one of these setter methods has 185 * been used, the elements in the array will themselves be arrays to accommodate the 186 * additional information. In this category, the method <code>setNull</code> is a special case 187 * because one version takes only 188 * two parameters (<code>setNull(int parameterIndex, int SqlType)</code>). Nevertheless, 189 * it requires 190 * an array to contain the information that will be passed to the driver and DBMS. The first 191 * element in this array is the value to be set, which is <code>null</code>, and the 192 * second element is the <code>int</code> supplied for <i>sqlType</i>, which 193 * indicates the type of SQL value that is being set to <code>null</code>. This information 194 * is needed by some DBMSs and is therefore required in order to ensure that applications 195 * are portable. 196 * The other version is intended to be used when the value to be set to <code>null</code> 197 * is a user-defined type. It takes three parameters 198 * (<code>setNull(int parameterIndex, int sqlType, String typeName)</code>) and also 199 * requires an array to contain the information to be passed to the driver and DBMS. 200 * The first two elements in this array are the same as for the first version of 201 * <code>setNull</code>. The third element, <i>typeName</i>, gives the SQL name of 202 * the user-defined type. As is true with the other setter methods, the number of the 203 * placeholder parameter to be set is indicated by an element's position in the array 204 * returned by <code>getParams</code>. So, for example, if the parameter 205 * supplied to <code>setNull</code> is <code>2</code>, the second element in the array 206 * returned by <code>getParams</code> will be an array of two or three elements. 207 * <P> 208 * Some methods, such as <code>setObject</code> and <code>setDate</code> have versions 209 * that take more than two parameters, with the extra parameters giving information 210 * to the driver or the DBMS. For example, the methods <code>setDate</code>, 211 * <code>setTime</code>, and <code>setTimestamp</code> can take a <code>Calendar</code> 212 * object as their third parameter. If the DBMS does not store time zone information, 213 * the driver uses the <code>Calendar</code> object to construct the <code>Date</code>, 214 * <code>Time</code>, or <code>Timestamp</code> object being set. As is true with other 215 * methods that provide additional information, the element in the array returned 216 * by <code>getParams</code> is an array instead of a simple <code>Object</code> instance. 217 * <P> 218 * The methods <code>setAsciiStream</code>, <code>setBinaryStream</code>, 219 * <code>setCharacterStream</code>, and <code>setUnicodeStream</code> (which is 220 * deprecated, so applications should use <code>getCharacterStream</code> instead) 221 * take three parameters, so for them, the element in the array returned by 222 * <code>getParams</code> is also an array. What is different about these setter 223 * methods is that in addition to the information provided by parameters, the array contains 224 * one of the <code>BaseRowSet</code> constants indicating the type of stream being set. 225 * <p> 226 * NOTE: The method <code>getParams</code> is called internally by 227 * <code>RowSet</code> implementations extending this class; it is not normally called by an 228 * application programmer directly. 229 * 230 * <h2>5.0 Event Notification</h2> 231 * The <code>BaseRowSet</code> class provides the event notification 232 * mechanism for rowsets. It contains the field 233 * <code>listeners</code>, methods for adding and removing listeners, and 234 * methods for notifying listeners of changes. 235 * <P> 236 * A listener is an object that has implemented the <code>RowSetListener</code> interface. 237 * If it has been added to a <code>RowSet</code> object's list of listeners, it will be notified 238 * when an event occurs on that <code>RowSet</code> object. Each listener's 239 * implementation of the <code>RowSetListener</code> methods defines what that object 240 * will do when it is notified that an event has occurred. 241 * <P> 242 * There are three possible events for a <code>RowSet</code> object: 243 * <OL> 244 * <LI>the cursor moves 245 * <LI>an individual row is changed (updated, deleted, or inserted) 246 * <LI>the contents of the entire <code>RowSet</code> object are changed 247 * </OL> 248 * <P> 249 * The <code>BaseRowSet</code> method used for the notification indicates the 250 * type of event that has occurred. For example, the method 251 * <code>notifyRowChanged</code> indicates that a row has been updated, 252 * deleted, or inserted. Each of the notification methods creates a 253 * <code>RowSetEvent</code> object, which is supplied to the listener in order to 254 * identify the <code>RowSet</code> object on which the event occurred. 255 * What the listener does with this information, which may be nothing, depends on how it was 256 * implemented. 257 * 258 * <h2>6.0 Default Behavior</h2> 259 * A default <code>BaseRowSet</code> object is initialized with many starting values. 260 * 261 * The following is true of a default <code>RowSet</code> instance that extends 262 * the <code>BaseRowSet</code> class: 263 * <UL> 264 * <LI>Has a scrollable cursor and does not show changes 265 * made by others. 266 * <LI>Is updatable. 267 * <LI>Does not show rows that have been deleted. 268 * <LI>Has no time limit for how long a driver may take to 269 * execute the <code>RowSet</code> object's command. 270 * <LI>Has no limit for the number of rows it may contain. 271 * <LI>Has no limit for the number of bytes a column may contain. NOTE: This 272 * limit applies only to columns that hold values of the 273 * following types: <code>BINARY</code>, <code>VARBINARY</code>, 274 * <code>LONGVARBINARY</code>, <code>CHAR</code>, <code>VARCHAR</code>, 275 * and <code>LONGVARCHAR</code>. 276 * <LI>Will not see uncommitted data (make "dirty" reads). 277 * <LI>Has escape processing turned on. 278 * <LI>Has its connection's type map set to <code>null</code>. 279 * <LI>Has an empty <code>Vector</code> object for storing the values set 280 * for the placeholder parameters in the <code>RowSet</code> object's command. 281 * </UL> 282 * <p> 283 * If other values are desired, an application must set the property values 284 * explicitly. For example, the following line of code sets the maximum number 285 * of rows for the <code>CachedRowSet</code> object <i>crs</i> to 500. 286 * <PRE> 287 * crs.setMaxRows(500); 288 * </PRE> 289 * Methods implemented in extensions of this <code>BaseRowSet</code> class <b>must</b> throw an 290 * <code>SQLException</code> object for any violation of the defined assertions. Also, if the 291 * extending class overrides and reimplements any <code>BaseRowSet</code> method and encounters 292 * connectivity or underlying data source issues, that method <b>may</b> in addition throw an 293 * <code>SQLException</code> object for that reason. 294 * 295 * @since 1.5 296 */ 297 298 public abstract class BaseRowSet implements Serializable, Cloneable { 299 300 /** 301 * A constant indicating to a <code>RowSetReaderImpl</code> object 302 * that a given parameter is a Unicode stream. This 303 * <code>RowSetReaderImpl</code> object is provided as an extension of the 304 * <code>SyncProvider</code> abstract class defined in the 305 * <code>SyncFactory</code> static factory SPI mechanism. 306 */ 307 public static final int UNICODE_STREAM_PARAM = 0; 308 309 /** 310 * A constant indicating to a <code>RowSetReaderImpl</code> object 311 * that a given parameter is a binary stream. A 312 * <code>RowSetReaderImpl</code> object is provided as an extension of the 313 * <code>SyncProvider</code> abstract class defined in the 314 * <code>SyncFactory</code> static factory SPI mechanism. 315 */ 316 public static final int BINARY_STREAM_PARAM = 1; 317 318 /** 319 * A constant indicating to a <code>RowSetReaderImpl</code> object 320 * that a given parameter is an ASCII stream. A 321 * <code>RowSetReaderImpl</code> object is provided as an extension of the 322 * <code>SyncProvider</code> abstract class defined in the 323 * <code>SyncFactory</code> static factory SPI mechanism. 324 */ 325 public static final int ASCII_STREAM_PARAM = 2; 326 327 /** 328 * The <code>InputStream</code> object that will be 329 * returned by the method <code>getBinaryStream</code>, which is 330 * specified in the <code>ResultSet</code> interface. 331 * @serial 332 */ 333 @SuppressWarnings("serial") // Not statically typed as Serializable 334 protected java.io.InputStream binaryStream; 335 336 /** 337 * The <code>InputStream</code> object that will be 338 * returned by the method <code>getUnicodeStream</code>, 339 * which is specified in the <code>ResultSet</code> interface. 340 * @serial 341 */ 342 @SuppressWarnings("serial") // Not statically typed as Serializable 343 protected java.io.InputStream unicodeStream; 344 345 /** 346 * The <code>InputStream</code> object that will be 347 * returned by the method <code>getAsciiStream</code>, 348 * which is specified in the <code>ResultSet</code> interface. 349 * @serial 350 */ 351 @SuppressWarnings("serial") // Not statically typed as Serializable 352 protected java.io.InputStream asciiStream; 353 354 /** 355 * The <code>Reader</code> object that will be 356 * returned by the method <code>getCharacterStream</code>, 357 * which is specified in the <code>ResultSet</code> interface. 358 * @serial 359 */ 360 @SuppressWarnings("serial") // Not statically typed as Serializable 361 protected java.io.Reader charStream; 362 363 /** 364 * The query that will be sent to the DBMS for execution when the 365 * method <code>execute</code> is called. 366 * @serial 367 */ 368 private String command; 369 370 /** 371 * The JDBC URL the reader, writer, or both supply to the method 372 * <code>DriverManager.getConnection</code> when the 373 * <code>DriverManager</code> is used to get a connection. 374 * <P> 375 * The JDBC URL identifies the driver to be used to make the connection. 376 * This URL can be found in the documentation supplied by the driver 377 * vendor. 378 * @serial 379 */ 380 private String URL; 381 382 /** 383 * The logical name of the data source that the reader/writer should use 384 * in order to retrieve a <code>DataSource</code> object from a Java 385 * Directory and Naming Interface (JNDI) naming service. 386 * @serial 387 */ 388 private String dataSource; 389 390 /** 391 * The user name the reader, writer, or both supply to the method 392 * <code>DriverManager.getConnection</code> when the 393 * <code>DriverManager</code> is used to get a connection. 394 * @serial 395 */ 396 private transient String username; 397 398 /** 399 * The password the reader, writer, or both supply to the method 400 * <code>DriverManager.getConnection</code> when the 401 * <code>DriverManager</code> is used to get a connection. 402 * @serial 403 */ 404 private transient String password; 405 406 /** 407 * A constant indicating the type of this JDBC <code>RowSet</code> 408 * object. It must be one of the following <code>ResultSet</code> 409 * constants: <code>TYPE_FORWARD_ONLY</code>, 410 * <code>TYPE_SCROLL_INSENSITIVE</code>, or 411 * <code>TYPE_SCROLL_SENSITIVE</code>. 412 * @serial 413 */ 414 private int rowSetType = ResultSet.TYPE_SCROLL_INSENSITIVE; 415 416 /** 417 * A <code>boolean</code> indicating whether deleted rows are visible in this 418 * JDBC <code>RowSet</code> object . 419 * @serial 420 */ 421 private boolean showDeleted = false; // default is false 422 423 /** 424 * The maximum number of seconds the driver 425 * will wait for a command to execute. This limit applies while 426 * this JDBC <code>RowSet</code> object is connected to its data 427 * source, that is, while it is populating itself with 428 * data and while it is writing data back to the data source. 429 * @serial 430 */ 431 private int queryTimeout = 0; // default is no timeout 432 433 /** 434 * The maximum number of rows the reader should read. 435 * @serial 436 */ 437 private int maxRows = 0; // default is no limit 438 439 /** 440 * The maximum field size the reader should read. 441 * @serial 442 */ 443 private int maxFieldSize = 0; // default is no limit 444 445 /** 446 * A constant indicating the concurrency of this JDBC <code>RowSet</code> 447 * object. It must be one of the following <code>ResultSet</code> 448 * constants: <code>CONCUR_READ_ONLY</code> or 449 * <code>CONCUR_UPDATABLE</code>. 450 * @serial 451 */ 452 private int concurrency = ResultSet.CONCUR_UPDATABLE; 453 454 /** 455 * A <code>boolean</code> indicating whether this JDBC <code>RowSet</code> 456 * object is read-only. <code>true</code> indicates that it is read-only; 457 * <code>false</code> that it is writable. 458 * @serial 459 */ 460 private boolean readOnly; 461 462 /** 463 * A <code>boolean</code> indicating whether the reader for this 464 * JDBC <code>RowSet</code> object should perform escape processing. 465 * <code>true</code> means that escape processing is turned on; 466 * <code>false</code> that it is not. The default is <code>true</code>. 467 * @serial 468 */ 469 private boolean escapeProcessing = true; 470 471 /** 472 * A constant indicating the isolation level of the connection 473 * for this JDBC <code>RowSet</code> object . It must be one of 474 * the following <code>Connection</code> constants: 475 * <code>TRANSACTION_NONE</code>, 476 * <code>TRANSACTION_READ_UNCOMMITTED</code>, 477 * <code>TRANSACTION_READ_COMMITTED</code>, 478 * <code>TRANSACTION_REPEATABLE_READ</code> or 479 * <code>TRANSACTION_SERIALIZABLE</code>. 480 * @serial 481 */ 482 private int isolation; 483 484 /** 485 * A constant used as a hint to the driver that indicates the direction in 486 * which data from this JDBC <code>RowSet</code> object is going 487 * to be fetched. The following <code>ResultSet</code> constants are 488 * possible values: 489 * <code>FETCH_FORWARD</code>, 490 * <code>FETCH_REVERSE</code>, 491 * <code>FETCH_UNKNOWN</code>. 492 * <P> 493 * Unused at this time. 494 * @serial 495 */ 496 private int fetchDir = ResultSet.FETCH_FORWARD; // default fetch direction 497 498 /** 499 * A hint to the driver that indicates the expected number of rows 500 * in this JDBC <code>RowSet</code> object . 501 * <P> 502 * Unused at this time. 503 * @serial 504 */ 505 private int fetchSize = 0; // default fetchSize 506 507 /** 508 * The <code>java.util.Map</code> object that contains entries mapping 509 * SQL type names to classes in the Java programming language for the 510 * custom mapping of user-defined types. 511 * @serial 512 */ 513 @SuppressWarnings("serial") // Not statically typed as Serializable 514 private Map<String, Class<?>> map; 515 516 /** 517 * A <code>Vector</code> object that holds the list of listeners 518 * that have registered with this <code>RowSet</code> object. 519 * @serial 520 */ 521 private Vector<RowSetListener> listeners; 522 523 /** 524 * A <code>Vector</code> object that holds the parameters set 525 * for this <code>RowSet</code> object's current command. 526 * @serial 527 */ 528 private Hashtable<Integer, Object> params; // could be transient? 529 530 /** 531 * Constructs a new <code>BaseRowSet</code> object initialized with 532 * a default <code>Vector</code> object for its <code>listeners</code> 533 * field. The other default values with which it is initialized are listed 534 * in Section 6.0 of the class comment for this class. 535 */ 536 public BaseRowSet() { 537 // allocate the listeners collection 538 listeners = new Vector<RowSetListener>(); 539 } 540 541 /** 542 * Performs the necessary internal configurations and initializations 543 * to allow any JDBC <code>RowSet</code> implementation to start using 544 * the standard facilities provided by a <code>BaseRowSet</code> 545 * instance. This method <b>should</b> be called after the <code>RowSet</code> object 546 * has been instantiated to correctly initialize all parameters. This method 547 * <b>should</b> never be called by an application, but is called from with 548 * a <code>RowSet</code> implementation extending this class. 549 */ 550 protected void initParams() { 551 params = new Hashtable<Integer, Object>(); 552 } 553 554 //-------------------------------------------------------------------- 555 // Events 556 //-------------------------------------------------------------------- 557 558 /** 559 * The listener will be notified whenever an event occurs on this <code>RowSet</code> 560 * object. 561 * <P> 562 * A listener might, for example, be a table or graph that needs to 563 * be updated in order to accurately reflect the current state of 564 * the <code>RowSet</code> object. 565 * <p> 566 * <b>Note</b>: if the <code>RowSetListener</code> object is 567 * <code>null</code>, this method silently discards the <code>null</code> 568 * value and does not add a null reference to the set of listeners. 569 * <p> 570 * <b>Note</b>: if the listener is already set, and the new <code>RowSetListener</code> 571 * instance is added to the set of listeners already registered to receive 572 * event notifications from this <code>RowSet</code>. 573 * 574 * @param listener an object that has implemented the 575 * <code>javax.sql.RowSetListener</code> interface and wants to be notified 576 * of any events that occur on this <code>RowSet</code> object; May be 577 * null. 578 * @see #removeRowSetListener 579 */ 580 public void addRowSetListener(RowSetListener listener) { 581 listeners.add(listener); 582 } 583 584 /** 585 * Removes the designated object from this <code>RowSet</code> object's list of listeners. 586 * If the given argument is not a registered listener, this method 587 * does nothing. 588 * 589 * <b>Note</b>: if the <code>RowSetListener</code> object is 590 * <code>null</code>, this method silently discards the <code>null</code> 591 * value. 592 * 593 * @param listener a <code>RowSetListener</code> object that is on the list 594 * of listeners for this <code>RowSet</code> object 595 * @see #addRowSetListener 596 */ 597 public void removeRowSetListener(RowSetListener listener) { 598 listeners.remove(listener); 599 } 600 601 /** 602 * Determine if instance of this class extends the RowSet interface. 603 */ 604 private void checkforRowSetInterface() throws SQLException { 605 if ((this instanceof javax.sql.RowSet) == false) { 606 throw new SQLException("The class extending abstract class BaseRowSet " + 607 "must implement javax.sql.RowSet or one of it's sub-interfaces."); 608 } 609 } 610 611 /** 612 * Notifies all of the listeners registered with this 613 * <code>RowSet</code> object that its cursor has moved. 614 * <P> 615 * When an application calls a method to move the cursor, 616 * that method moves the cursor and then calls this method 617 * internally. An application <b>should</b> never invoke 618 * this method directly. 619 * 620 * @throws SQLException if the class extending the <code>BaseRowSet</code> 621 * abstract class does not implement the <code>RowSet</code> interface or 622 * one of it's sub-interfaces. 623 */ 624 protected void notifyCursorMoved() throws SQLException { 625 checkforRowSetInterface(); 626 if (listeners.isEmpty() == false) { 627 RowSetEvent event = new RowSetEvent((RowSet)this); 628 for (RowSetListener rsl : listeners) { 629 rsl.cursorMoved(event); 630 } 631 } 632 } 633 634 /** 635 * Notifies all of the listeners registered with this <code>RowSet</code> object that 636 * one of its rows has changed. 637 * <P> 638 * When an application calls a method that changes a row, such as 639 * the <code>CachedRowSet</code> methods <code>insertRow</code>, 640 * <code>updateRow</code>, or <code>deleteRow</code>, 641 * that method calls <code>notifyRowChanged</code> 642 * internally. An application <b>should</b> never invoke 643 * this method directly. 644 * 645 * @throws SQLException if the class extending the <code>BaseRowSet</code> 646 * abstract class does not implement the <code>RowSet</code> interface or 647 * one of it's sub-interfaces. 648 */ 649 protected void notifyRowChanged() throws SQLException { 650 checkforRowSetInterface(); 651 if (listeners.isEmpty() == false) { 652 RowSetEvent event = new RowSetEvent((RowSet)this); 653 for (RowSetListener rsl : listeners) { 654 rsl.rowChanged(event); 655 } 656 } 657 } 658 659 /** 660 * Notifies all of the listeners registered with this <code>RowSet</code> 661 * object that its entire contents have changed. 662 * <P> 663 * When an application calls methods that change the entire contents 664 * of the <code>RowSet</code> object, such as the <code>CachedRowSet</code> methods 665 * <code>execute</code>, <code>populate</code>, <code>restoreOriginal</code>, 666 * or <code>release</code>, that method calls <code>notifyRowSetChanged</code> 667 * internally (either directly or indirectly). An application <b>should</b> 668 * never invoke this method directly. 669 * 670 * @throws SQLException if the class extending the <code>BaseRowSet</code> 671 * abstract class does not implement the <code>RowSet</code> interface or 672 * one of it's sub-interfaces. 673 */ 674 protected void notifyRowSetChanged() throws SQLException { 675 checkforRowSetInterface(); 676 if (listeners.isEmpty() == false) { 677 RowSetEvent event = new RowSetEvent((RowSet)this); 678 for (RowSetListener rsl : listeners) { 679 rsl.rowSetChanged(event); 680 } 681 } 682 } 683 684 /** 685 * Retrieves the SQL query that is the command for this 686 * <code>RowSet</code> object. The command property contains the query that 687 * will be executed to populate this <code>RowSet</code> object. 688 * <P> 689 * The SQL query returned by this method is used by <code>RowSet</code> methods 690 * such as <code>execute</code> and <code>populate</code>, which may be implemented 691 * by any class that extends the <code>BaseRowSet</code> abstract class and 692 * implements one or more of the standard JSR-114 <code>RowSet</code> 693 * interfaces. 694 * <P> 695 * The command is used by the <code>RowSet</code> object's 696 * reader to obtain a <code>ResultSet</code> object. The reader then 697 * reads the data from the <code>ResultSet</code> object and uses it to 698 * to populate this <code>RowSet</code> object. 699 * <P> 700 * The default value for the <code>command</code> property is <code>null</code>. 701 * 702 * @return the <code>String</code> that is the value for this 703 * <code>RowSet</code> object's <code>command</code> property; 704 * may be <code>null</code> 705 * @see #setCommand 706 */ 707 public String getCommand() { 708 return command; 709 } 710 711 /** 712 * Sets this <code>RowSet</code> object's <code>command</code> property to 713 * the given <code>String</code> object and clears the parameters, if any, 714 * that were set for the previous command. 715 * <P> 716 * The <code>command</code> property may not be needed if the <code>RowSet</code> 717 * object gets its data from a source that does not support commands, 718 * such as a spreadsheet or other tabular file. 719 * Thus, this property is optional and may be <code>null</code>. 720 * 721 * @param cmd a <code>String</code> object containing an SQL query 722 * that will be set as this <code>RowSet</code> object's command 723 * property; may be <code>null</code> but may not be an empty string 724 * @throws SQLException if an empty string is provided as the command value 725 * @see #getCommand 726 */ 727 public void setCommand(String cmd) throws SQLException { 728 // cmd equal to null or 729 // cmd with length 0 (implies url =="") 730 // are not independent events. 731 732 if(cmd == null) { 733 command = null; 734 } else if (cmd.length() == 0) { 735 throw new SQLException("Invalid command string detected. " + 736 "Cannot be of length less than 0"); 737 } else { 738 // "unbind" any parameters from any previous command. 739 if(params == null){ 740 throw new SQLException("Set initParams() before setCommand"); 741 } 742 params.clear(); 743 command = cmd; 744 } 745 746 } 747 748 /** 749 * Retrieves the JDBC URL that this <code>RowSet</code> object's 750 * <code>javax.sql.Reader</code> object uses to make a connection 751 * with a relational database using a JDBC technology-enabled driver. 752 *<P> 753 * The <code>Url</code> property will be <code>null</code> if the underlying data 754 * source is a non-SQL data source, such as a spreadsheet or an XML 755 * data source. 756 * 757 * @return a <code>String</code> object that contains the JDBC URL 758 * used to establish the connection for this <code>RowSet</code> 759 * object; may be <code>null</code> (default value) if not set 760 * @throws SQLException if an error occurs retrieving the URL value 761 * @see #setUrl 762 */ 763 public String getUrl() throws SQLException { 764 return URL; 765 } 766 767 /** 768 * Sets the Url property for this <code>RowSet</code> object 769 * to the given <code>String</code> object and sets the dataSource name 770 * property to <code>null</code>. The Url property is a 771 * JDBC URL that is used when 772 * the connection is created using a JDBC technology-enabled driver 773 * ("JDBC driver") and the <code>DriverManager</code>. 774 * The correct JDBC URL for the specific driver to be used can be found 775 * in the driver documentation. Although there are guidelines for how 776 * a JDBC URL is formed, 777 * a driver vendor can specify any <code>String</code> object except 778 * one with a length of <code>0</code> (an empty string). 779 * <P> 780 * Setting the Url property is optional if connections are established using 781 * a <code>DataSource</code> object instead of the <code>DriverManager</code>. 782 * The driver will use either the URL property or the 783 * dataSourceName property to create a connection, whichever was 784 * specified most recently. If an application uses a JDBC URL, it 785 * must load a JDBC driver that accepts the JDBC URL before it uses the 786 * <code>RowSet</code> object to connect to a database. The <code>RowSet</code> 787 * object will use the URL internally to create a database connection in order 788 * to read or write data. 789 * 790 * @param url a <code>String</code> object that contains the JDBC URL 791 * that will be used to establish the connection to a database for this 792 * <code>RowSet</code> object; may be <code>null</code> but must not 793 * be an empty string 794 * @throws SQLException if an error occurs setting the Url property or the 795 * parameter supplied is a string with a length of <code>0</code> (an 796 * empty string) 797 * @see #getUrl 798 */ 799 public void setUrl(String url) throws SQLException { 800 if(url == null) { 801 url = null; 802 } else if (url.length() < 1) { 803 throw new SQLException("Invalid url string detected. " + 804 "Cannot be of length less than 1"); 805 } else { 806 URL = url; 807 } 808 809 dataSource = null; 810 811 } 812 813 /** 814 * Returns the logical name that when supplied to a naming service 815 * that uses the Java Naming and Directory Interface (JNDI) API, will 816 * retrieve a <code>javax.sql.DataSource</code> object. This 817 * <code>DataSource</code> object can be used to establish a connection 818 * to the data source that it represents. 819 * <P> 820 * Users should set either the url or the data source name property. 821 * The driver will use the property set most recently to establish a 822 * connection. 823 * 824 * @return a <code>String</code> object that identifies the 825 * <code>DataSource</code> object to be used for making a 826 * connection; if no logical name has been set, <code>null</code> 827 * is returned. 828 * @see #setDataSourceName 829 */ 830 public String getDataSourceName() { 831 return dataSource; 832 } 833 834 835 /** 836 * Sets the <code>DataSource</code> name property for this <code>RowSet</code> 837 * object to the given logical name and sets this <code>RowSet</code> object's 838 * Url property to <code>null</code>. The name must have been bound to a 839 * <code>DataSource</code> object in a JNDI naming service so that an 840 * application can do a lookup using that name to retrieve the 841 * <code>DataSource</code> object bound to it. The <code>DataSource</code> 842 * object can then be used to establish a connection to the data source it 843 * represents. 844 * <P> 845 * Users should set either the Url property or the dataSourceName property. 846 * If both properties are set, the driver will use the property set most recently. 847 * 848 * @param name a <code>String</code> object with the name that can be supplied 849 * to a naming service based on JNDI technology to retrieve the 850 * <code>DataSource</code> object that can be used to get a connection; 851 * may be <code>null</code> but must not be an empty string 852 * @throws SQLException if an empty string is provided as the <code>DataSource</code> 853 * name 854 * @see #getDataSourceName 855 */ 856 public void setDataSourceName(String name) throws SQLException { 857 858 if (name == null) { 859 dataSource = null; 860 } else if (name.isEmpty()) { 861 throw new SQLException("DataSource name cannot be empty string"); 862 } else { 863 dataSource = name; 864 } 865 866 URL = null; 867 } 868 869 /** 870 * Returns the user name used to create a database connection. Because it 871 * is not serialized, the username property is set at runtime before 872 * calling the method <code>execute</code>. 873 * 874 * @return the <code>String</code> object containing the user name that 875 * is supplied to the data source to create a connection; may be 876 * <code>null</code> (default value) if not set 877 * @see #setUsername 878 */ 879 public String getUsername() { 880 return username; 881 } 882 883 /** 884 * Sets the username property for this <code>RowSet</code> object 885 * to the given user name. Because it 886 * is not serialized, the username property is set at run time before 887 * calling the method <code>execute</code>. 888 * 889 * @param name the <code>String</code> object containing the user name that 890 * is supplied to the data source to create a connection. It may be null. 891 * @see #getUsername 892 */ 893 public void setUsername(String name) { 894 if(name == null) 895 { 896 username = null; 897 } else { 898 username = name; 899 } 900 } 901 902 /** 903 * Returns the password used to create a database connection for this 904 * <code>RowSet</code> object. Because the password property is not 905 * serialized, it is set at run time before calling the method 906 * <code>execute</code>. The default value is <code>null</code> 907 * 908 * @return the <code>String</code> object that represents the password 909 * that must be supplied to the database to create a connection 910 * @see #setPassword 911 */ 912 public String getPassword() { 913 return password; 914 } 915 916 /** 917 * Sets the password used to create a database connection for this 918 * <code>RowSet</code> object to the given <code>String</code> 919 * object. Because the password property is not 920 * serialized, it is set at run time before calling the method 921 * <code>execute</code>. 922 * 923 * @param pass the <code>String</code> object that represents the password 924 * that is supplied to the database to create a connection. It may be 925 * null. 926 * @see #getPassword 927 */ 928 public void setPassword(String pass) { 929 if(pass == null) 930 { 931 password = null; 932 } else { 933 password = pass; 934 } 935 } 936 937 /** 938 * Sets the type for this <code>RowSet</code> object to the specified type. 939 * The default type is <code>ResultSet.TYPE_SCROLL_INSENSITIVE</code>. 940 * 941 * @param type one of the following constants: 942 * <code>ResultSet.TYPE_FORWARD_ONLY</code>, 943 * <code>ResultSet.TYPE_SCROLL_INSENSITIVE</code>, or 944 * <code>ResultSet.TYPE_SCROLL_SENSITIVE</code> 945 * @throws SQLException if the parameter supplied is not one of the 946 * following constants: 947 * <code>ResultSet.TYPE_FORWARD_ONLY</code> or 948 * <code>ResultSet.TYPE_SCROLL_INSENSITIVE</code> 949 * <code>ResultSet.TYPE_SCROLL_SENSITIVE</code> 950 * @see #getConcurrency 951 * @see #getType 952 */ 953 public void setType(int type) throws SQLException { 954 955 if ((type != ResultSet.TYPE_FORWARD_ONLY) && 956 (type != ResultSet.TYPE_SCROLL_INSENSITIVE) && 957 (type != ResultSet.TYPE_SCROLL_SENSITIVE)) { 958 throw new SQLException("Invalid type of RowSet set. Must be either " + 959 "ResultSet.TYPE_FORWARD_ONLY or ResultSet.TYPE_SCROLL_INSENSITIVE " + 960 "or ResultSet.TYPE_SCROLL_SENSITIVE."); 961 } 962 this.rowSetType = type; 963 } 964 965 /** 966 * Returns the type of this <code>RowSet</code> object. The type is initially 967 * determined by the statement that created the <code>RowSet</code> object. 968 * The <code>RowSet</code> object can call the method 969 * <code>setType</code> at any time to change its 970 * type. The default is <code>TYPE_SCROLL_INSENSITIVE</code>. 971 * 972 * @return the type of this JDBC <code>RowSet</code> 973 * object, which must be one of the following: 974 * <code>ResultSet.TYPE_FORWARD_ONLY</code>, 975 * <code>ResultSet.TYPE_SCROLL_INSENSITIVE</code>, or 976 * <code>ResultSet.TYPE_SCROLL_SENSITIVE</code> 977 * @throws SQLException if an error occurs getting the type of 978 * of this <code>RowSet</code> object 979 * @see #setType 980 */ 981 public int getType() throws SQLException { 982 return rowSetType; 983 } 984 985 /** 986 * Sets the concurrency for this <code>RowSet</code> object to 987 * the specified concurrency. The default concurrency for any <code>RowSet</code> 988 * object (connected or disconnected) is <code>ResultSet.CONCUR_UPDATABLE</code>, 989 * but this method may be called at any time to change the concurrency. 990 * 991 * @param concurrency one of the following constants: 992 * <code>ResultSet.CONCUR_READ_ONLY</code> or 993 * <code>ResultSet.CONCUR_UPDATABLE</code> 994 * @throws SQLException if the parameter supplied is not one of the 995 * following constants: 996 * <code>ResultSet.CONCUR_UPDATABLE</code> or 997 * <code>ResultSet.CONCUR_READ_ONLY</code> 998 * @see #getConcurrency 999 * @see #isReadOnly 1000 */ 1001 public void setConcurrency(int concurrency) throws SQLException { 1002 1003 if((concurrency != ResultSet.CONCUR_READ_ONLY) && 1004 (concurrency != ResultSet.CONCUR_UPDATABLE)) { 1005 throw new SQLException("Invalid concurrency set. Must be either " + 1006 "ResultSet.CONCUR_READ_ONLY or ResultSet.CONCUR_UPDATABLE."); 1007 } 1008 this.concurrency = concurrency; 1009 } 1010 1011 /** 1012 * Returns a <code>boolean</code> indicating whether this 1013 * <code>RowSet</code> object is read-only. 1014 * Any attempts to update a read-only <code>RowSet</code> object will result in an 1015 * <code>SQLException</code> being thrown. By default, 1016 * rowsets are updatable if updates are possible. 1017 * 1018 * @return <code>true</code> if this <code>RowSet</code> object 1019 * cannot be updated; <code>false</code> otherwise 1020 * @see #setConcurrency 1021 * @see #setReadOnly 1022 */ 1023 public boolean isReadOnly() { 1024 return readOnly; 1025 }; 1026 1027 /** 1028 * Sets this <code>RowSet</code> object's readOnly property to the given <code>boolean</code>. 1029 * 1030 * @param value <code>true</code> to indicate that this 1031 * <code>RowSet</code> object is read-only; 1032 * <code>false</code> to indicate that it is updatable 1033 */ 1034 public void setReadOnly(boolean value) { 1035 readOnly = value; 1036 } 1037 1038 /** 1039 * Returns the transaction isolation property for this 1040 * <code>RowSet</code> object's connection. This property represents 1041 * the transaction isolation level requested for use in transactions. 1042 * <P> 1043 * For <code>RowSet</code> implementations such as 1044 * the <code>CachedRowSet</code> that operate in a disconnected environment, 1045 * the <code>SyncProvider</code> object 1046 * offers complementary locking and data integrity options. The 1047 * options described below are pertinent only to connected <code>RowSet</code> 1048 * objects (<code>JdbcRowSet</code> objects). 1049 * 1050 * @return one of the following constants: 1051 * <code>Connection.TRANSACTION_NONE</code>, 1052 * <code>Connection.TRANSACTION_READ_UNCOMMITTED</code>, 1053 * <code>Connection.TRANSACTION_READ_COMMITTED</code>, 1054 * <code>Connection.TRANSACTION_REPEATABLE_READ</code>, or 1055 * <code>Connection.TRANSACTION_SERIALIZABLE</code> 1056 * @see javax.sql.rowset.spi.SyncFactory 1057 * @see javax.sql.rowset.spi.SyncProvider 1058 * @see #setTransactionIsolation 1059 1060 */ 1061 public int getTransactionIsolation() { 1062 return isolation; 1063 }; 1064 1065 /** 1066 * Sets the transaction isolation property for this JDBC <code>RowSet</code> object to the given 1067 * constant. The DBMS will use this transaction isolation level for 1068 * transactions if it can. 1069 * <p> 1070 * For <code>RowSet</code> implementations such as 1071 * the <code>CachedRowSet</code> that operate in a disconnected environment, 1072 * the <code>SyncProvider</code> object being used 1073 * offers complementary locking and data integrity options. The 1074 * options described below are pertinent only to connected <code>RowSet</code> 1075 * objects (<code>JdbcRowSet</code> objects). 1076 * 1077 * @param level one of the following constants, listed in ascending order: 1078 * <code>Connection.TRANSACTION_NONE</code>, 1079 * <code>Connection.TRANSACTION_READ_UNCOMMITTED</code>, 1080 * <code>Connection.TRANSACTION_READ_COMMITTED</code>, 1081 * <code>Connection.TRANSACTION_REPEATABLE_READ</code>, or 1082 * <code>Connection.TRANSACTION_SERIALIZABLE</code> 1083 * @throws SQLException if the given parameter is not one of the Connection 1084 * constants 1085 * @see javax.sql.rowset.spi.SyncFactory 1086 * @see javax.sql.rowset.spi.SyncProvider 1087 * @see #getTransactionIsolation 1088 */ 1089 public void setTransactionIsolation(int level) throws SQLException { 1090 if ((level != Connection.TRANSACTION_NONE) && 1091 (level != Connection.TRANSACTION_READ_COMMITTED) && 1092 (level != Connection.TRANSACTION_READ_UNCOMMITTED) && 1093 (level != Connection.TRANSACTION_REPEATABLE_READ) && 1094 (level != Connection.TRANSACTION_SERIALIZABLE)) 1095 { 1096 throw new SQLException("Invalid transaction isolation set. Must " + 1097 "be either " + 1098 "Connection.TRANSACTION_NONE or " + 1099 "Connection.TRANSACTION_READ_UNCOMMITTED or " + 1100 "Connection.TRANSACTION_READ_COMMITTED or " + 1101 "Connection.TRANSACTION_REPEATABLE_READ or " + 1102 "Connection.TRANSACTION_SERIALIZABLE"); 1103 } 1104 this.isolation = level; 1105 } 1106 1107 /** 1108 * Retrieves the type map associated with the <code>Connection</code> 1109 * object for this <code>RowSet</code> object. 1110 * <P> 1111 * Drivers that support the JDBC 3.0 API will create 1112 * <code>Connection</code> objects with an associated type map. 1113 * This type map, which is initially empty, can contain one or more 1114 * fully-qualified SQL names and <code>Class</code> objects indicating 1115 * the class to which the named SQL value will be mapped. The type mapping 1116 * specified in the connection's type map is used for custom type mapping 1117 * when no other type map supersedes it. 1118 * <p> 1119 * If a type map is explicitly supplied to a method that can perform 1120 * custom mapping, that type map supersedes the connection's type map. 1121 * 1122 * @return the <code>java.util.Map</code> object that is the type map 1123 * for this <code>RowSet</code> object's connection 1124 */ 1125 public java.util.Map<String,Class<?>> getTypeMap() { 1126 return map; 1127 } 1128 1129 /** 1130 * Installs the given <code>java.util.Map</code> object as the type map 1131 * associated with the <code>Connection</code> object for this 1132 * <code>RowSet</code> object. The custom mapping indicated in 1133 * this type map will be used unless a different type map is explicitly 1134 * supplied to a method, in which case the type map supplied will be used. 1135 * 1136 * @param map a <code>java.util.Map</code> object that contains the 1137 * mapping from SQL type names for user defined types (UDT) to classes in 1138 * the Java programming language. Each entry in the <code>Map</code> 1139 * object consists of the fully qualified SQL name of a UDT and the 1140 * <code>Class</code> object for the <code>SQLData</code> implementation 1141 * of that UDT. May be <code>null</code>. 1142 */ 1143 public void setTypeMap(java.util.Map<String,Class<?>> map) { 1144 this.map = map; 1145 } 1146 1147 /** 1148 * Retrieves the maximum number of bytes that can be used for a column 1149 * value in this <code>RowSet</code> object. 1150 * This limit applies only to columns that hold values of the 1151 * following types: <code>BINARY</code>, <code>VARBINARY</code>, 1152 * <code>LONGVARBINARY</code>, <code>CHAR</code>, <code>VARCHAR</code>, 1153 * and <code>LONGVARCHAR</code>. If the limit is exceeded, the excess 1154 * data is silently discarded. 1155 * 1156 * @return an <code>int</code> indicating the current maximum column size 1157 * limit; zero means that there is no limit 1158 * @throws SQLException if an error occurs internally determining the 1159 * maximum limit of the column size 1160 */ 1161 public int getMaxFieldSize() throws SQLException { 1162 return maxFieldSize; 1163 } 1164 1165 /** 1166 * Sets the maximum number of bytes that can be used for a column 1167 * value in this <code>RowSet</code> object to the given number. 1168 * This limit applies only to columns that hold values of the 1169 * following types: <code>BINARY</code>, <code>VARBINARY</code>, 1170 * <code>LONGVARBINARY</code>, <code>CHAR</code>, <code>VARCHAR</code>, 1171 * and <code>LONGVARCHAR</code>. If the limit is exceeded, the excess 1172 * data is silently discarded. For maximum portability, it is advisable to 1173 * use values greater than 256. 1174 * 1175 * @param max an <code>int</code> indicating the new maximum column size 1176 * limit; zero means that there is no limit 1177 * @throws SQLException if (1) an error occurs internally setting the 1178 * maximum limit of the column size or (2) a size of less than 0 is set 1179 */ 1180 public void setMaxFieldSize(int max) throws SQLException { 1181 if (max < 0) { 1182 throw new SQLException("Invalid max field size set. Cannot be of " + 1183 "value: " + max); 1184 } 1185 maxFieldSize = max; 1186 } 1187 1188 /** 1189 * Retrieves the maximum number of rows that this <code>RowSet</code> object may contain. If 1190 * this limit is exceeded, the excess rows are silently dropped. 1191 * 1192 * @return an <code>int</code> indicating the current maximum number of 1193 * rows; zero means that there is no limit 1194 * @throws SQLException if an error occurs internally determining the 1195 * maximum limit of rows that a <code>Rowset</code> object can contain 1196 */ 1197 public int getMaxRows() throws SQLException { 1198 return maxRows; 1199 } 1200 1201 /** 1202 * Sets the maximum number of rows that this <code>RowSet</code> object may contain to 1203 * the given number. If this limit is exceeded, the excess rows are 1204 * silently dropped. 1205 * 1206 * @param max an <code>int</code> indicating the current maximum number 1207 * of rows; zero means that there is no limit 1208 * @throws SQLException if an error occurs internally setting the 1209 * maximum limit on the number of rows that a JDBC <code>RowSet</code> object 1210 * can contain; or if <i>max</i> is less than <code>0</code>; or 1211 * if <i>max</i> is less than the <code>fetchSize</code> of the 1212 * <code>RowSet</code> 1213 */ 1214 public void setMaxRows(int max) throws SQLException { 1215 if (max < 0) { 1216 throw new SQLException("Invalid max row size set. Cannot be of " + 1217 "value: " + max); 1218 } else if (max < this.getFetchSize()) { 1219 throw new SQLException("Invalid max row size set. Cannot be less " + 1220 "than the fetchSize."); 1221 } 1222 this.maxRows = max; 1223 } 1224 1225 /** 1226 * Sets to the given <code>boolean</code> whether or not the driver will 1227 * scan for escape syntax and do escape substitution before sending SQL 1228 * statements to the database. The default is for the driver to do escape 1229 * processing. 1230 * <P> 1231 * Note: Since <code>PreparedStatement</code> objects have usually been 1232 * parsed prior to making this call, disabling escape processing for 1233 * prepared statements will likely have no effect. 1234 * 1235 * @param enable <code>true</code> to enable escape processing; 1236 * <code>false</code> to disable it 1237 * @throws SQLException if an error occurs setting the underlying JDBC 1238 * technology-enabled driver to process the escape syntax 1239 */ 1240 public void setEscapeProcessing(boolean enable) throws SQLException { 1241 escapeProcessing = enable; 1242 } 1243 1244 /** 1245 * Retrieves the maximum number of seconds the driver will wait for a 1246 * query to execute. If the limit is exceeded, an <code>SQLException</code> 1247 * is thrown. 1248 * 1249 * @return the current query timeout limit in seconds; zero means that 1250 * there is no limit 1251 * @throws SQLException if an error occurs in determining the query 1252 * time-out value 1253 */ 1254 public int getQueryTimeout() throws SQLException { 1255 return queryTimeout; 1256 } 1257 1258 /** 1259 * Sets to the given number the maximum number of seconds the driver will 1260 * wait for a query to execute. If the limit is exceeded, an 1261 * <code>SQLException</code> is thrown. 1262 * 1263 * @param seconds the new query time-out limit in seconds; zero means that 1264 * there is no limit; must not be less than zero 1265 * @throws SQLException if an error occurs setting the query 1266 * time-out or if the query time-out value is less than 0 1267 */ 1268 public void setQueryTimeout(int seconds) throws SQLException { 1269 if (seconds < 0) { 1270 throw new SQLException("Invalid query timeout value set. Cannot be " + 1271 "of value: " + seconds); 1272 } 1273 this.queryTimeout = seconds; 1274 } 1275 1276 /** 1277 * Retrieves a <code>boolean</code> indicating whether rows marked 1278 * for deletion appear in the set of current rows. 1279 * The default value is <code>false</code>. 1280 * <P> 1281 * Note: Allowing deleted rows to remain visible complicates the behavior 1282 * of some of the methods. However, most <code>RowSet</code> object users 1283 * can simply ignore this extra detail because only sophisticated 1284 * applications will likely want to take advantage of this feature. 1285 * 1286 * @return <code>true</code> if deleted rows are visible; 1287 * <code>false</code> otherwise 1288 * @throws SQLException if an error occurs determining if deleted rows 1289 * are visible or not 1290 * @see #setShowDeleted 1291 */ 1292 public boolean getShowDeleted() throws SQLException { 1293 return showDeleted; 1294 } 1295 1296 /** 1297 * Sets the property <code>showDeleted</code> to the given 1298 * <code>boolean</code> value, which determines whether 1299 * rows marked for deletion appear in the set of current rows. 1300 * 1301 * @param value <code>true</code> if deleted rows should be shown; 1302 * <code>false</code> otherwise 1303 * @throws SQLException if an error occurs setting whether deleted 1304 * rows are visible or not 1305 * @see #getShowDeleted 1306 */ 1307 public void setShowDeleted(boolean value) throws SQLException { 1308 showDeleted = value; 1309 } 1310 1311 /** 1312 * Ascertains whether escape processing is enabled for this 1313 * <code>RowSet</code> object. 1314 * 1315 * @return <code>true</code> if escape processing is turned on; 1316 * <code>false</code> otherwise 1317 * @throws SQLException if an error occurs determining if escape 1318 * processing is enabled or not or if the internal escape 1319 * processing trigger has not been enabled 1320 */ 1321 public boolean getEscapeProcessing() throws SQLException { 1322 return escapeProcessing; 1323 } 1324 1325 /** 1326 * Gives the driver a performance hint as to the direction in 1327 * which the rows in this <code>RowSet</code> object will be 1328 * processed. The driver may ignore this hint. 1329 * <P> 1330 * A <code>RowSet</code> object inherits the default properties of the 1331 * <code>ResultSet</code> object from which it got its data. That 1332 * <code>ResultSet</code> object's default fetch direction is set by 1333 * the <code>Statement</code> object that created it. 1334 * <P> 1335 * This method applies to a <code>RowSet</code> object only while it is 1336 * connected to a database using a JDBC driver. 1337 * <p> 1338 * A <code>RowSet</code> object may use this method at any time to change 1339 * its setting for the fetch direction. 1340 * 1341 * @param direction one of <code>ResultSet.FETCH_FORWARD</code>, 1342 * <code>ResultSet.FETCH_REVERSE</code>, or 1343 * <code>ResultSet.FETCH_UNKNOWN</code> 1344 * @throws SQLException if (1) the <code>RowSet</code> type is 1345 * <code>TYPE_FORWARD_ONLY</code> and the given fetch direction is not 1346 * <code>FETCH_FORWARD</code> or (2) the given fetch direction is not 1347 * one of the following: 1348 * ResultSet.FETCH_FORWARD, 1349 * ResultSet.FETCH_REVERSE, or 1350 * ResultSet.FETCH_UNKNOWN 1351 * @see #getFetchDirection 1352 */ 1353 public void setFetchDirection(int direction) throws SQLException { 1354 // Changed the condition checking to the below as there were two 1355 // conditions that had to be checked 1356 // 1. RowSet is TYPE_FORWARD_ONLY and direction is not FETCH_FORWARD 1357 // 2. Direction is not one of the valid values 1358 1359 if (((getType() == ResultSet.TYPE_FORWARD_ONLY) && (direction != ResultSet.FETCH_FORWARD)) || 1360 ((direction != ResultSet.FETCH_FORWARD) && 1361 (direction != ResultSet.FETCH_REVERSE) && 1362 (direction != ResultSet.FETCH_UNKNOWN))) { 1363 throw new SQLException("Invalid Fetch Direction"); 1364 } 1365 fetchDir = direction; 1366 } 1367 1368 /** 1369 * Retrieves this <code>RowSet</code> object's current setting for the 1370 * fetch direction. The default type is <code>ResultSet.FETCH_FORWARD</code> 1371 * 1372 * @return one of <code>ResultSet.FETCH_FORWARD</code>, 1373 * <code>ResultSet.FETCH_REVERSE</code>, or 1374 * <code>ResultSet.FETCH_UNKNOWN</code> 1375 * @throws SQLException if an error occurs in determining the 1376 * current fetch direction for fetching rows 1377 * @see #setFetchDirection 1378 */ 1379 public int getFetchDirection() throws SQLException { 1380 1381 //Added the following code to throw a 1382 //SQL Exception if the fetchDir is not 1383 //set properly.Bug id:4914155 1384 1385 // This checking is not necessary! 1386 1387 /* 1388 if((fetchDir != ResultSet.FETCH_FORWARD) && 1389 (fetchDir != ResultSet.FETCH_REVERSE) && 1390 (fetchDir != ResultSet.FETCH_UNKNOWN)) { 1391 throw new SQLException("Fetch Direction Invalid"); 1392 } 1393 */ 1394 return (fetchDir); 1395 } 1396 1397 /** 1398 * Sets the fetch size for this <code>RowSet</code> object to the given number of 1399 * rows. The fetch size gives a JDBC technology-enabled driver ("JDBC driver") 1400 * a hint as to the 1401 * number of rows that should be fetched from the database when more rows 1402 * are needed for this <code>RowSet</code> object. If the fetch size specified 1403 * is zero, the driver ignores the value and is free to make its own best guess 1404 * as to what the fetch size should be. 1405 * <P> 1406 * A <code>RowSet</code> object inherits the default properties of the 1407 * <code>ResultSet</code> object from which it got its data. That 1408 * <code>ResultSet</code> object's default fetch size is set by 1409 * the <code>Statement</code> object that created it. 1410 * <P> 1411 * This method applies to a <code>RowSet</code> object only while it is 1412 * connected to a database using a JDBC driver. 1413 * For connected <code>RowSet</code> implementations such as 1414 * <code>JdbcRowSet</code>, this method has a direct and immediate effect 1415 * on the underlying JDBC driver. 1416 * <P> 1417 * A <code>RowSet</code> object may use this method at any time to change 1418 * its setting for the fetch size. 1419 * <p> 1420 * For <code>RowSet</code> implementations such as 1421 * <code>CachedRowSet</code>, which operate in a disconnected environment, 1422 * the <code>SyncProvider</code> object being used 1423 * may leverage the fetch size to poll the data source and 1424 * retrieve a number of rows that do not exceed the fetch size and that may 1425 * form a subset of the actual rows returned by the original query. This is 1426 * an implementation variance determined by the specific <code>SyncProvider</code> 1427 * object employed by the disconnected <code>RowSet</code> object. 1428 * 1429 * @param rows the number of rows to fetch; <code>0</code> to let the 1430 * driver decide what the best fetch size is; must not be less 1431 * than <code>0</code> or more than the maximum number of rows 1432 * allowed for this <code>RowSet</code> object (the number returned 1433 * by a call to the method {@link #getMaxRows}) 1434 * @throws SQLException if the specified fetch size is less than <code>0</code> 1435 * or more than the limit for the maximum number of rows 1436 * @see #getFetchSize 1437 */ 1438 public void setFetchSize(int rows) throws SQLException { 1439 //Added this checking as maxRows can be 0 when this function is called 1440 //maxRows = 0 means rowset can hold any number of rows, os this checking 1441 // is needed to take care of this condition. 1442 if (getMaxRows() == 0 && rows >= 0) { 1443 fetchSize = rows; 1444 return; 1445 } 1446 if ((rows < 0) || (rows > getMaxRows())) { 1447 throw new SQLException("Invalid fetch size set. Cannot be of " + 1448 "value: " + rows); 1449 } 1450 fetchSize = rows; 1451 } 1452 1453 /** 1454 * Returns the fetch size for this <code>RowSet</code> object. The default 1455 * value is zero. 1456 * 1457 * @return the number of rows suggested as the fetch size when this <code>RowSet</code> object 1458 * needs more rows from the database 1459 * @throws SQLException if an error occurs determining the number of rows in the 1460 * current fetch size 1461 * @see #setFetchSize 1462 */ 1463 public int getFetchSize() throws SQLException { 1464 return fetchSize; 1465 } 1466 1467 /** 1468 * Returns the concurrency for this <code>RowSet</code> object. 1469 * The default is <code>CONCUR_UPDATABLE</code> for both connected and 1470 * disconnected <code>RowSet</code> objects. 1471 * <P> 1472 * An application can call the method <code>setConcurrency</code> at any time 1473 * to change a <code>RowSet</code> object's concurrency. 1474 * 1475 * @return the concurrency type for this <code>RowSet</code> 1476 * object, which must be one of the following: 1477 * <code>ResultSet.CONCUR_READ_ONLY</code> or 1478 * <code>ResultSet.CONCUR_UPDATABLE</code> 1479 * @throws SQLException if an error occurs getting the concurrency 1480 * of this <code>RowSet</code> object 1481 * @see #setConcurrency 1482 * @see #isReadOnly 1483 */ 1484 public int getConcurrency() throws SQLException { 1485 return concurrency; 1486 } 1487 1488 //----------------------------------------------------------------------- 1489 // Parameters 1490 //----------------------------------------------------------------------- 1491 1492 /** 1493 * Checks the given index to see whether it is less than <code>1</code> and 1494 * throws an <code>SQLException</code> object if it is. 1495 * <P> 1496 * This method is called by many methods internally; it is never 1497 * called by an application directly. 1498 * 1499 * @param idx an <code>int</code> indicating which parameter is to be 1500 * checked; the first parameter is <code>1</code> 1501 * @throws SQLException if the parameter is less than <code>1</code> 1502 */ 1503 private void checkParamIndex(int idx) throws SQLException { 1504 if ((idx < 1)) { 1505 throw new SQLException("Invalid Parameter Index"); 1506 } 1507 } 1508 1509 //--------------------------------------------------------------------- 1510 // setter methods for setting the parameters in a <code>RowSet</code> object's command 1511 //--------------------------------------------------------------------- 1512 1513 /** 1514 * Sets the designated parameter to SQL <code>NULL</code>. 1515 * Note that the parameter's SQL type must be specified using one of the 1516 * type codes defined in <code>java.sql.Types</code>. This SQL type is 1517 * specified in the second parameter. 1518 * <p> 1519 * Note that the second parameter tells the DBMS the data type of the value being 1520 * set to <code>NULL</code>. Some DBMSs require this information, so it is required 1521 * in order to make code more portable. 1522 * <P> 1523 * The parameter value set by this method is stored internally and 1524 * will be supplied as the appropriate parameter in this <code>RowSet</code> 1525 * object's command when the method <code>execute</code> is called. 1526 * Methods such as <code>execute</code> and <code>populate</code> must be 1527 * provided in any class that extends this class and implements one or 1528 * more of the standard JSR-114 <code>RowSet</code> interfaces. 1529 * <P> 1530 * NOTE: <code>JdbcRowSet</code> does not require the <code>populate</code> method 1531 * as it is undefined in this class. 1532 * <P> 1533 * Calls made to the method <code>getParams</code> after this version of 1534 * <code>setNull</code> 1535 * has been called will return an <code>Object</code> array containing the parameter values that 1536 * have been set. In that array, the element that represents the values 1537 * set with this method will itself be an array. The first element of that array 1538 * is <code>null</code>. 1539 * The second element is the value set for <i>sqlType</i>. 1540 * The parameter number is indicated by an element's position in the array 1541 * returned by the method <code>getParams</code>, 1542 * with the first element being the value for the first placeholder parameter, the 1543 * second element being the value for the second placeholder parameter, and so on. 1544 * In other words, if the second placeholder parameter is being set to 1545 * <code>null</code>, the array containing it will be the second element in 1546 * the array returned by <code>getParams</code>. 1547 * <P> 1548 * Note that because the numbering of elements in an array starts at zero, 1549 * the array element that corresponds to placeholder parameter number 1550 * <i>parameterIndex</i> is <i>parameterIndex</i> -1. 1551 * 1552 * @param parameterIndex the ordinal number of the placeholder parameter 1553 * in this <code>RowSet</code> object's command that is to be set. 1554 * The first parameter is 1, the second is 2, and so on; must be 1555 * <code>1</code> or greater 1556 * @param sqlType an <code>int</code> that is one of the SQL type codes 1557 * defined in the class {@link java.sql.Types}. If a non-standard 1558 * <i>sqlType</i> is supplied, this method will not throw a 1559 * <code>SQLException</code>. This allows implicit support for 1560 * non-standard SQL types. 1561 * @throws SQLException if a database access error occurs or the given 1562 * parameter index is out of bounds 1563 * @see #getParams 1564 */ 1565 public void setNull(int parameterIndex, int sqlType) throws SQLException { 1566 Object nullVal[]; 1567 checkParamIndex(parameterIndex); 1568 1569 nullVal = new Object[2]; 1570 nullVal[0] = null; 1571 nullVal[1] = Integer.valueOf(sqlType); 1572 1573 if (params == null){ 1574 throw new SQLException("Set initParams() before setNull"); 1575 } 1576 1577 params.put(Integer.valueOf(parameterIndex - 1), nullVal); 1578 } 1579 1580 /** 1581 * Sets the designated parameter to SQL <code>NULL</code>. 1582 * 1583 * Although this version of the method <code>setNull</code> is intended 1584 * for user-defined 1585 * and <code>REF</code> parameters, this method may be used to set a null 1586 * parameter for any JDBC type. The following are user-defined types: 1587 * <code>STRUCT</code>, <code>DISTINCT</code>, and <code>JAVA_OBJECT</code>, 1588 * and named array types. 1589 * 1590 * <P><B>Note:</B> To be portable, applications must give the 1591 * SQL type code and the fully qualified SQL type name when specifying 1592 * a <code>NULL</code> user-defined or <code>REF</code> parameter. 1593 * In the case of a user-defined type, the name is the type name of 1594 * the parameter itself. For a <code>REF</code> parameter, the name is 1595 * the type name of the referenced type. If a JDBC technology-enabled 1596 * driver does not need the type code or type name information, 1597 * it may ignore it. 1598 * <P> 1599 * If the parameter does not have a user-defined or <code>REF</code> type, 1600 * the given <code>typeName</code> parameter is ignored. 1601 * <P> 1602 * The parameter value set by this method is stored internally and 1603 * will be supplied as the appropriate parameter in this <code>RowSet</code> 1604 * object's command when the method <code>execute</code> is called. 1605 * Methods such as <code>execute</code> and <code>populate</code> must be 1606 * provided in any class that extends this class and implements one or 1607 * more of the standard JSR-114 <code>RowSet</code> interfaces. 1608 * <P> 1609 * NOTE: <code>JdbcRowSet</code> does not require the <code>populate</code> method 1610 * as it is undefined in this class. 1611 * <P> 1612 * Calls made to the method <code>getParams</code> after this version of 1613 * <code>setNull</code> 1614 * has been called will return an <code>Object</code> array containing the parameter values that 1615 * have been set. In that array, the element that represents the values 1616 * set with this method will itself be an array. The first element of that array 1617 * is <code>null</code>. 1618 * The second element is the value set for <i>sqlType</i>, and the third 1619 * element is the value set for <i>typeName</i>. 1620 * The parameter number is indicated by an element's position in the array 1621 * returned by the method <code>getParams</code>, 1622 * with the first element being the value for the first placeholder parameter, the 1623 * second element being the value for the second placeholder parameter, and so on. 1624 * In other words, if the second placeholder parameter is being set to 1625 * <code>null</code>, the array containing it will be the second element in 1626 * the array returned by <code>getParams</code>. 1627 * <P> 1628 * Note that because the numbering of elements in an array starts at zero, 1629 * the array element that corresponds to placeholder parameter number 1630 * <i>parameterIndex</i> is <i>parameterIndex</i> -1. 1631 * 1632 * @param parameterIndex the ordinal number of the placeholder parameter 1633 * in this <code>RowSet</code> object's command that is to be set. 1634 * The first parameter is 1, the second is 2, and so on; must be 1635 * <code>1</code> or greater 1636 * @param sqlType a value from <code>java.sql.Types</code> 1637 * @param typeName the fully qualified name of an SQL user-defined type, 1638 * which is ignored if the parameter is not a user-defined 1639 * type or <code>REF</code> value 1640 * @throws SQLException if an error occurs or the given parameter index 1641 * is out of bounds 1642 * @see #getParams 1643 */ 1644 public void setNull(int parameterIndex, int sqlType, String typeName) 1645 throws SQLException { 1646 1647 Object nullVal[]; 1648 checkParamIndex(parameterIndex); 1649 1650 nullVal = new Object[3]; 1651 nullVal[0] = null; 1652 nullVal[1] = Integer.valueOf(sqlType); 1653 nullVal[2] = typeName; 1654 1655 if(params == null){ 1656 throw new SQLException("Set initParams() before setNull"); 1657 } 1658 1659 params.put(Integer.valueOf(parameterIndex - 1), nullVal); 1660 } 1661 1662 1663 /** 1664 * Sets the designated parameter to the given <code>boolean</code> in the 1665 * Java programming language. The driver converts this to an SQL 1666 * <code>BIT</code> value when it sends it to the database. 1667 * <P> 1668 * The parameter value set by this method is stored internally and 1669 * will be supplied as the appropriate parameter in this <code>RowSet</code> 1670 * object's command when the method <code>execute</code> is called. 1671 * Methods such as <code>execute</code>, <code>populate</code> must be 1672 * provided in any class that extends this class and implements one or 1673 * more of the standard JSR-114 <code>RowSet</code> interfaces. 1674 * <p> 1675 * NOTE: <code>JdbcRowSet</code> does not require the <code>populate</code> method 1676 * as it is undefined in this class. 1677 * 1678 * @param parameterIndex the ordinal number of the placeholder parameter 1679 * in this <code>RowSet</code> object's command that is to be set. 1680 * The first parameter is 1, the second is 2, and so on; must be 1681 * <code>1</code> or greater 1682 * @param x the parameter value 1683 * @throws SQLException if an error occurs or the 1684 * parameter index is out of bounds 1685 * @see #getParams 1686 */ 1687 public void setBoolean(int parameterIndex, boolean x) throws SQLException { 1688 checkParamIndex(parameterIndex); 1689 1690 if(params == null){ 1691 throw new SQLException("Set initParams() before setNull"); 1692 } 1693 1694 params.put(Integer.valueOf(parameterIndex - 1), Boolean.valueOf(x)); 1695 } 1696 1697 /** 1698 * Sets the designated parameter to the given <code>byte</code> in the Java 1699 * programming language. The driver converts this to an SQL 1700 * <code>TINYINT</code> value when it sends it to the database. 1701 * <P> 1702 * The parameter value set by this method is stored internally and 1703 * will be supplied as the appropriate parameter in this <code>RowSet</code> 1704 * object's command when the method <code>execute</code> is called. 1705 * Methods such as <code>execute</code> and <code>populate</code> must be 1706 * provided in any class that extends this class and implements one or 1707 * more of the standard JSR-114 <code>RowSet</code> interfaces. 1708 * <p> 1709 * NOTE: <code>JdbcRowSet</code> does not require the <code>populate</code> method 1710 * as it is undefined in this class. 1711 * 1712 * @param parameterIndex the ordinal number of the placeholder parameter 1713 * in this <code>RowSet</code> object's command that is to be set. 1714 * The first parameter is 1, the second is 2, and so on; must be 1715 * <code>1</code> or greater 1716 * @param x the parameter value 1717 * @throws SQLException if an error occurs or the 1718 * parameter index is out of bounds 1719 * @see #getParams 1720 */ 1721 public void setByte(int parameterIndex, byte x) throws SQLException { 1722 checkParamIndex(parameterIndex); 1723 1724 if(params == null){ 1725 throw new SQLException("Set initParams() before setByte"); 1726 } 1727 1728 params.put(Integer.valueOf(parameterIndex - 1), Byte.valueOf(x)); 1729 } 1730 1731 /** 1732 * Sets the designated parameter to the given <code>short</code> in the 1733 * Java programming language. The driver converts this to an SQL 1734 * <code>SMALLINT</code> value when it sends it to the database. 1735 * <P> 1736 * The parameter value set by this method is stored internally and 1737 * will be supplied as the appropriate parameter in this <code>RowSet</code> 1738 * object's command when the method <code>execute</code> is called. 1739 * Methods such as <code>execute</code> and <code>populate</code> must be 1740 * provided in any class that extends this class and implements one or 1741 * more of the standard JSR-114 <code>RowSet</code> interfaces. 1742 * <p> 1743 * NOTE: <code>JdbcRowSet</code> does not require the <code>populate</code> method 1744 * as it is undefined in this class. 1745 * 1746 * @param parameterIndex the ordinal number of the placeholder parameter 1747 * in this <code>RowSet</code> object's command that is to be set. 1748 * The first parameter is 1, the second is 2, and so on; must be 1749 * <code>1</code> or greater 1750 * @param x the parameter value 1751 * @throws SQLException if an error occurs or the 1752 * parameter index is out of bounds 1753 * @see #getParams 1754 */ 1755 public void setShort(int parameterIndex, short x) throws SQLException { 1756 checkParamIndex(parameterIndex); 1757 1758 if(params == null){ 1759 throw new SQLException("Set initParams() before setShort"); 1760 } 1761 1762 params.put(Integer.valueOf(parameterIndex - 1), Short.valueOf(x)); 1763 } 1764 1765 /** 1766 * Sets the designated parameter to an <code>int</code> in the Java 1767 * programming language. The driver converts this to an SQL 1768 * <code>INTEGER</code> value when it sends it to the database. 1769 * <P> 1770 * The parameter value set by this method is stored internally and 1771 * will be supplied as the appropriate parameter in this <code>RowSet</code> 1772 * object's command when the method <code>execute</code> is called. 1773 * Methods such as <code>execute</code> and <code>populate</code> must be 1774 * provided in any class that extends this class and implements one or 1775 * more of the standard JSR-114 <code>RowSet</code> interfaces. 1776 * <P> 1777 * NOTE: <code>JdbcRowSet</code> does not require the <code>populate</code> method 1778 * as it is undefined in this class. 1779 * 1780 * @param parameterIndex the ordinal number of the placeholder parameter 1781 * in this <code>RowSet</code> object's command that is to be set. 1782 * The first parameter is 1, the second is 2, and so on; must be 1783 * <code>1</code> or greater 1784 * @param x the parameter value 1785 * @throws SQLException if an error occurs or the 1786 * parameter index is out of bounds 1787 * @see #getParams 1788 */ 1789 public void setInt(int parameterIndex, int x) throws SQLException { 1790 checkParamIndex(parameterIndex); 1791 if(params == null){ 1792 throw new SQLException("Set initParams() before setInt"); 1793 } 1794 params.put(Integer.valueOf(parameterIndex - 1), Integer.valueOf(x)); 1795 } 1796 1797 /** 1798 * Sets the designated parameter to the given <code>long</code> in the Java 1799 * programming language. The driver converts this to an SQL 1800 * <code>BIGINT</code> value when it sends it to the database. 1801 * <P> 1802 * The parameter value set by this method is stored internally and 1803 * will be supplied as the appropriate parameter in this <code>RowSet</code> 1804 * object's command when the method <code>execute</code> is called. 1805 * Methods such as <code>execute</code> and <code>populate</code> must be 1806 * provided in any class that extends this class and implements one or 1807 * more of the standard JSR-114 <code>RowSet</code> interfaces. 1808 * <P> 1809 * NOTE: <code>JdbcRowSet</code> does not require the <code>populate</code> method 1810 * as it is undefined in this class. 1811 * 1812 * @param parameterIndex the ordinal number of the placeholder parameter 1813 * in this <code>RowSet</code> object's command that is to be set. 1814 * The first parameter is 1, the second is 2, and so on; must be 1815 * <code>1</code> or greater 1816 * @param x the parameter value 1817 * @throws SQLException if an error occurs or the 1818 * parameter index is out of bounds 1819 * @see #getParams 1820 */ 1821 public void setLong(int parameterIndex, long x) throws SQLException { 1822 checkParamIndex(parameterIndex); 1823 if(params == null){ 1824 throw new SQLException("Set initParams() before setLong"); 1825 } 1826 params.put(Integer.valueOf(parameterIndex - 1), Long.valueOf(x)); 1827 } 1828 1829 /** 1830 * Sets the designated parameter to the given <code>float</code> in the 1831 * Java programming language. The driver converts this to an SQL 1832 * <code>FLOAT</code> value when it sends it to the database. 1833 * <P> 1834 * The parameter value set by this method is stored internally and 1835 * will be supplied as the appropriate parameter in this <code>RowSet</code> 1836 * object's command when the method <code>execute</code> is called. 1837 * Methods such as <code>execute</code> and <code>populate</code> must be 1838 * provided in any class that extends this class and implements one or 1839 * more of the standard JSR-114 <code>RowSet</code> interfaces. 1840 * <P> 1841 * NOTE: <code>JdbcRowSet</code> does not require the <code>populate</code> method 1842 * as it is undefined in this class. 1843 * 1844 * @param parameterIndex the ordinal number of the placeholder parameter 1845 * in this <code>RowSet</code> object's command that is to be set. 1846 * The first parameter is 1, the second is 2, and so on; must be 1847 * <code>1</code> or greater 1848 * @param x the parameter value 1849 * @throws SQLException if an error occurs or the 1850 * parameter index is out of bounds 1851 * @see #getParams 1852 */ 1853 public void setFloat(int parameterIndex, float x) throws SQLException { 1854 checkParamIndex(parameterIndex); 1855 if(params == null){ 1856 throw new SQLException("Set initParams() before setFloat"); 1857 } 1858 params.put(Integer.valueOf(parameterIndex - 1), Float.valueOf(x)); 1859 } 1860 1861 /** 1862 * Sets the designated parameter to the given <code>double</code> in the 1863 * Java programming language. The driver converts this to an SQL 1864 * <code>DOUBLE</code> value when it sends it to the database. 1865 * <P> 1866 * The parameter value set by this method is stored internally and 1867 * will be supplied as the appropriate parameter in this <code>RowSet</code> 1868 * object's command when the method <code>execute</code> is called. 1869 * Methods such as <code>execute</code> and <code>populate</code> must be 1870 * provided in any class that extends this class and implements one or 1871 * more of the standard JSR-114 <code>RowSet</code> interfaces. 1872 * <P> 1873 * NOTE: <code>JdbcRowSet</code> does not require the <code>populate</code> method 1874 * as it is undefined in this class. 1875 * 1876 * @param parameterIndex the ordinal number of the placeholder parameter 1877 * in this <code>RowSet</code> object's command that is to be set. 1878 * The first parameter is 1, the second is 2, and so on; must be 1879 * <code>1</code> or greater 1880 * @param x the parameter value 1881 * @throws SQLException if an error occurs or the 1882 * parameter index is out of bounds 1883 * @see #getParams 1884 */ 1885 public void setDouble(int parameterIndex, double x) throws SQLException { 1886 checkParamIndex(parameterIndex); 1887 if(params == null){ 1888 throw new SQLException("Set initParams() before setDouble"); 1889 } 1890 params.put(Integer.valueOf(parameterIndex - 1), Double.valueOf(x)); 1891 } 1892 1893 /** 1894 * Sets the designated parameter to the given 1895 * <code>java.lang.BigDecimal</code> value. The driver converts this to 1896 * an SQL <code>NUMERIC</code> value when it sends it to the database. 1897 * <P> 1898 * The parameter value set by this method is stored internally and 1899 * will be supplied as the appropriate parameter in this <code>RowSet</code> 1900 * object's command when the method <code>execute</code> is called. 1901 * Methods such as <code>execute</code> and <code>populate</code> must be 1902 * provided in any class that extends this class and implements one or 1903 * more of the standard JSR-114 <code>RowSet</code> interfaces. 1904 * <P> 1905 * Note: <code>JdbcRowSet</code> does not require the <code>populate</code> method 1906 * as it is undefined in this class. 1907 * 1908 * @param parameterIndex the ordinal number of the placeholder parameter 1909 * in this <code>RowSet</code> object's command that is to be set. 1910 * The first parameter is 1, the second is 2, and so on; must be 1911 * <code>1</code> or greater 1912 * @param x the parameter value 1913 * @throws SQLException if an error occurs or the 1914 * parameter index is out of bounds 1915 * @see #getParams 1916 */ 1917 public void setBigDecimal(int parameterIndex, java.math.BigDecimal x) throws SQLException { 1918 checkParamIndex(parameterIndex); 1919 if(params == null){ 1920 throw new SQLException("Set initParams() before setBigDecimal"); 1921 } 1922 params.put(Integer.valueOf(parameterIndex - 1), x); 1923 } 1924 1925 /** 1926 * Sets the designated parameter to the given <code>String</code> 1927 * value. The driver converts this to an SQL 1928 * <code>VARCHAR</code> or <code>LONGVARCHAR</code> value 1929 * (depending on the argument's size relative to the driver's limits 1930 * on <code>VARCHAR</code> values) when it sends it to the database. 1931 * <P> 1932 * The parameter value set by this method is stored internally and 1933 * will be supplied as the appropriate parameter in this <code>RowSet</code> 1934 * object's command when the method <code>execute</code> is called. 1935 * Methods such as <code>execute</code> and <code>populate</code> must be 1936 * provided in any class that extends this class and implements one or 1937 * more of the standard JSR-114 <code>RowSet</code> interfaces. 1938 * <p> 1939 * NOTE: <code>JdbcRowSet</code> does not require the <code>populate</code> method 1940 * as it is undefined in this class. 1941 * 1942 * @param parameterIndex the ordinal number of the placeholder parameter 1943 * in this <code>RowSet</code> object's command that is to be set. 1944 * The first parameter is 1, the second is 2, and so on; must be 1945 * <code>1</code> or greater 1946 * @param x the parameter value 1947 * @throws SQLException if an error occurs or the 1948 * parameter index is out of bounds 1949 * @see #getParams 1950 */ 1951 public void setString(int parameterIndex, String x) throws SQLException { 1952 checkParamIndex(parameterIndex); 1953 if(params == null){ 1954 throw new SQLException("Set initParams() before setString"); 1955 } 1956 params.put(Integer.valueOf(parameterIndex - 1), x); 1957 } 1958 1959 /** 1960 * Sets the designated parameter to the given array of bytes. 1961 * The driver converts this to an SQL 1962 * <code>VARBINARY</code> or <code>LONGVARBINARY</code> value 1963 * (depending on the argument's size relative to the driver's limits 1964 * on <code>VARBINARY</code> values) when it sends it to the database. 1965 * <P> 1966 * The parameter value set by this method is stored internally and 1967 * will be supplied as the appropriate parameter in this <code>RowSet</code> 1968 * object's command when the method <code>execute</code> is called. 1969 * Methods such as <code>execute</code> and <code>populate</code> must be 1970 * provided in any class that extends this class and implements one or 1971 * more of the standard JSR-114 <code>RowSet</code> interfaces. 1972 * <p> 1973 * NOTE: <code>JdbcRowSet</code> does not require the <code>populate</code> method 1974 * as it is undefined in this class. 1975 * 1976 * @param parameterIndex the ordinal number of the placeholder parameter 1977 * in this <code>RowSet</code> object's command that is to be set. 1978 * The first parameter is 1, the second is 2, and so on; must be 1979 * <code>1</code> or greater 1980 * @param x the parameter value 1981 * @throws SQLException if an error occurs or the 1982 * parameter index is out of bounds 1983 * @see #getParams 1984 */ 1985 public void setBytes(int parameterIndex, byte x[]) throws SQLException { 1986 checkParamIndex(parameterIndex); 1987 if(params == null){ 1988 throw new SQLException("Set initParams() before setBytes"); 1989 } 1990 params.put(Integer.valueOf(parameterIndex - 1), x); 1991 } 1992 1993 /** 1994 * Sets the designated parameter to the given <code>java.sql.Date</code> 1995 * value. The driver converts this to an SQL 1996 * <code>DATE</code> value when it sends it to the database. 1997 * <P> 1998 * The parameter value set by this method is stored internally and 1999 * will be supplied as the appropriate parameter in this <code>RowSet</code> 2000 * object's command when the method <code>execute</code> is called. 2001 * Methods such as <code>execute</code> and <code>populate</code> must be 2002 * provided in any class that extends this class and implements one or 2003 * more of the standard JSR-114 <code>RowSet</code> interfaces. 2004 * <P> 2005 * NOTE: <code>JdbcRowSet</code> does not require the <code>populate</code> method 2006 * as it is undefined in this class. 2007 * <P> 2008 * Calls made to the method <code>getParams</code> after this version 2009 * of <code>setDate</code> 2010 * has been called will return an array with the value to be set for 2011 * placeholder parameter number <i>parameterIndex</i> being the <code>Date</code> 2012 * object supplied as the second parameter. 2013 * Note that because the numbering of elements in an array starts at zero, 2014 * the array element that corresponds to placeholder parameter number 2015 * <i>parameterIndex</i> is <i>parameterIndex</i> -1. 2016 * 2017 * @param parameterIndex the ordinal number of the placeholder parameter 2018 * in this <code>RowSet</code> object's command that is to be set. 2019 * The first parameter is 1, the second is 2, and so on; must be 2020 * <code>1</code> or greater 2021 * @param x the parameter value 2022 * @throws SQLException if an error occurs or the 2023 * parameter index is out of bounds 2024 * @see #getParams 2025 */ 2026 public void setDate(int parameterIndex, java.sql.Date x) throws SQLException { 2027 checkParamIndex(parameterIndex); 2028 2029 if(params == null){ 2030 throw new SQLException("Set initParams() before setDate"); 2031 } 2032 params.put(Integer.valueOf(parameterIndex - 1), x); 2033 } 2034 2035 /** 2036 * Sets the designated parameter to the given <code>java.sql.Time</code> 2037 * value. The driver converts this to an SQL <code>TIME</code> value 2038 * when it sends it to the database. 2039 * <P> 2040 * The parameter value set by this method is stored internally and 2041 * will be supplied as the appropriate parameter in this <code>RowSet</code> 2042 * object's command when the method <code>execute</code> is called. 2043 * Methods such as <code>execute</code> and <code>populate</code> must be 2044 * provided in any class that extends this class and implements one or 2045 * more of the standard JSR-114 <code>RowSet</code> interfaces. 2046 * <P> 2047 * NOTE: <code>JdbcRowSet</code> does not require the <code>populate</code> method 2048 * as it is undefined in this class. 2049 * <P> 2050 * Calls made to the method <code>getParams</code> after this version 2051 * of the method <code>setTime</code> 2052 * has been called will return an array of the parameters that have been set. 2053 * The parameter to be set for parameter placeholder number <i>parameterIndex</i> 2054 * will be the <code>Time</code> object that was set as the second parameter 2055 * to this method. 2056 * <P> 2057 * Note that because the numbering of elements in an array starts at zero, 2058 * the array element that corresponds to placeholder parameter number 2059 * <i>parameterIndex</i> is <i>parameterIndex</i> -1. 2060 * 2061 * @param parameterIndex the ordinal number of the placeholder parameter 2062 * in this <code>RowSet</code> object's command that is to be set. 2063 * The first parameter is 1, the second is 2, and so on; must be 2064 * <code>1</code> or greater 2065 * @param x a <code>java.sql.Time</code> object, which is to be set as the value 2066 * for placeholder parameter <i>parameterIndex</i> 2067 * @throws SQLException if an error occurs or the 2068 * parameter index is out of bounds 2069 * @see #getParams 2070 */ 2071 public void setTime(int parameterIndex, java.sql.Time x) throws SQLException { 2072 checkParamIndex(parameterIndex); 2073 if(params == null){ 2074 throw new SQLException("Set initParams() before setTime"); 2075 } 2076 2077 params.put(Integer.valueOf(parameterIndex - 1), x); 2078 } 2079 2080 /** 2081 * Sets the designated parameter to the given 2082 * <code>java.sql.Timestamp</code> value. 2083 * The driver converts this to an SQL <code>TIMESTAMP</code> value when it 2084 * sends it to the database. 2085 * <P> 2086 * The parameter value set by this method is stored internally and 2087 * will be supplied as the appropriate parameter in this <code>RowSet</code> 2088 * object's command when the method <code>execute</code> is called. 2089 * Methods such as <code>execute</code> and <code>populate</code> must be 2090 * provided in any class that extends this class and implements one or 2091 * more of the standard JSR-114 <code>RowSet</code> interfaces. 2092 * <P> 2093 * NOTE: <code>JdbcRowSet</code> does not require the <code>populate</code> method 2094 * as it is undefined in this class. 2095 * <P> 2096 * Calls made to the method <code>getParams</code> after this version of 2097 * <code>setTimestamp</code> 2098 * has been called will return an array with the value for parameter placeholder 2099 * number <i>parameterIndex</i> being the <code>Timestamp</code> object that was 2100 * supplied as the second parameter to this method. 2101 * Note that because the numbering of elements in an array starts at zero, 2102 * the array element that corresponds to placeholder parameter number 2103 * <i>parameterIndex</i> is <i>parameterIndex</i> -1. 2104 * 2105 * @param parameterIndex the ordinal number of the placeholder parameter 2106 * in this <code>RowSet</code> object's command that is to be set. 2107 * The first parameter is 1, the second is 2, and so on; must be 2108 * <code>1</code> or greater 2109 * @param x a <code>java.sql.Timestamp</code> object 2110 * @throws SQLException if an error occurs or the 2111 * parameter index is out of bounds 2112 * @see #getParams 2113 */ 2114 public void setTimestamp(int parameterIndex, java.sql.Timestamp x) throws SQLException { 2115 checkParamIndex(parameterIndex); 2116 if(params == null){ 2117 throw new SQLException("Set initParams() before setTimestamp"); 2118 } 2119 2120 params.put(Integer.valueOf(parameterIndex - 1), x); 2121 } 2122 2123 /** 2124 * Sets the designated parameter to the given 2125 * <code>java.io.InputStream</code> object, 2126 * which will have the specified number of bytes. 2127 * The contents of the stream will be read and sent to the database. 2128 * This method throws an <code>SQLException</code> object if the number of bytes 2129 * read and sent to the database is not equal to <i>length</i>. 2130 * <P> 2131 * When a very large ASCII value is input to a <code>LONGVARCHAR</code> 2132 * parameter, it may be more practical to send it via a 2133 * <code>java.io.InputStream</code> object. A JDBC technology-enabled 2134 * driver will read the data from the stream as needed until it reaches 2135 * end-of-file. The driver will do any necessary conversion from ASCII to 2136 * the database <code>CHAR</code> format. 2137 * 2138 * <P><B>Note:</B> This stream object can be either a standard 2139 * Java stream object or your own subclass that implements the 2140 * standard interface. 2141 * <P> 2142 * The parameter value set by this method is stored internally and 2143 * will be supplied as the appropriate parameter in this <code>RowSet</code> 2144 * object's command when the method <code>execute</code> is called. 2145 * Methods such as <code>execute</code> and <code>populate</code> must be 2146 * provided in any class that extends this class and implements one or 2147 * more of the standard JSR-114 <code>RowSet</code> interfaces. 2148 * <P> 2149 * Note: <code>JdbcRowSet</code> does not require the <code>populate</code> method 2150 * as it is undefined in this class. 2151 * <P> 2152 * Calls made to the method <code>getParams</code> after <code>setAsciiStream</code> 2153 * has been called will return an array containing the parameter values that 2154 * have been set. The element in the array that represents the values 2155 * set with this method will itself be an array. The first element of that array 2156 * is the given <code>java.io.InputStream</code> object. 2157 * The second element is the value set for <i>length</i>. 2158 * The third element is an internal <code>BaseRowSet</code> constant 2159 * specifying that the stream passed to this method is an ASCII stream. 2160 * The parameter number is indicated by an element's position in the array 2161 * returned by the method <code>getParams</code>, 2162 * with the first element being the value for the first placeholder parameter, the 2163 * second element being the value for the second placeholder parameter, and so on. 2164 * In other words, if the input stream being set is the value for the second 2165 * placeholder parameter, the array containing it will be the second element in 2166 * the array returned by <code>getParams</code>. 2167 * <P> 2168 * Note that because the numbering of elements in an array starts at zero, 2169 * the array element that corresponds to placeholder parameter number 2170 * <i>parameterIndex</i> is element number <i>parameterIndex</i> -1. 2171 * 2172 * @param parameterIndex the ordinal number of the placeholder parameter 2173 * in this <code>RowSet</code> object's command that is to be set. 2174 * The first parameter is 1, the second is 2, and so on; must be 2175 * <code>1</code> or greater 2176 * @param x the Java input stream that contains the ASCII parameter value 2177 * @param length the number of bytes in the stream. This is the number of bytes 2178 * the driver will send to the DBMS; lengths of 0 or less are 2179 * are undefined but will cause an invalid length exception to be 2180 * thrown in the underlying JDBC driver. 2181 * @throws SQLException if an error occurs, the parameter index is out of bounds, 2182 * or when connected to a data source, the number of bytes the driver reads 2183 * and sends to the database is not equal to the number of bytes specified 2184 * in <i>length</i> 2185 * @see #getParams 2186 */ 2187 public void setAsciiStream(int parameterIndex, java.io.InputStream x, int length) throws SQLException { 2188 Object asciiStream[]; 2189 checkParamIndex(parameterIndex); 2190 2191 asciiStream = new Object[3]; 2192 asciiStream[0] = x; 2193 asciiStream[1] = Integer.valueOf(length); 2194 asciiStream[2] = Integer.valueOf(ASCII_STREAM_PARAM); 2195 2196 if(params == null){ 2197 throw new SQLException("Set initParams() before setAsciiStream"); 2198 } 2199 2200 params.put(Integer.valueOf(parameterIndex - 1), asciiStream); 2201 } 2202 2203 /** 2204 * Sets the designated parameter in this <code>RowSet</code> object's command 2205 * to the given input stream. 2206 * When a very large ASCII value is input to a <code>LONGVARCHAR</code> 2207 * parameter, it may be more practical to send it via a 2208 * <code>java.io.InputStream</code>. Data will be read from the stream 2209 * as needed until end-of-file is reached. The JDBC driver will 2210 * do any necessary conversion from ASCII to the database char format. 2211 * 2212 * <P><B>Note:</B> This stream object can either be a standard 2213 * Java stream object or your own subclass that implements the 2214 * standard interface. 2215 * <P><B>Note:</B> Consult your JDBC driver documentation to determine if 2216 * it might be more efficient to use a version of 2217 * <code>setAsciiStream</code> which takes a length parameter. 2218 * 2219 * @param parameterIndex the first parameter is 1, the second is 2, ... 2220 * @param x the Java input stream that contains the ASCII parameter value 2221 * @exception SQLException if a database access error occurs or 2222 * this method is called on a closed <code>PreparedStatement</code> 2223 * @throws SQLFeatureNotSupportedException if the JDBC driver does not support this method 2224 * @since 1.6 2225 */ 2226 public void setAsciiStream(int parameterIndex, java.io.InputStream x) 2227 throws SQLException { 2228 throw new SQLFeatureNotSupportedException("Feature not supported"); 2229 } 2230 2231 /** 2232 * Sets the designated parameter to the given <code>java.io.InputStream</code> 2233 * object, which will have the specified number of bytes. 2234 * The contents of the stream will be read and sent to the database. 2235 * This method throws an <code>SQLException</code> object if the number of bytes 2236 * read and sent to the database is not equal to <i>length</i>. 2237 * <P> 2238 * When a very large binary value is input to a 2239 * <code>LONGVARBINARY</code> parameter, it may be more practical 2240 * to send it via a <code>java.io.InputStream</code> object. 2241 * A JDBC technology-enabled driver will read the data from the 2242 * stream as needed until it reaches end-of-file. 2243 * 2244 * <P><B>Note:</B> This stream object can be either a standard 2245 * Java stream object or your own subclass that implements the 2246 * standard interface. 2247 * <P> 2248 * The parameter value set by this method is stored internally and 2249 * will be supplied as the appropriate parameter in this <code>RowSet</code> 2250 * object's command when the method <code>execute</code> is called. 2251 * Methods such as <code>execute</code> and <code>populate</code> must be 2252 * provided in any class that extends this class and implements one or 2253 * more of the standard JSR-114 <code>RowSet</code> interfaces. 2254 *<P> 2255 * NOTE: <code>JdbcRowSet</code> does not require the <code>populate</code> method 2256 * as it is undefined in this class. 2257 * <P> 2258 * Calls made to the method <code>getParams</code> after <code>setBinaryStream</code> 2259 * has been called will return an array containing the parameter values that 2260 * have been set. In that array, the element that represents the values 2261 * set with this method will itself be an array. The first element of that array 2262 * is the given <code>java.io.InputStream</code> object. 2263 * The second element is the value set for <i>length</i>. 2264 * The third element is an internal <code>BaseRowSet</code> constant 2265 * specifying that the stream passed to this method is a binary stream. 2266 * The parameter number is indicated by an element's position in the array 2267 * returned by the method <code>getParams</code>, 2268 * with the first element being the value for the first placeholder parameter, the 2269 * second element being the value for the second placeholder parameter, and so on. 2270 * In other words, if the input stream being set is the value for the second 2271 * placeholder parameter, the array containing it will be the second element in 2272 * the array returned by <code>getParams</code>. 2273 * <P> 2274 * Note that because the numbering of elements in an array starts at zero, 2275 * the array element that corresponds to placeholder parameter number 2276 * <i>parameterIndex</i> is element number <i>parameterIndex</i> -1. 2277 * 2278 * @param parameterIndex the ordinal number of the placeholder parameter 2279 * in this <code>RowSet</code> object's command that is to be set. 2280 * The first parameter is 1, the second is 2, and so on; must be 2281 * <code>1</code> or greater 2282 * @param x the input stream that contains the binary value to be set 2283 * @param length the number of bytes in the stream; lengths of 0 or less are 2284 * are undefined but will cause an invalid length exception to be 2285 * thrown in the underlying JDBC driver. 2286 * @throws SQLException if an error occurs, the parameter index is out of bounds, 2287 * or when connected to a data source, the number of bytes the driver 2288 * reads and sends to the database is not equal to the number of bytes 2289 * specified in <i>length</i> 2290 * @see #getParams 2291 */ 2292 public void setBinaryStream(int parameterIndex, java.io.InputStream x, int length) throws SQLException { 2293 Object binaryStream[]; 2294 checkParamIndex(parameterIndex); 2295 2296 binaryStream = new Object[3]; 2297 binaryStream[0] = x; 2298 binaryStream[1] = Integer.valueOf(length); 2299 binaryStream[2] = Integer.valueOf(BINARY_STREAM_PARAM); 2300 if(params == null){ 2301 throw new SQLException("Set initParams() before setBinaryStream"); 2302 } 2303 2304 params.put(Integer.valueOf(parameterIndex - 1), binaryStream); 2305 } 2306 2307 2308 /** 2309 * Sets the designated parameter in this <code>RowSet</code> object's command 2310 * to the given input stream. 2311 * When a very large binary value is input to a <code>LONGVARBINARY</code> 2312 * parameter, it may be more practical to send it via a 2313 * <code>java.io.InputStream</code> object. The data will be read from the 2314 * stream as needed until end-of-file is reached. 2315 * 2316 * <P><B>Note:</B> This stream object can either be a standard 2317 * Java stream object or your own subclass that implements the 2318 * standard interface. 2319 * <P><B>Note:</B> Consult your JDBC driver documentation to determine if 2320 * it might be more efficient to use a version of 2321 * <code>setBinaryStream</code> which takes a length parameter. 2322 * 2323 * @param parameterIndex the first parameter is 1, the second is 2, ... 2324 * @param x the java input stream which contains the binary parameter value 2325 * @exception SQLException if a database access error occurs or 2326 * this method is called on a closed <code>PreparedStatement</code> 2327 * @throws SQLFeatureNotSupportedException if the JDBC driver does not support this method 2328 * @since 1.6 2329 */ 2330 public void setBinaryStream(int parameterIndex, java.io.InputStream x) 2331 throws SQLException { 2332 throw new SQLFeatureNotSupportedException("Feature not supported"); 2333 } 2334 2335 2336 /** 2337 * Sets the designated parameter to the given 2338 * <code>java.io.InputStream</code> object, which will have the specified 2339 * number of bytes. The contents of the stream will be read and sent 2340 * to the database. 2341 * This method throws an <code>SQLException</code> if the number of bytes 2342 * read and sent to the database is not equal to <i>length</i>. 2343 * <P> 2344 * When a very large Unicode value is input to a 2345 * <code>LONGVARCHAR</code> parameter, it may be more practical 2346 * to send it via a <code>java.io.InputStream</code> object. 2347 * A JDBC technology-enabled driver will read the data from the 2348 * stream as needed, until it reaches end-of-file. 2349 * The driver will do any necessary conversion from Unicode to the 2350 * database <code>CHAR</code> format. 2351 * The byte format of the Unicode stream must be Java UTF-8, as 2352 * defined in the Java Virtual Machine Specification. 2353 * 2354 * <P><B>Note:</B> This stream object can be either a standard 2355 * Java stream object or your own subclass that implements the 2356 * standard interface. 2357 * <P> 2358 * This method is deprecated; the method <code>getCharacterStream</code> 2359 * should be used in its place. 2360 * <P> 2361 * The parameter value set by this method is stored internally and 2362 * will be supplied as the appropriate parameter in this <code>RowSet</code> 2363 * object's command when the method <code>execute</code> is called. 2364 * Calls made to the method <code>getParams</code> after <code>setUnicodeStream</code> 2365 * has been called will return an array containing the parameter values that 2366 * have been set. In that array, the element that represents the values 2367 * set with this method will itself be an array. The first element of that array 2368 * is the given <code>java.io.InputStream</code> object. 2369 * The second element is the value set for <i>length</i>. 2370 * The third element is an internal <code>BaseRowSet</code> constant 2371 * specifying that the stream passed to this method is a Unicode stream. 2372 * The parameter number is indicated by an element's position in the array 2373 * returned by the method <code>getParams</code>, 2374 * with the first element being the value for the first placeholder parameter, the 2375 * second element being the value for the second placeholder parameter, and so on. 2376 * In other words, if the input stream being set is the value for the second 2377 * placeholder parameter, the array containing it will be the second element in 2378 * the array returned by <code>getParams</code>. 2379 * <P> 2380 * Note that because the numbering of elements in an array starts at zero, 2381 * the array element that corresponds to placeholder parameter number 2382 * <i>parameterIndex</i> is element number <i>parameterIndex</i> -1. 2383 * 2384 * @param parameterIndex the ordinal number of the placeholder parameter 2385 * in this <code>RowSet</code> object's command that is to be set. 2386 * The first parameter is 1, the second is 2, and so on; must be 2387 * <code>1</code> or greater 2388 * @param x the <code>java.io.InputStream</code> object that contains the 2389 * UNICODE parameter value 2390 * @param length the number of bytes in the input stream 2391 * @throws SQLException if an error occurs, the parameter index is out of bounds, 2392 * or the number of bytes the driver reads and sends to the database is 2393 * not equal to the number of bytes specified in <i>length</i> 2394 * @deprecated getCharacterStream should be used in its place 2395 * @see #getParams 2396 */ 2397 @Deprecated 2398 public void setUnicodeStream(int parameterIndex, java.io.InputStream x, int length) throws SQLException { 2399 Object unicodeStream[]; 2400 checkParamIndex(parameterIndex); 2401 2402 unicodeStream = new Object[3]; 2403 unicodeStream[0] = x; 2404 unicodeStream[1] = Integer.valueOf(length); 2405 unicodeStream[2] = Integer.valueOf(UNICODE_STREAM_PARAM); 2406 if(params == null){ 2407 throw new SQLException("Set initParams() before setUnicodeStream"); 2408 } 2409 params.put(Integer.valueOf(parameterIndex - 1), unicodeStream); 2410 } 2411 2412 /** 2413 * Sets the designated parameter to the given <code>java.io.Reader</code> 2414 * object, which will have the specified number of characters. The 2415 * contents of the reader will be read and sent to the database. 2416 * This method throws an <code>SQLException</code> if the number of bytes 2417 * read and sent to the database is not equal to <i>length</i>. 2418 * <P> 2419 * When a very large Unicode value is input to a 2420 * <code>LONGVARCHAR</code> parameter, it may be more practical 2421 * to send it via a <code>Reader</code> object. 2422 * A JDBC technology-enabled driver will read the data from the 2423 * stream as needed until it reaches end-of-file. 2424 * The driver will do any necessary conversion from Unicode to the 2425 * database <code>CHAR</code> format. 2426 * The byte format of the Unicode stream must be Java UTF-8, as 2427 * defined in the Java Virtual Machine Specification. 2428 * 2429 * <P><B>Note:</B> This stream object can be either a standard 2430 * Java stream object or your own subclass that implements the 2431 * standard interface. 2432 * <P> 2433 * The parameter value set by this method is stored internally and 2434 * will be supplied as the appropriate parameter in this <code>RowSet</code> 2435 * object's command when the method <code>execute</code> is called. 2436 * Methods such as <code>execute</code> and <code>populate</code> must be 2437 * provided in any class that extends this class and implements one or 2438 * more of the standard JSR-114 <code>RowSet</code> interfaces. 2439 * <P> 2440 * NOTE: <code>JdbcRowSet</code> does not require the <code>populate</code> method 2441 * as it is undefined in this class. 2442 * <P> 2443 * Calls made to the method <code>getParams</code> after 2444 * <code>setCharacterStream</code> 2445 * has been called will return an array containing the parameter values that 2446 * have been set. In that array, the element that represents the values 2447 * set with this method will itself be an array. The first element of that array 2448 * is the given <code>java.io.Reader</code> object. 2449 * The second element is the value set for <i>length</i>. 2450 * The parameter number is indicated by an element's position in the array 2451 * returned by the method <code>getParams</code>, 2452 * with the first element being the value for the first placeholder parameter, the 2453 * second element being the value for the second placeholder parameter, and so on. 2454 * In other words, if the reader being set is the value for the second 2455 * placeholder parameter, the array containing it will be the second element in 2456 * the array returned by <code>getParams</code>. 2457 * <P> 2458 * Note that because the numbering of elements in an array starts at zero, 2459 * the array element that corresponds to placeholder parameter number 2460 * <i>parameterIndex</i> is element number <i>parameterIndex</i> -1. 2461 * 2462 * @param parameterIndex the ordinal number of the placeholder parameter 2463 * in this <code>RowSet</code> object's command that is to be set. 2464 * The first parameter is 1, the second is 2, and so on; must be 2465 * <code>1</code> or greater 2466 * @param reader the <code>Reader</code> object that contains the 2467 * Unicode data 2468 * @param length the number of characters in the stream; lengths of 0 or 2469 * less are undefined but will cause an invalid length exception to 2470 * be thrown in the underlying JDBC driver. 2471 * @throws SQLException if an error occurs, the parameter index is out of bounds, 2472 * or when connected to a data source, the number of bytes the driver 2473 * reads and sends to the database is not equal to the number of bytes 2474 * specified in <i>length</i> 2475 * @see #getParams 2476 */ 2477 public void setCharacterStream(int parameterIndex, Reader reader, int length) throws SQLException { 2478 Object charStream[]; 2479 checkParamIndex(parameterIndex); 2480 2481 charStream = new Object[2]; 2482 charStream[0] = reader; 2483 charStream[1] = Integer.valueOf(length); 2484 if(params == null){ 2485 throw new SQLException("Set initParams() before setCharacterStream"); 2486 } 2487 params.put(Integer.valueOf(parameterIndex - 1), charStream); 2488 } 2489 2490 /** 2491 * Sets the designated parameter in this <code>RowSet</code> object's command 2492 * to the given <code>Reader</code> 2493 * object. 2494 * When a very large UNICODE value is input to a <code>LONGVARCHAR</code> 2495 * parameter, it may be more practical to send it via a 2496 * <code>java.io.Reader</code> object. The data will be read from the stream 2497 * as needed until end-of-file is reached. The JDBC driver will 2498 * do any necessary conversion from UNICODE to the database char format. 2499 * 2500 * <P><B>Note:</B> This stream object can either be a standard 2501 * Java stream object or your own subclass that implements the 2502 * standard interface. 2503 * <P><B>Note:</B> Consult your JDBC driver documentation to determine if 2504 * it might be more efficient to use a version of 2505 * <code>setCharacterStream</code> which takes a length parameter. 2506 * 2507 * @param parameterIndex the first parameter is 1, the second is 2, ... 2508 * @param reader the <code>java.io.Reader</code> object that contains the 2509 * Unicode data 2510 * @exception SQLException if a database access error occurs or 2511 * this method is called on a closed <code>PreparedStatement</code> 2512 * @throws SQLFeatureNotSupportedException if the JDBC driver does not support this method 2513 * @since 1.6 2514 */ 2515 public void setCharacterStream(int parameterIndex, 2516 java.io.Reader reader) throws SQLException { 2517 throw new SQLFeatureNotSupportedException("Feature not supported"); 2518 } 2519 2520 /** 2521 * Sets the designated parameter to an <code>Object</code> in the Java 2522 * programming language. The second parameter must be an 2523 * <code>Object</code> type. For integral values, the 2524 * <code>java.lang</code> equivalent 2525 * objects should be used. For example, use the class <code>Integer</code> 2526 * for an <code>int</code>. 2527 * <P> 2528 * The driver converts this object to the specified 2529 * target SQL type before sending it to the database. 2530 * If the object has a custom mapping (is of a class implementing 2531 * <code>SQLData</code>), the driver should call the method 2532 * <code>SQLData.writeSQL</code> to write the object to the SQL 2533 * data stream. If, on the other hand, the object is of a class 2534 * implementing <code>Ref</code>, <code>Blob</code>, <code>Clob</code>, 2535 * <code>Struct</code>, or <code>Array</code>, 2536 * the driver should pass it to the database as a value of the 2537 * corresponding SQL type. 2538 * 2539 * <p>Note that this method may be used to pass database- 2540 * specific abstract data types. 2541 * <P> 2542 * The parameter value set by this method is stored internally and 2543 * will be supplied as the appropriate parameter in this <code>RowSet</code> 2544 * object's command when the method <code>execute</code> is called. 2545 * Methods such as <code>execute</code> and <code>populate</code> must be 2546 * provided in any class that extends this class and implements one or 2547 * more of the standard JSR-114 <code>RowSet</code> interfaces. 2548 * <P> 2549 * NOTE: <code>JdbcRowSet</code> does not require the <code>populate</code> method 2550 * as it is undefined in this class. 2551 * <P> 2552 * Calls made to the method <code>getParams</code> after this version of 2553 * <code>setObject</code> 2554 * has been called will return an array containing the parameter values that 2555 * have been set. In that array, the element that represents the values 2556 * set with this method will itself be an array. The first element of that array 2557 * is the given <code>Object</code> instance, and the 2558 * second element is the value set for <i>targetSqlType</i>. The 2559 * third element is the value set for <i>scale</i>, which the driver will 2560 * ignore if the type of the object being set is not 2561 * <code>java.sql.Types.NUMERIC</code> or <code>java.sql.Types.DECIMAL</code>. 2562 * The parameter number is indicated by an element's position in the array 2563 * returned by the method <code>getParams</code>, 2564 * with the first element being the value for the first placeholder parameter, the 2565 * second element being the value for the second placeholder parameter, and so on. 2566 * In other words, if the object being set is the value for the second 2567 * placeholder parameter, the array containing it will be the second element in 2568 * the array returned by <code>getParams</code>. 2569 *<P> 2570 * Note that because the numbering of elements in an array starts at zero, 2571 * the array element that corresponds to placeholder parameter number 2572 * <i>parameterIndex</i> is element number <i>parameterIndex</i> -1. 2573 * 2574 * 2575 * @param parameterIndex the ordinal number of the placeholder parameter 2576 * in this <code>RowSet</code> object's command that is to be set. 2577 * The first parameter is 1, the second is 2, and so on; must be 2578 * <code>1</code> or greater 2579 * @param x the <code>Object</code> containing the input parameter value; 2580 * must be an <code>Object</code> type 2581 * @param targetSqlType the SQL type (as defined in <code>java.sql.Types</code>) 2582 * to be sent to the database. The <code>scale</code> argument may 2583 * further qualify this type. If a non-standard <i>targetSqlType</i> 2584 * is supplied, this method will not throw a <code>SQLException</code>. 2585 * This allows implicit support for non-standard SQL types. 2586 * @param scale for the types <code>java.sql.Types.DECIMAL</code> and 2587 * <code>java.sql.Types.NUMERIC</code>, this is the number 2588 * of digits after the decimal point. For all other types, this 2589 * value will be ignored. 2590 * @throws SQLException if an error occurs or the parameter index is out of bounds 2591 * @see #getParams 2592 */ 2593 public void setObject(int parameterIndex, Object x, int targetSqlType, int scale) throws SQLException { 2594 Object obj[]; 2595 checkParamIndex(parameterIndex); 2596 2597 obj = new Object[3]; 2598 obj[0] = x; 2599 obj[1] = Integer.valueOf(targetSqlType); 2600 obj[2] = Integer.valueOf(scale); 2601 if(params == null){ 2602 throw new SQLException("Set initParams() before setObject"); 2603 } 2604 params.put(Integer.valueOf(parameterIndex - 1), obj); 2605 } 2606 2607 /** 2608 * Sets the value of the designated parameter with the given 2609 * <code>Object</code> value. 2610 * This method is like <code>setObject(int parameterIndex, Object x, int 2611 * targetSqlType, int scale)</code> except that it assumes a scale of zero. 2612 * <P> 2613 * The parameter value set by this method is stored internally and 2614 * will be supplied as the appropriate parameter in this <code>RowSet</code> 2615 * object's command when the method <code>execute</code> is called. 2616 * Methods such as <code>execute</code> and <code>populate</code> must be 2617 * provided in any class that extends this class and implements one or 2618 * more of the standard JSR-114 <code>RowSet</code> interfaces. 2619 * <P> 2620 * NOTE: <code>JdbcRowSet</code> does not require the <code>populate</code> method 2621 * as it is undefined in this class. 2622 * <P> 2623 * Calls made to the method <code>getParams</code> after this version of 2624 * <code>setObject</code> 2625 * has been called will return an array containing the parameter values that 2626 * have been set. In that array, the element that represents the values 2627 * set with this method will itself be an array. The first element of that array 2628 * is the given <code>Object</code> instance. 2629 * The second element is the value set for <i>targetSqlType</i>. 2630 * The parameter number is indicated by an element's position in the array 2631 * returned by the method <code>getParams</code>, 2632 * with the first element being the value for the first placeholder parameter, the 2633 * second element being the value for the second placeholder parameter, and so on. 2634 * In other words, if the object being set is the value for the second 2635 * placeholder parameter, the array containing it will be the second element in 2636 * the array returned by <code>getParams</code>. 2637 * <P> 2638 * Note that because the numbering of elements in an array starts at zero, 2639 * the array element that corresponds to placeholder parameter number 2640 * <i>parameterIndex</i> is element number <i>parameterIndex</i> -1. 2641 * 2642 * @param parameterIndex the ordinal number of the placeholder parameter 2643 * in this <code>RowSet</code> object's command that is to be set. 2644 * The first parameter is 1, the second is 2, and so on; must be 2645 * <code>1</code> or greater 2646 * @param x the <code>Object</code> containing the input parameter value; 2647 * must be an <code>Object</code> type 2648 * @param targetSqlType the SQL type (as defined in <code>java.sql.Types</code>) 2649 * to be sent to the database. If a non-standard <i>targetSqlType</i> 2650 * is supplied, this method will not throw a <code>SQLException</code>. 2651 * This allows implicit support for non-standard SQL types. 2652 * @throws SQLException if an error occurs or the parameter index 2653 * is out of bounds 2654 * @see #getParams 2655 */ 2656 public void setObject(int parameterIndex, Object x, int targetSqlType) throws SQLException { 2657 Object obj[]; 2658 checkParamIndex(parameterIndex); 2659 2660 obj = new Object[2]; 2661 obj[0] = x; 2662 obj[1] = Integer.valueOf(targetSqlType); 2663 if (params == null){ 2664 throw new SQLException("Set initParams() before setObject"); 2665 } 2666 params.put(Integer.valueOf(parameterIndex - 1), obj); 2667 } 2668 2669 /** 2670 * Sets the designated parameter to an <code>Object</code> in the Java 2671 * programming language. The second parameter must be an 2672 * <code>Object</code> 2673 * type. For integral values, the <code>java.lang</code> equivalent 2674 * objects should be used. For example, use the class <code>Integer</code> 2675 * for an <code>int</code>. 2676 * <P> 2677 * The JDBC specification defines a standard mapping from 2678 * Java <code>Object</code> types to SQL types. The driver will 2679 * use this standard mapping to convert the given object 2680 * to its corresponding SQL type before sending it to the database. 2681 * If the object has a custom mapping (is of a class implementing 2682 * <code>SQLData</code>), the driver should call the method 2683 * <code>SQLData.writeSQL</code> to write the object to the SQL 2684 * data stream. 2685 * <P> 2686 * If, on the other hand, the object is of a class 2687 * implementing <code>Ref</code>, <code>Blob</code>, <code>Clob</code>, 2688 * <code>Struct</code>, or <code>Array</code>, 2689 * the driver should pass it to the database as a value of the 2690 * corresponding SQL type. 2691 * <P> 2692 * This method throws an exception if there 2693 * is an ambiguity, for example, if the object is of a class 2694 * implementing more than one interface. 2695 * <P> 2696 * Note that this method may be used to pass database-specific 2697 * abstract data types. 2698 * <P> 2699 * The parameter value set by this method is stored internally and 2700 * will be supplied as the appropriate parameter in this <code>RowSet</code> 2701 * object's command when the method <code>execute</code> is called. 2702 * Methods such as <code>execute</code> and <code>populate</code> must be 2703 * provided in any class that extends this class and implements one or 2704 * more of the standard JSR-114 <code>RowSet</code> interfaces. 2705 * <p> 2706 * NOTE: <code>JdbcRowSet</code> does not require the <code>populate</code> method 2707 * as it is undefined in this class. 2708 * <P> 2709 * After this method has been called, a call to the 2710 * method <code>getParams</code> 2711 * will return an object array of the current command parameters, which will 2712 * include the <code>Object</code> set for placeholder parameter number 2713 * <code>parameterIndex</code>. 2714 * Note that because the numbering of elements in an array starts at zero, 2715 * the array element that corresponds to placeholder parameter number 2716 * <i>parameterIndex</i> is element number <i>parameterIndex</i> -1. 2717 * 2718 * @param parameterIndex the ordinal number of the placeholder parameter 2719 * in this <code>RowSet</code> object's command that is to be set. 2720 * The first parameter is 1, the second is 2, and so on; must be 2721 * <code>1</code> or greater 2722 * @param x the object containing the input parameter value 2723 * @throws SQLException if an error occurs the 2724 * parameter index is out of bounds, or there 2725 * is ambiguity in the implementation of the 2726 * object being set 2727 * @see #getParams 2728 */ 2729 public void setObject(int parameterIndex, Object x) throws SQLException { 2730 checkParamIndex(parameterIndex); 2731 if (params == null) { 2732 throw new SQLException("Set initParams() before setObject"); 2733 } 2734 params.put(Integer.valueOf(parameterIndex - 1), x); 2735 } 2736 2737 /** 2738 * Sets the designated parameter to the given <code>Ref</code> object in 2739 * the Java programming language. The driver converts this to an SQL 2740 * <code>REF</code> value when it sends it to the database. Internally, the 2741 * <code>Ref</code> is represented as a <code>SerialRef</code> to ensure 2742 * serializability. 2743 * <P> 2744 * The parameter value set by this method is stored internally and 2745 * will be supplied as the appropriate parameter in this <code>RowSet</code> 2746 * object's command when the method <code>execute</code> is called. 2747 * Methods such as <code>execute</code> and <code>populate</code> must be 2748 * provided in any class that extends this class and implements one or 2749 * more of the standard JSR-114 <code>RowSet</code> interfaces. 2750 * <p> 2751 * NOTE: <code>JdbcRowSet</code> does not require the <code>populate</code> method 2752 * as it is undefined in this class. 2753 * <p> 2754 * After this method has been called, a call to the 2755 * method <code>getParams</code> 2756 * will return an object array of the current command parameters, which will 2757 * include the <code>Ref</code> object set for placeholder parameter number 2758 * <code>parameterIndex</code>. 2759 * Note that because the numbering of elements in an array starts at zero, 2760 * the array element that corresponds to placeholder parameter number 2761 * <i>parameterIndex</i> is element number <i>parameterIndex</i> -1. 2762 * 2763 * @param parameterIndex the ordinal number of the placeholder parameter 2764 * in this <code>RowSet</code> object's command that is to be set. 2765 * The first parameter is 1, the second is 2, and so on; must be 2766 * <code>1</code> or greater 2767 * @param ref a <code>Ref</code> object representing an SQL <code>REF</code> 2768 * value; cannot be null 2769 * @throws SQLException if an error occurs; the parameter index is out of 2770 * bounds or the <code>Ref</code> object is <code>null</code>; or 2771 * the <code>Ref</code> object returns a <code>null</code> base type 2772 * name. 2773 * @see #getParams 2774 * @see javax.sql.rowset.serial.SerialRef 2775 */ 2776 public void setRef (int parameterIndex, Ref ref) throws SQLException { 2777 checkParamIndex(parameterIndex); 2778 if (params == null) { 2779 throw new SQLException("Set initParams() before setRef"); 2780 } 2781 params.put(Integer.valueOf(parameterIndex - 1), new SerialRef(ref)); 2782 } 2783 2784 /** 2785 * Sets the designated parameter to the given <code>Blob</code> object in 2786 * the Java programming language. The driver converts this to an SQL 2787 * <code>BLOB</code> value when it sends it to the database. Internally, 2788 * the <code>Blob</code> is represented as a <code>SerialBlob</code> 2789 * to ensure serializability. 2790 * <P> 2791 * The parameter value set by this method is stored internally and 2792 * will be supplied as the appropriate parameter in this <code>RowSet</code> 2793 * object's command when the method <code>execute</code> is called. 2794 * Methods such as <code>execute</code> and <code>populate</code> must be 2795 * provided in any class that extends this class and implements one or 2796 * more of the standard JSR-114 <code>RowSet</code> interfaces. 2797 * NOTE: <code>JdbcRowSet</code> does not require the <code>populate</code> method 2798 * as it is undefined in this class. 2799 * <p> 2800 * After this method has been called, a call to the 2801 * method <code>getParams</code> 2802 * will return an object array of the current command parameters, which will 2803 * include the <code>Blob</code> object set for placeholder parameter number 2804 * <code>parameterIndex</code>. 2805 * Note that because the numbering of elements in an array starts at zero, 2806 * the array element that corresponds to placeholder parameter number 2807 * <i>parameterIndex</i> is element number <i>parameterIndex</i> -1. 2808 * 2809 * @param parameterIndex the ordinal number of the placeholder parameter 2810 * in this <code>RowSet</code> object's command that is to be set. 2811 * The first parameter is 1, the second is 2, and so on; must be 2812 * <code>1</code> or greater 2813 * @param x a <code>Blob</code> object representing an SQL 2814 * <code>BLOB</code> value 2815 * @throws SQLException if an error occurs or the 2816 * parameter index is out of bounds 2817 * @see #getParams 2818 * @see javax.sql.rowset.serial.SerialBlob 2819 */ 2820 public void setBlob (int parameterIndex, Blob x) throws SQLException { 2821 checkParamIndex(parameterIndex); 2822 if(params == null){ 2823 throw new SQLException("Set initParams() before setBlob"); 2824 } 2825 params.put(Integer.valueOf(parameterIndex - 1), new SerialBlob(x)); 2826 } 2827 2828 /** 2829 * Sets the designated parameter to the given <code>Clob</code> object in 2830 * the Java programming language. The driver converts this to an SQL 2831 * <code>CLOB</code> value when it sends it to the database. Internally, the 2832 * <code>Clob</code> is represented as a <code>SerialClob</code> to ensure 2833 * serializability. 2834 * <P> 2835 * The parameter value set by this method is stored internally and 2836 * will be supplied as the appropriate parameter in this <code>RowSet</code> 2837 * object's command when the method <code>execute</code> is called. 2838 * Methods such as <code>execute</code> and <code>populate</code> must be 2839 * provided in any class that extends this class and implements one or 2840 * more of the standard JSR-114 <code>RowSet</code> interfaces. 2841 * <p> 2842 * NOTE: <code>JdbcRowSet</code> does not require the <code>populate</code> method 2843 * as it is undefined in this class. 2844 * <p> 2845 * After this method has been called, a call to the 2846 * method <code>getParams</code> 2847 * will return an object array of the current command parameters, which will 2848 * include the <code>Clob</code> object set for placeholder parameter number 2849 * <code>parameterIndex</code>. 2850 * Note that because the numbering of elements in an array starts at zero, 2851 * the array element that corresponds to placeholder parameter number 2852 * <i>parameterIndex</i> is element number <i>parameterIndex</i> -1. 2853 * 2854 * @param parameterIndex the ordinal number of the placeholder parameter 2855 * in this <code>RowSet</code> object's command that is to be set. 2856 * The first parameter is 1, the second is 2, and so on; must be 2857 * <code>1</code> or greater 2858 * @param x a <code>Clob</code> object representing an SQL 2859 * <code>CLOB</code> value; cannot be null 2860 * @throws SQLException if an error occurs; the parameter index is out of 2861 * bounds or the <code>Clob</code> is null 2862 * @see #getParams 2863 * @see javax.sql.rowset.serial.SerialBlob 2864 */ 2865 public void setClob (int parameterIndex, Clob x) throws SQLException { 2866 checkParamIndex(parameterIndex); 2867 if(params == null){ 2868 throw new SQLException("Set initParams() before setClob"); 2869 } 2870 params.put(Integer.valueOf(parameterIndex - 1), new SerialClob(x)); 2871 } 2872 2873 /** 2874 * Sets the designated parameter to an <code>Array</code> object in the 2875 * Java programming language. The driver converts this to an SQL 2876 * <code>ARRAY</code> value when it sends it to the database. Internally, 2877 * the <code>Array</code> is represented as a <code>SerialArray</code> 2878 * to ensure serializability. 2879 * <P> 2880 * The parameter value set by this method is stored internally and 2881 * will be supplied as the appropriate parameter in this <code>RowSet</code> 2882 * object's command when the method <code>execute</code> is called. 2883 * Methods such as <code>execute</code> and <code>populate</code> must be 2884 * provided in any class that extends this class and implements one or 2885 * more of the standard JSR-114 <code>RowSet</code> interfaces. 2886 * <P> 2887 * Note: <code>JdbcRowSet</code> does not require the <code>populate</code> method 2888 * as it is undefined in this class. 2889 * <p> 2890 * After this method has been called, a call to the 2891 * method <code>getParams</code> 2892 * will return an object array of the current command parameters, which will 2893 * include the <code>Array</code> object set for placeholder parameter number 2894 * <code>parameterIndex</code>. 2895 * Note that because the numbering of elements in an array starts at zero, 2896 * the array element that corresponds to placeholder parameter number 2897 * <i>parameterIndex</i> is element number <i>parameterIndex</i> -1. 2898 * 2899 * @param parameterIndex the ordinal number of the placeholder parameter 2900 * in this <code>RowSet</code> object's command that is to be set. 2901 * The first parameter is 1, the second is 2, and so on; must be 2902 * <code>1</code> or greater 2903 * @param array an <code>Array</code> object representing an SQL 2904 * <code>ARRAY</code> value; cannot be null. The <code>Array</code> object 2905 * passed to this method must return a non-null Object for all 2906 * <code>getArray()</code> method calls. A null value will cause a 2907 * <code>SQLException</code> to be thrown. 2908 * @throws SQLException if an error occurs; the parameter index is out of 2909 * bounds or the <code>ARRAY</code> is null 2910 * @see #getParams 2911 * @see javax.sql.rowset.serial.SerialArray 2912 */ 2913 public void setArray (int parameterIndex, Array array) throws SQLException { 2914 checkParamIndex(parameterIndex); 2915 if (params == null){ 2916 throw new SQLException("Set initParams() before setArray"); 2917 } 2918 params.put(Integer.valueOf(parameterIndex - 1), new SerialArray(array)); 2919 } 2920 2921 /** 2922 * Sets the designated parameter to the given <code>java.sql.Date</code> 2923 * object. 2924 * When the DBMS does not store time zone information, the driver will use 2925 * the given <code>Calendar</code> object to construct the SQL <code>DATE</code> 2926 * value to send to the database. With a 2927 * <code>Calendar</code> object, the driver can calculate the date 2928 * taking into account a custom time zone. If no <code>Calendar</code> 2929 * object is specified, the driver uses the time zone of the Virtual Machine 2930 * that is running the application. 2931 * <P> 2932 * The parameter value set by this method is stored internally and 2933 * will be supplied as the appropriate parameter in this <code>RowSet</code> 2934 * object's command when the method <code>execute</code> is called. 2935 * Methods such as <code>execute</code> and <code>populate</code> must be 2936 * provided in any class that extends this class and implements one or 2937 * more of the standard JSR-114 <code>RowSet</code> interfaces. 2938 * <P> 2939 * NOTE: <code>JdbcRowSet</code> does not require the <code>populate</code> method 2940 * as it is undefined in this class. 2941 * <P> 2942 * Calls made to the method <code>getParams</code> after this version of 2943 * <code>setDate</code> 2944 * has been called will return an array containing the parameter values that 2945 * have been set. In that array, the element that represents the values 2946 * set with this method will itself be an array. The first element of that array 2947 * is the given <code>java.sql.Date</code> object. 2948 * The second element is the value set for <i>cal</i>. 2949 * The parameter number is indicated by an element's position in the array 2950 * returned by the method <code>getParams</code>, 2951 * with the first element being the value for the first placeholder parameter, the 2952 * second element being the value for the second placeholder parameter, and so on. 2953 * In other words, if the date being set is the value for the second 2954 * placeholder parameter, the array containing it will be the second element in 2955 * the array returned by <code>getParams</code>. 2956 * <P> 2957 * Note that because the numbering of elements in an array starts at zero, 2958 * the array element that corresponds to placeholder parameter number 2959 * <i>parameterIndex</i> is <i>parameterIndex</i> -1. 2960 * 2961 * @param parameterIndex the ordinal number of the placeholder parameter 2962 * in this <code>RowSet</code> object's command that is to be set. 2963 * The first parameter is 1, the second is 2, and so on; must be 2964 * <code>1</code> or greater 2965 * @param x a <code>java.sql.Date</code> object representing an SQL 2966 * <code>DATE</code> value 2967 * @param cal a <code>java.util.Calendar</code> object to use when 2968 * when constructing the date 2969 * @throws SQLException if an error occurs or the 2970 * parameter index is out of bounds 2971 * @see #getParams 2972 */ 2973 public void setDate(int parameterIndex, java.sql.Date x, Calendar cal) throws SQLException { 2974 Object date[]; 2975 checkParamIndex(parameterIndex); 2976 2977 date = new Object[2]; 2978 date[0] = x; 2979 date[1] = cal; 2980 if(params == null){ 2981 throw new SQLException("Set initParams() before setDate"); 2982 } 2983 params.put(Integer.valueOf(parameterIndex - 1), date); 2984 } 2985 2986 /** 2987 * Sets the designated parameter to the given <code>java.sql.Time</code> 2988 * object. The driver converts this 2989 * to an SQL <code>TIME</code> value when it sends it to the database. 2990 * <P> 2991 * When the DBMS does not store time zone information, the driver will use 2992 * the given <code>Calendar</code> object to construct the SQL <code>TIME</code> 2993 * value to send to the database. With a 2994 * <code>Calendar</code> object, the driver can calculate the date 2995 * taking into account a custom time zone. If no <code>Calendar</code> 2996 * object is specified, the driver uses the time zone of the Virtual Machine 2997 * that is running the application. 2998 * <P> 2999 * The parameter value set by this method is stored internally and 3000 * will be supplied as the appropriate parameter in this <code>RowSet</code> 3001 * object's command when the method <code>execute</code> is called. 3002 * Methods such as <code>execute</code> and <code>populate</code> must be 3003 * provided in any class that extends this class and implements one or 3004 * more of the standard JSR-114 <code>RowSet</code> interfaces. 3005 * <P> 3006 * NOTE: <code>JdbcRowSet</code> does not require the <code>populate</code> method 3007 * as it is undefined in this class. 3008 * <P> 3009 * Calls made to the method <code>getParams</code> after this version of 3010 * <code>setTime</code> 3011 * has been called will return an array containing the parameter values that 3012 * have been set. In that array, the element that represents the values 3013 * set with this method will itself be an array. The first element of that array 3014 * is the given <code>java.sql.Time</code> object. 3015 * The second element is the value set for <i>cal</i>. 3016 * The parameter number is indicated by an element's position in the array 3017 * returned by the method <code>getParams</code>, 3018 * with the first element being the value for the first placeholder parameter, the 3019 * second element being the value for the second placeholder parameter, and so on. 3020 * In other words, if the time being set is the value for the second 3021 * placeholder parameter, the array containing it will be the second element in 3022 * the array returned by <code>getParams</code>. 3023 * <P> 3024 * Note that because the numbering of elements in an array starts at zero, 3025 * the array element that corresponds to placeholder parameter number 3026 * <i>parameterIndex</i> is <i>parameterIndex</i> -1. 3027 * 3028 * @param parameterIndex the ordinal number of the placeholder parameter 3029 * in this <code>RowSet</code> object's command that is to be set. 3030 * The first parameter is 1, the second is 2, and so on; must be 3031 * <code>1</code> or greater 3032 * @param x a <code>java.sql.Time</code> object 3033 * @param cal the <code>java.util.Calendar</code> object the driver can use to 3034 * construct the time 3035 * @throws SQLException if an error occurs or the 3036 * parameter index is out of bounds 3037 * @see #getParams 3038 */ 3039 public void setTime(int parameterIndex, java.sql.Time x, Calendar cal) throws SQLException { 3040 Object time[]; 3041 checkParamIndex(parameterIndex); 3042 3043 time = new Object[2]; 3044 time[0] = x; 3045 time[1] = cal; 3046 if(params == null){ 3047 throw new SQLException("Set initParams() before setTime"); 3048 } 3049 params.put(Integer.valueOf(parameterIndex - 1), time); 3050 } 3051 3052 /** 3053 * Sets the designated parameter to the given 3054 * <code>java.sql.Timestamp</code> object. The driver converts this 3055 * to an SQL <code>TIMESTAMP</code> value when it sends it to the database. 3056 * <P> 3057 * When the DBMS does not store time zone information, the driver will use 3058 * the given <code>Calendar</code> object to construct the SQL <code>TIMESTAMP</code> 3059 * value to send to the database. With a 3060 * <code>Calendar</code> object, the driver can calculate the timestamp 3061 * taking into account a custom time zone. If no <code>Calendar</code> 3062 * object is specified, the driver uses the time zone of the Virtual Machine 3063 * that is running the application. 3064 * <P> 3065 * The parameter value set by this method is stored internally and 3066 * will be supplied as the appropriate parameter in this <code>RowSet</code> 3067 * object's command when the method <code>execute</code> is called. 3068 * Methods such as <code>execute</code> and <code>populate</code> must be 3069 * provided in any class that extends this class and implements one or 3070 * more of the standard JSR-114 <code>RowSet</code> interfaces. 3071 * <P> 3072 * NOTE: <code>JdbcRowSet</code> does not require the <code>populate</code> method 3073 * as it is undefined in this class. 3074 * <P> 3075 * Calls made to the method <code>getParams</code> after this version of 3076 * <code>setTimestamp</code> 3077 * has been called will return an array containing the parameter values that 3078 * have been set. In that array, the element that represents the values 3079 * set with this method will itself be an array. The first element of that array 3080 * is the given <code>java.sql.Timestamp</code> object. 3081 * The second element is the value set for <i>cal</i>. 3082 * The parameter number is indicated by an element's position in the array 3083 * returned by the method <code>getParams</code>, 3084 * with the first element being the value for the first placeholder parameter, the 3085 * second element being the value for the second placeholder parameter, and so on. 3086 * In other words, if the timestamp being set is the value for the second 3087 * placeholder parameter, the array containing it will be the second element in 3088 * the array returned by <code>getParams</code>. 3089 * <P> 3090 * Note that because the numbering of elements in an array starts at zero, 3091 * the array element that corresponds to placeholder parameter number 3092 * <i>parameterIndex</i> is <i>parameterIndex</i> -1. 3093 * 3094 * @param parameterIndex the ordinal number of the placeholder parameter 3095 * in this <code>RowSet</code> object's command that is to be set. 3096 * The first parameter is 1, the second is 2, and so on; must be 3097 * <code>1</code> or greater 3098 * @param x a <code>java.sql.Timestamp</code> object 3099 * @param cal the <code>java.util.Calendar</code> object the driver can use to 3100 * construct the timestamp 3101 * @throws SQLException if an error occurs or the 3102 * parameter index is out of bounds 3103 * @see #getParams 3104 */ 3105 public void setTimestamp(int parameterIndex, java.sql.Timestamp x, Calendar cal) throws SQLException { 3106 Object timestamp[]; 3107 checkParamIndex(parameterIndex); 3108 3109 timestamp = new Object[2]; 3110 timestamp[0] = x; 3111 timestamp[1] = cal; 3112 if(params == null){ 3113 throw new SQLException("Set initParams() before setTimestamp"); 3114 } 3115 params.put(Integer.valueOf(parameterIndex - 1), timestamp); 3116 } 3117 3118 /** 3119 * Clears all of the current parameter values in this <code>RowSet</code> 3120 * object's internal representation of the parameters to be set in 3121 * this <code>RowSet</code> object's command when it is executed. 3122 * <P> 3123 * In general, parameter values remain in force for repeated use in 3124 * this <code>RowSet</code> object's command. Setting a parameter value with the 3125 * setter methods automatically clears the value of the 3126 * designated parameter and replaces it with the new specified value. 3127 * <P> 3128 * This method is called internally by the <code>setCommand</code> 3129 * method to clear all of the parameters set for the previous command. 3130 * <P> 3131 * Furthermore, this method differs from the <code>initParams</code> 3132 * method in that it maintains the schema of the <code>RowSet</code> object. 3133 * 3134 * @throws SQLException if an error occurs clearing the parameters 3135 */ 3136 public void clearParameters() throws SQLException { 3137 params.clear(); 3138 } 3139 3140 /** 3141 * Retrieves an array containing the parameter values (both Objects and 3142 * primitives) that have been set for this 3143 * <code>RowSet</code> object's command and throws an <code>SQLException</code> object 3144 * if all parameters have not been set. Before the command is sent to the 3145 * DBMS to be executed, these parameters will be substituted 3146 * for placeholder parameters in the <code>PreparedStatement</code> object 3147 * that is the command for a <code>RowSet</code> implementation extending 3148 * the <code>BaseRowSet</code> class. 3149 * <P> 3150 * Each element in the array that is returned is an <code>Object</code> instance 3151 * that contains the values of the parameters supplied to a setter method. 3152 * The order of the elements is determined by the value supplied for 3153 * <i>parameterIndex</i>. If the setter method takes only the parameter index 3154 * and the value to be set (possibly null), the array element will contain the value to be set 3155 * (which will be expressed as an <code>Object</code>). If there are additional 3156 * parameters, the array element will itself be an array containing the value to be set 3157 * plus any additional parameter values supplied to the setter method. If the method 3158 * sets a stream, the array element includes the type of stream being supplied to the 3159 * method. These additional parameters are for the use of the driver or the DBMS and may or 3160 * may not be used. 3161 * <P> 3162 * NOTE: Stored parameter values of types <code>Array</code>, <code>Blob</code>, 3163 * <code>Clob</code> and <code>Ref</code> are returned as <code>SerialArray</code>, 3164 * <code>SerialBlob</code>, <code>SerialClob</code> and <code>SerialRef</code> 3165 * respectively. 3166 * 3167 * @return an array of <code>Object</code> instances that includes the 3168 * parameter values that may be set in this <code>RowSet</code> object's 3169 * command; an empty array if no parameters have been set 3170 * @throws SQLException if an error occurs retrieving the object array of 3171 * parameters of this <code>RowSet</code> object or if not all parameters have 3172 * been set 3173 */ 3174 public Object[] getParams() throws SQLException { 3175 if (params == null) { 3176 3177 initParams(); 3178 Object [] paramsArray = new Object[params.size()]; 3179 return paramsArray; 3180 3181 } else { 3182 // The parameters may be set in random order 3183 // but all must be set, check to verify all 3184 // have been set till the last parameter 3185 // else throw exception. 3186 3187 Object[] paramsArray = new Object[params.size()]; 3188 for (int i = 0; i < params.size(); i++) { 3189 paramsArray[i] = params.get(Integer.valueOf(i)); 3190 if (paramsArray[i] == null) { 3191 throw new SQLException("missing parameter: " + (i + 1)); 3192 } //end if 3193 } //end for 3194 return paramsArray; 3195 3196 } //end if 3197 3198 } //end getParams 3199 3200 3201 /** 3202 * Sets the designated parameter to SQL <code>NULL</code>. 3203 * 3204 * <P><B>Note:</B> You must specify the parameter's SQL type. 3205 * 3206 * @param parameterName the name of the parameter 3207 * @param sqlType the SQL type code defined in <code>java.sql.Types</code> 3208 * @exception SQLException if a database access error occurs or 3209 * this method is called on a closed <code>CallableStatement</code> 3210 * @exception SQLFeatureNotSupportedException if the JDBC driver does not support 3211 * this method 3212 */ 3213 public void setNull(String parameterName, int sqlType) throws SQLException { 3214 throw new SQLFeatureNotSupportedException("Feature not supported"); 3215 } 3216 3217 /** 3218 * Sets the designated parameter to SQL <code>NULL</code>. 3219 * This version of the method <code>setNull</code> should 3220 * be used for user-defined types and REF type parameters. Examples 3221 * of user-defined types include: STRUCT, DISTINCT, JAVA_OBJECT, and 3222 * named array types. 3223 * 3224 * <P><B>Note:</B> To be portable, applications must give the 3225 * SQL type code and the fully-qualified SQL type name when specifying 3226 * a NULL user-defined or REF parameter. In the case of a user-defined type 3227 * the name is the type name of the parameter itself. For a REF 3228 * parameter, the name is the type name of the referenced type. If 3229 * a JDBC driver does not need the type code or type name information, 3230 * it may ignore it. 3231 * 3232 * Although it is intended for user-defined and Ref parameters, 3233 * this method may be used to set a null parameter of any JDBC type. 3234 * If the parameter does not have a user-defined or REF type, the given 3235 * typeName is ignored. 3236 * 3237 * 3238 * @param parameterName the name of the parameter 3239 * @param sqlType a value from <code>java.sql.Types</code> 3240 * @param typeName the fully-qualified name of an SQL user-defined type; 3241 * ignored if the parameter is not a user-defined type or 3242 * SQL <code>REF</code> value 3243 * @exception SQLException if a database access error occurs or 3244 * this method is called on a closed <code>CallableStatement</code> 3245 * @exception SQLFeatureNotSupportedException if the JDBC driver does not support 3246 * this method 3247 */ 3248 public void setNull (String parameterName, int sqlType, String typeName) 3249 throws SQLException{ 3250 throw new SQLFeatureNotSupportedException("Feature not supported"); 3251 } 3252 3253 /** 3254 * Sets the designated parameter to the given Java <code>boolean</code> value. 3255 * The driver converts this 3256 * to an SQL <code>BIT</code> or <code>BOOLEAN</code> value when it sends it to the database. 3257 * 3258 * @param parameterName the name of the parameter 3259 * @param x the parameter value 3260 * @exception SQLException if a database access error occurs or 3261 * this method is called on a closed <code>CallableStatement</code> 3262 * @exception SQLFeatureNotSupportedException if the JDBC driver does not support 3263 * this method 3264 * @see #getParams 3265 */ 3266 public void setBoolean(String parameterName, boolean x) throws SQLException{ 3267 throw new SQLFeatureNotSupportedException("Feature not supported"); 3268 } 3269 3270 /** 3271 * Sets the designated parameter to the given Java <code>byte</code> value. 3272 * The driver converts this 3273 * to an SQL <code>TINYINT</code> value when it sends it to the database. 3274 * 3275 * @param parameterName the name of the parameter 3276 * @param x the parameter value 3277 * @exception SQLException if a database access error occurs or 3278 * this method is called on a closed <code>CallableStatement</code> 3279 * @exception SQLFeatureNotSupportedException if the JDBC driver does not support 3280 * this method 3281 * @see #getParams 3282 */ 3283 public void setByte(String parameterName, byte x) throws SQLException{ 3284 throw new SQLFeatureNotSupportedException("Feature not supported"); 3285 } 3286 3287 /** 3288 * Sets the designated parameter to the given Java <code>short</code> value. 3289 * The driver converts this 3290 * to an SQL <code>SMALLINT</code> value when it sends it to the database. 3291 * 3292 * @param parameterName the name of the parameter 3293 * @param x the parameter value 3294 * @exception SQLException if a database access error occurs or 3295 * this method is called on a closed <code>CallableStatement</code> 3296 * @exception SQLFeatureNotSupportedException if the JDBC driver does not support 3297 * this method 3298 * @see #getParams 3299 */ 3300 public void setShort(String parameterName, short x) throws SQLException{ 3301 throw new SQLFeatureNotSupportedException("Feature not supported"); 3302 } 3303 3304 /** 3305 * Sets the designated parameter to the given Java <code>int</code> value. 3306 * The driver converts this 3307 * to an SQL <code>INTEGER</code> value when it sends it to the database. 3308 * 3309 * @param parameterName the name of the parameter 3310 * @param x the parameter value 3311 * @exception SQLException if a database access error occurs or 3312 * this method is called on a closed <code>CallableStatement</code> 3313 * @exception SQLFeatureNotSupportedException if the JDBC driver does not support 3314 * this method 3315 * @see #getParams 3316 */ 3317 public void setInt(String parameterName, int x) throws SQLException{ 3318 throw new SQLFeatureNotSupportedException("Feature not supported"); 3319 } 3320 3321 3322 /** 3323 * Sets the designated parameter to the given Java <code>long</code> value. 3324 * The driver converts this 3325 * to an SQL <code>BIGINT</code> value when it sends it to the database. 3326 * 3327 * @param parameterName the name of the parameter 3328 * @param x the parameter value 3329 * @exception SQLException if a database access error occurs or 3330 * this method is called on a closed <code>CallableStatement</code> 3331 * @exception SQLFeatureNotSupportedException if the JDBC driver does not support 3332 * this method 3333 * @see #getParams 3334 */ 3335 public void setLong(String parameterName, long x) throws SQLException{ 3336 throw new SQLFeatureNotSupportedException("Feature not supported"); 3337 } 3338 3339 /** 3340 * Sets the designated parameter to the given Java <code>float</code> value. 3341 * The driver converts this 3342 * to an SQL <code>FLOAT</code> value when it sends it to the database. 3343 * 3344 * @param parameterName the name of the parameter 3345 * @param x the parameter value 3346 * @exception SQLException if a database access error occurs or 3347 * this method is called on a closed <code>CallableStatement</code> 3348 * @exception SQLFeatureNotSupportedException if the JDBC driver does not support 3349 * this method 3350 * @see #getParams 3351 */ 3352 public void setFloat(String parameterName, float x) throws SQLException{ 3353 throw new SQLFeatureNotSupportedException("Feature not supported"); 3354 } 3355 3356 /** 3357 * Sets the designated parameter to the given Java <code>double</code> value. 3358 * The driver converts this 3359 * to an SQL <code>DOUBLE</code> value when it sends it to the database. 3360 * 3361 * @param parameterName the name of the parameter 3362 * @param x the parameter value 3363 * @exception SQLException if a database access error occurs or 3364 * this method is called on a closed <code>CallableStatement</code> 3365 * @exception SQLFeatureNotSupportedException if the JDBC driver does not support 3366 * this method 3367 * @see #getParams 3368 */ 3369 public void setDouble(String parameterName, double x) throws SQLException{ 3370 throw new SQLFeatureNotSupportedException("Feature not supported"); 3371 } 3372 3373 /** 3374 * Sets the designated parameter to the given 3375 * <code>java.math.BigDecimal</code> value. 3376 * The driver converts this to an SQL <code>NUMERIC</code> value when 3377 * it sends it to the database. 3378 * 3379 * @param parameterName the name of the parameter 3380 * @param x the parameter value 3381 * @exception SQLException if a database access error occurs or 3382 * this method is called on a closed <code>CallableStatement</code> 3383 * @exception SQLFeatureNotSupportedException if the JDBC driver does not support 3384 * this method 3385 * @see #getParams 3386 */ 3387 public void setBigDecimal(String parameterName, BigDecimal x) throws SQLException{ 3388 throw new SQLFeatureNotSupportedException("Feature not supported"); 3389 } 3390 3391 /** 3392 * Sets the designated parameter to the given Java <code>String</code> value. 3393 * The driver converts this 3394 * to an SQL <code>VARCHAR</code> or <code>LONGVARCHAR</code> value 3395 * (depending on the argument's 3396 * size relative to the driver's limits on <code>VARCHAR</code> values) 3397 * when it sends it to the database. 3398 * 3399 * @param parameterName the name of the parameter 3400 * @param x the parameter value 3401 * @exception SQLException if a database access error occurs or 3402 * this method is called on a closed <code>CallableStatement</code> 3403 * @exception SQLFeatureNotSupportedException if the JDBC driver does not support 3404 * this method 3405 * @see #getParams 3406 */ 3407 public void setString(String parameterName, String x) throws SQLException{ 3408 throw new SQLFeatureNotSupportedException("Feature not supported"); 3409 } 3410 3411 /** 3412 * Sets the designated parameter to the given Java array of bytes. 3413 * The driver converts this to an SQL <code>VARBINARY</code> or 3414 * <code>LONGVARBINARY</code> (depending on the argument's size relative 3415 * to the driver's limits on <code>VARBINARY</code> values) when it sends 3416 * it to the database. 3417 * 3418 * @param parameterName the name of the parameter 3419 * @param x the parameter value 3420 * @exception SQLException if a database access error occurs or 3421 * this method is called on a closed <code>CallableStatement</code> 3422 * @exception SQLFeatureNotSupportedException if the JDBC driver does not support 3423 * this method 3424 * @see #getParams 3425 */ 3426 public void setBytes(String parameterName, byte x[]) throws SQLException{ 3427 throw new SQLFeatureNotSupportedException("Feature not supported"); 3428 } 3429 3430 /** 3431 * Sets the designated parameter to the given <code>java.sql.Timestamp</code> value. 3432 * The driver 3433 * converts this to an SQL <code>TIMESTAMP</code> value when it sends it to the 3434 * database. 3435 * 3436 * @param parameterName the name of the parameter 3437 * @param x the parameter value 3438 * @exception SQLException if a database access error occurs or 3439 * this method is called on a closed <code>CallableStatement</code> 3440 * @exception SQLFeatureNotSupportedException if the JDBC driver does not support 3441 * this method 3442 * @see #getParams 3443 */ 3444 public void setTimestamp(String parameterName, java.sql.Timestamp x) 3445 throws SQLException{ 3446 throw new SQLFeatureNotSupportedException("Feature not supported"); 3447 } 3448 3449 /** 3450 * Sets the designated parameter to the given input stream, which will have 3451 * the specified number of bytes. 3452 * When a very large ASCII value is input to a <code>LONGVARCHAR</code> 3453 * parameter, it may be more practical to send it via a 3454 * <code>java.io.InputStream</code>. Data will be read from the stream 3455 * as needed until end-of-file is reached. The JDBC driver will 3456 * do any necessary conversion from ASCII to the database char format. 3457 * 3458 * <P><B>Note:</B> This stream object can either be a standard 3459 * Java stream object or your own subclass that implements the 3460 * standard interface. 3461 * 3462 * @param parameterName the name of the parameter 3463 * @param x the Java input stream that contains the ASCII parameter value 3464 * @param length the number of bytes in the stream 3465 * @exception SQLException if a database access error occurs or 3466 * this method is called on a closed <code>CallableStatement</code> 3467 * @exception SQLFeatureNotSupportedException if the JDBC driver does not support 3468 * this method 3469 */ 3470 public void setAsciiStream(String parameterName, java.io.InputStream x, int length) 3471 throws SQLException{ 3472 throw new SQLFeatureNotSupportedException("Feature not supported"); 3473 } 3474 3475 /** 3476 * Sets the designated parameter to the given input stream, which will have 3477 * the specified number of bytes. 3478 * When a very large binary value is input to a <code>LONGVARBINARY</code> 3479 * parameter, it may be more practical to send it via a 3480 * <code>java.io.InputStream</code> object. The data will be read from the stream 3481 * as needed until end-of-file is reached. 3482 * 3483 * <P><B>Note:</B> This stream object can either be a standard 3484 * Java stream object or your own subclass that implements the 3485 * standard interface. 3486 * 3487 * @param parameterName the name of the parameter 3488 * @param x the java input stream which contains the binary parameter value 3489 * @param length the number of bytes in the stream 3490 * @exception SQLException if a database access error occurs or 3491 * this method is called on a closed <code>CallableStatement</code> 3492 * @exception SQLFeatureNotSupportedException if the JDBC driver does not support 3493 * this method 3494 */ 3495 public void setBinaryStream(String parameterName, java.io.InputStream x, 3496 int length) throws SQLException{ 3497 throw new SQLFeatureNotSupportedException("Feature not supported"); 3498 } 3499 3500 /** 3501 * Sets the designated parameter to the given <code>Reader</code> 3502 * object, which is the given number of characters long. 3503 * When a very large UNICODE value is input to a <code>LONGVARCHAR</code> 3504 * parameter, it may be more practical to send it via a 3505 * <code>java.io.Reader</code> object. The data will be read from the stream 3506 * as needed until end-of-file is reached. The JDBC driver will 3507 * do any necessary conversion from UNICODE to the database char format. 3508 * 3509 * <P><B>Note:</B> This stream object can either be a standard 3510 * Java stream object or your own subclass that implements the 3511 * standard interface. 3512 * 3513 * @param parameterName the name of the parameter 3514 * @param reader the <code>java.io.Reader</code> object that 3515 * contains the UNICODE data used as the designated parameter 3516 * @param length the number of characters in the stream 3517 * @exception SQLException if a database access error occurs or 3518 * this method is called on a closed <code>CallableStatement</code> 3519 * @exception SQLFeatureNotSupportedException if the JDBC driver does not support 3520 * this method 3521 */ 3522 public void setCharacterStream(String parameterName, 3523 java.io.Reader reader, 3524 int length) throws SQLException{ 3525 throw new SQLFeatureNotSupportedException("Feature not supported"); 3526 } 3527 3528 /** 3529 * Sets the designated parameter to the given input stream. 3530 * When a very large ASCII value is input to a <code>LONGVARCHAR</code> 3531 * parameter, it may be more practical to send it via a 3532 * <code>java.io.InputStream</code>. Data will be read from the stream 3533 * as needed until end-of-file is reached. The JDBC driver will 3534 * do any necessary conversion from ASCII to the database char format. 3535 * 3536 * <P><B>Note:</B> This stream object can either be a standard 3537 * Java stream object or your own subclass that implements the 3538 * standard interface. 3539 * <P><B>Note:</B> Consult your JDBC driver documentation to determine if 3540 * it might be more efficient to use a version of 3541 * <code>setAsciiStream</code> which takes a length parameter. 3542 * 3543 * @param parameterName the name of the parameter 3544 * @param x the Java input stream that contains the ASCII parameter value 3545 * @exception SQLException if a database access error occurs or 3546 * this method is called on a closed <code>CallableStatement</code> 3547 * @throws SQLFeatureNotSupportedException if the JDBC driver does not support this method 3548 * @since 1.6 3549 */ 3550 public void setAsciiStream(String parameterName, java.io.InputStream x) 3551 throws SQLException{ 3552 throw new SQLFeatureNotSupportedException("Feature not supported"); 3553 } 3554 3555 /** 3556 * Sets the designated parameter to the given input stream. 3557 * When a very large binary value is input to a <code>LONGVARBINARY</code> 3558 * parameter, it may be more practical to send it via a 3559 * <code>java.io.InputStream</code> object. The data will be read from the 3560 * stream as needed until end-of-file is reached. 3561 * 3562 * <P><B>Note:</B> This stream object can either be a standard 3563 * Java stream object or your own subclass that implements the 3564 * standard interface. 3565 * <P><B>Note:</B> Consult your JDBC driver documentation to determine if 3566 * it might be more efficient to use a version of 3567 * <code>setBinaryStream</code> which takes a length parameter. 3568 * 3569 * @param parameterName the name of the parameter 3570 * @param x the java input stream which contains the binary parameter value 3571 * @exception SQLException if a database access error occurs or 3572 * this method is called on a closed <code>CallableStatement</code> 3573 * @throws SQLFeatureNotSupportedException if the JDBC driver does not support this method 3574 * @since 1.6 3575 */ 3576 public void setBinaryStream(String parameterName, java.io.InputStream x) 3577 throws SQLException{ 3578 throw new SQLFeatureNotSupportedException("Feature not supported"); 3579 } 3580 3581 /** 3582 * Sets the designated parameter to the given <code>Reader</code> 3583 * object. 3584 * When a very large UNICODE value is input to a <code>LONGVARCHAR</code> 3585 * parameter, it may be more practical to send it via a 3586 * <code>java.io.Reader</code> object. The data will be read from the stream 3587 * as needed until end-of-file is reached. The JDBC driver will 3588 * do any necessary conversion from UNICODE to the database char format. 3589 * 3590 * <P><B>Note:</B> This stream object can either be a standard 3591 * Java stream object or your own subclass that implements the 3592 * standard interface. 3593 * <P><B>Note:</B> Consult your JDBC driver documentation to determine if 3594 * it might be more efficient to use a version of 3595 * <code>setCharacterStream</code> which takes a length parameter. 3596 * 3597 * @param parameterName the name of the parameter 3598 * @param reader the <code>java.io.Reader</code> object that contains the 3599 * Unicode data 3600 * @exception SQLException if a database access error occurs or 3601 * this method is called on a closed <code>CallableStatement</code> 3602 * @throws SQLFeatureNotSupportedException if the JDBC driver does not support this method 3603 * @since 1.6 3604 */ 3605 public void setCharacterStream(String parameterName, 3606 java.io.Reader reader) throws SQLException{ 3607 throw new SQLFeatureNotSupportedException("Feature not supported"); 3608 } 3609 3610 /** 3611 * Sets the designated parameter in this <code>RowSet</code> object's command 3612 * to a <code>Reader</code> object. The 3613 * <code>Reader</code> reads the data till end-of-file is reached. The 3614 * driver does the necessary conversion from Java character format to 3615 * the national character set in the database. 3616 * 3617 * <P><B>Note:</B> This stream object can either be a standard 3618 * Java stream object or your own subclass that implements the 3619 * standard interface. 3620 * <P><B>Note:</B> Consult your JDBC driver documentation to determine if 3621 * it might be more efficient to use a version of 3622 * <code>setNCharacterStream</code> which takes a length parameter. 3623 * 3624 * @param parameterIndex of the first parameter is 1, the second is 2, ... 3625 * @param value the parameter value 3626 * @throws SQLException if the driver does not support national 3627 * character sets; if the driver can detect that a data conversion 3628 * error could occur ; if a database access error occurs; or 3629 * this method is called on a closed <code>PreparedStatement</code> 3630 * @throws SQLFeatureNotSupportedException if the JDBC driver does not support this method 3631 * @since 1.6 3632 */ 3633 public void setNCharacterStream(int parameterIndex, Reader value) throws SQLException{ 3634 throw new SQLFeatureNotSupportedException("Feature not supported"); 3635 } 3636 3637 /** 3638 * Sets the value of the designated parameter with the given object. The second 3639 * argument must be an object type; for integral values, the 3640 * <code>java.lang</code> equivalent objects should be used. 3641 * 3642 * <p>The given Java object will be converted to the given targetSqlType 3643 * before being sent to the database. 3644 * 3645 * If the object has a custom mapping (is of a class implementing the 3646 * interface <code>SQLData</code>), 3647 * the JDBC driver should call the method <code>SQLData.writeSQL</code> to write it 3648 * to the SQL data stream. 3649 * If, on the other hand, the object is of a class implementing 3650 * <code>Ref</code>, <code>Blob</code>, <code>Clob</code>, <code>NClob</code>, 3651 * <code>Struct</code>, <code>java.net.URL</code>, 3652 * or <code>Array</code>, the driver should pass it to the database as a 3653 * value of the corresponding SQL type. 3654 * <P> 3655 * Note that this method may be used to pass database- 3656 * specific abstract data types. 3657 * 3658 * @param parameterName the name of the parameter 3659 * @param x the object containing the input parameter value 3660 * @param targetSqlType the SQL type (as defined in java.sql.Types) to be 3661 * sent to the database. The scale argument may further qualify this type. 3662 * @param scale for java.sql.Types.DECIMAL or java.sql.Types.NUMERIC types, 3663 * this is the number of digits after the decimal point. For all other 3664 * types, this value will be ignored. 3665 * @exception SQLException if a database access error occurs or 3666 * this method is called on a closed <code>CallableStatement</code> 3667 * @exception SQLFeatureNotSupportedException if <code>targetSqlType</code> is 3668 * a <code>ARRAY</code>, <code>BLOB</code>, <code>CLOB</code>, 3669 * <code>DATALINK</code>, <code>JAVA_OBJECT</code>, <code>NCHAR</code>, 3670 * <code>NCLOB</code>, <code>NVARCHAR</code>, <code>LONGNVARCHAR</code>, 3671 * <code>REF</code>, <code>ROWID</code>, <code>SQLXML</code> 3672 * or <code>STRUCT</code> data type and the JDBC driver does not support 3673 * this data type 3674 * @see Types 3675 * @see #getParams 3676 */ 3677 public void setObject(String parameterName, Object x, int targetSqlType, int scale) 3678 throws SQLException{ 3679 throw new SQLFeatureNotSupportedException("Feature not supported"); 3680 } 3681 3682 /** 3683 * Sets the value of the designated parameter with the given object. 3684 * This method is like the method <code>setObject</code> 3685 * above, except that it assumes a scale of zero. 3686 * 3687 * @param parameterName the name of the parameter 3688 * @param x the object containing the input parameter value 3689 * @param targetSqlType the SQL type (as defined in java.sql.Types) to be 3690 * sent to the database 3691 * @exception SQLException if a database access error occurs or 3692 * this method is called on a closed <code>CallableStatement</code> 3693 * @exception SQLFeatureNotSupportedException if <code>targetSqlType</code> is 3694 * a <code>ARRAY</code>, <code>BLOB</code>, <code>CLOB</code>, 3695 * <code>DATALINK</code>, <code>JAVA_OBJECT</code>, <code>NCHAR</code>, 3696 * <code>NCLOB</code>, <code>NVARCHAR</code>, <code>LONGNVARCHAR</code>, 3697 * <code>REF</code>, <code>ROWID</code>, <code>SQLXML</code> 3698 * or <code>STRUCT</code> data type and the JDBC driver does not support 3699 * this data type 3700 * @see #getParams 3701 */ 3702 public void setObject(String parameterName, Object x, int targetSqlType) 3703 throws SQLException{ 3704 throw new SQLFeatureNotSupportedException("Feature not supported"); 3705 } 3706 3707 /** 3708 * Sets the value of the designated parameter with the given object. 3709 * The second parameter must be of type <code>Object</code>; therefore, the 3710 * <code>java.lang</code> equivalent objects should be used for built-in types. 3711 * 3712 * <p>The JDBC specification specifies a standard mapping from 3713 * Java <code>Object</code> types to SQL types. The given argument 3714 * will be converted to the corresponding SQL type before being 3715 * sent to the database. 3716 * 3717 * <p>Note that this method may be used to pass database- 3718 * specific abstract data types, by using a driver-specific Java 3719 * type. 3720 * 3721 * If the object is of a class implementing the interface <code>SQLData</code>, 3722 * the JDBC driver should call the method <code>SQLData.writeSQL</code> 3723 * to write it to the SQL data stream. 3724 * If, on the other hand, the object is of a class implementing 3725 * <code>Ref</code>, <code>Blob</code>, <code>Clob</code>, <code>NClob</code>, 3726 * <code>Struct</code>, <code>java.net.URL</code>, 3727 * or <code>Array</code>, the driver should pass it to the database as a 3728 * value of the corresponding SQL type. 3729 * <P> 3730 * This method throws an exception if there is an ambiguity, for example, if the 3731 * object is of a class implementing more than one of the interfaces named above. 3732 * 3733 * @param parameterName the name of the parameter 3734 * @param x the object containing the input parameter value 3735 * @exception SQLException if a database access error occurs, 3736 * this method is called on a closed <code>CallableStatement</code> or if the given 3737 * <code>Object</code> parameter is ambiguous 3738 * @exception SQLFeatureNotSupportedException if the JDBC driver does not support 3739 * this method 3740 * @see #getParams 3741 */ 3742 public void setObject(String parameterName, Object x) throws SQLException{ 3743 throw new SQLFeatureNotSupportedException("Feature not supported"); 3744 } 3745 3746 /** 3747 * Sets the designated parameter to a <code>InputStream</code> object. 3748 * The <code>InputStream</code> must contain the number 3749 * of characters specified by length otherwise a <code>SQLException</code> will be 3750 * generated when the <code>PreparedStatement</code> is executed. 3751 * This method differs from the <code>setBinaryStream (int, InputStream, int)</code> 3752 * method because it informs the driver that the parameter value should be 3753 * sent to the server as a <code>BLOB</code>. When the <code>setBinaryStream</code> method is used, 3754 * the driver may have to do extra work to determine whether the parameter 3755 * data should be sent to the server as a <code>LONGVARBINARY</code> or a <code>BLOB</code> 3756 * @param parameterIndex index of the first parameter is 1, 3757 * the second is 2, ... 3758 * @param inputStream An object that contains the data to set the parameter 3759 * value to. 3760 * @param length the number of bytes in the parameter data. 3761 * @throws SQLException if a database access error occurs, 3762 * this method is called on a closed <code>PreparedStatement</code>, 3763 * if parameterIndex does not correspond 3764 * to a parameter marker in the SQL statement, if the length specified 3765 * is less than zero or if the number of bytes in the 3766 * <code>InputStream</code> does not match the specified length. 3767 * @throws SQLFeatureNotSupportedException if the JDBC driver does not support this method 3768 * 3769 * @since 1.6 3770 */ 3771 public void setBlob(int parameterIndex, InputStream inputStream, long length) 3772 throws SQLException{ 3773 throw new SQLFeatureNotSupportedException("Feature not supported"); 3774 } 3775 3776 /** 3777 * Sets the designated parameter to a <code>InputStream</code> object. 3778 * This method differs from the <code>setBinaryStream (int, InputStream)</code> 3779 * method because it informs the driver that the parameter value should be 3780 * sent to the server as a <code>BLOB</code>. When the <code>setBinaryStream</code> method is used, 3781 * the driver may have to do extra work to determine whether the parameter 3782 * data should be sent to the server as a <code>LONGVARBINARY</code> or a <code>BLOB</code> 3783 * 3784 * <P><B>Note:</B> Consult your JDBC driver documentation to determine if 3785 * it might be more efficient to use a version of 3786 * <code>setBlob</code> which takes a length parameter. 3787 * 3788 * @param parameterIndex index of the first parameter is 1, 3789 * the second is 2, ... 3790 * @param inputStream An object that contains the data to set the parameter 3791 * value to. 3792 * @throws SQLException if a database access error occurs, 3793 * this method is called on a closed <code>PreparedStatement</code> or 3794 * if parameterIndex does not correspond 3795 * to a parameter marker in the SQL statement, 3796 * @throws SQLFeatureNotSupportedException if the JDBC driver does not support this method 3797 * 3798 * @since 1.6 3799 */ 3800 public void setBlob(int parameterIndex, InputStream inputStream) 3801 throws SQLException{ 3802 throw new SQLFeatureNotSupportedException("Feature not supported"); 3803 } 3804 3805 /** 3806 * Sets the designated parameter to a <code>InputStream</code> object. 3807 * The <code>Inputstream</code> must contain the number 3808 * of characters specified by length, otherwise a <code>SQLException</code> will be 3809 * generated when the <code>CallableStatement</code> is executed. 3810 * This method differs from the <code>setBinaryStream (int, InputStream, int)</code> 3811 * method because it informs the driver that the parameter value should be 3812 * sent to the server as a <code>BLOB</code>. When the <code>setBinaryStream</code> method is used, 3813 * the driver may have to do extra work to determine whether the parameter 3814 * data should be sent to the server as a <code>LONGVARBINARY</code> or a <code>BLOB</code> 3815 * 3816 * @param parameterName the name of the parameter to be set 3817 * the second is 2, ... 3818 * 3819 * @param inputStream An object that contains the data to set the parameter 3820 * value to. 3821 * @param length the number of bytes in the parameter data. 3822 * @throws SQLException if parameterIndex does not correspond 3823 * to a parameter marker in the SQL statement, or if the length specified 3824 * is less than zero; if the number of bytes in the <code>InputStream</code> does not match 3825 * the specified length; if a database access error occurs or 3826 * this method is called on a closed <code>CallableStatement</code> 3827 * @exception SQLFeatureNotSupportedException if the JDBC driver does not support 3828 * this method 3829 * 3830 * @since 1.6 3831 */ 3832 public void setBlob(String parameterName, InputStream inputStream, long length) 3833 throws SQLException{ 3834 throw new SQLFeatureNotSupportedException("Feature not supported"); 3835 } 3836 3837 /** 3838 * Sets the designated parameter to the given <code>java.sql.Blob</code> object. 3839 * The driver converts this to an SQL <code>BLOB</code> value when it 3840 * sends it to the database. 3841 * 3842 * @param parameterName the name of the parameter 3843 * @param x a <code>Blob</code> object that maps an SQL <code>BLOB</code> value 3844 * @exception SQLException if a database access error occurs or 3845 * this method is called on a closed <code>CallableStatement</code> 3846 * @exception SQLFeatureNotSupportedException if the JDBC driver does not support 3847 * this method 3848 * @since 1.6 3849 */ 3850 public void setBlob (String parameterName, Blob x) throws SQLException{ 3851 throw new SQLFeatureNotSupportedException("Feature not supported"); 3852 } 3853 3854 /** 3855 * Sets the designated parameter to a <code>InputStream</code> object. 3856 * This method differs from the <code>setBinaryStream (int, InputStream)</code> 3857 * method because it informs the driver that the parameter value should be 3858 * sent to the server as a <code>BLOB</code>. When the <code>setBinaryStream</code> method is used, 3859 * the driver may have to do extra work to determine whether the parameter 3860 * data should be send to the server as a <code>LONGVARBINARY</code> or a <code>BLOB</code> 3861 * 3862 * <P><B>Note:</B> Consult your JDBC driver documentation to determine if 3863 * it might be more efficient to use a version of 3864 * <code>setBlob</code> which takes a length parameter. 3865 * 3866 * @param parameterName the name of the parameter 3867 * @param inputStream An object that contains the data to set the parameter 3868 * value to. 3869 * @throws SQLException if a database access error occurs or 3870 * this method is called on a closed <code>CallableStatement</code> 3871 * @throws SQLFeatureNotSupportedException if the JDBC driver does not support this method 3872 * 3873 * @since 1.6 3874 */ 3875 public void setBlob(String parameterName, InputStream inputStream) 3876 throws SQLException{ 3877 throw new SQLFeatureNotSupportedException("Feature not supported"); 3878 } 3879 3880 /** 3881 * Sets the designated parameter to a <code>Reader</code> object. 3882 * The reader must contain the number 3883 * of characters specified by length otherwise a <code>SQLException</code> will be 3884 * generated when the <code>PreparedStatement</code> is executed. 3885 * This method differs from the <code>setCharacterStream (int, Reader, int)</code> method 3886 * because it informs the driver that the parameter value should be sent to 3887 * the server as a <code>CLOB</code>. When the <code>setCharacterStream</code> method is used, the 3888 * driver may have to do extra work to determine whether the parameter 3889 * data should be sent to the server as a <code>LONGVARCHAR</code> or a <code>CLOB</code> 3890 * @param parameterIndex index of the first parameter is 1, the second is 2, ... 3891 * @param reader An object that contains the data to set the parameter value to. 3892 * @param length the number of characters in the parameter data. 3893 * @throws SQLException if a database access error occurs, this method is called on 3894 * a closed <code>PreparedStatement</code>, if parameterIndex does not correspond to a parameter 3895 * marker in the SQL statement, or if the length specified is less than zero. 3896 * 3897 * @throws SQLFeatureNotSupportedException if the JDBC driver does not support this method 3898 * @since 1.6 3899 */ 3900 public void setClob(int parameterIndex, Reader reader, long length) 3901 throws SQLException{ 3902 throw new SQLFeatureNotSupportedException("Feature not supported"); 3903 } 3904 3905 /** 3906 * Sets the designated parameter to a <code>Reader</code> object. 3907 * This method differs from the <code>setCharacterStream (int, Reader)</code> method 3908 * because it informs the driver that the parameter value should be sent to 3909 * the server as a <code>CLOB</code>. When the <code>setCharacterStream</code> method is used, the 3910 * driver may have to do extra work to determine whether the parameter 3911 * data should be sent to the server as a <code>LONGVARCHAR</code> or a <code>CLOB</code> 3912 * 3913 * <P><B>Note:</B> Consult your JDBC driver documentation to determine if 3914 * it might be more efficient to use a version of 3915 * <code>setClob</code> which takes a length parameter. 3916 * 3917 * @param parameterIndex index of the first parameter is 1, the second is 2, ... 3918 * @param reader An object that contains the data to set the parameter value to. 3919 * @throws SQLException if a database access error occurs, this method is called on 3920 * a closed <code>PreparedStatement</code>or if parameterIndex does not correspond to a parameter 3921 * marker in the SQL statement 3922 * 3923 * @throws SQLFeatureNotSupportedException if the JDBC driver does not support this method 3924 * @since 1.6 3925 */ 3926 public void setClob(int parameterIndex, Reader reader) 3927 throws SQLException{ 3928 throw new SQLFeatureNotSupportedException("Feature not supported"); 3929 } 3930 3931 /** 3932 * Sets the designated parameter to a <code>Reader</code> object. 3933 * The <code>reader</code> must contain the number 3934 * of characters specified by length otherwise a <code>SQLException</code> will be 3935 * generated when the <code>CallableStatement</code> is executed. 3936 * This method differs from the <code>setCharacterStream (int, Reader, int)</code> method 3937 * because it informs the driver that the parameter value should be sent to 3938 * the server as a <code>CLOB</code>. When the <code>setCharacterStream</code> method is used, the 3939 * driver may have to do extra work to determine whether the parameter 3940 * data should be send to the server as a <code>LONGVARCHAR</code> or a <code>CLOB</code> 3941 * @param parameterName the name of the parameter to be set 3942 * @param reader An object that contains the data to set the parameter value to. 3943 * @param length the number of characters in the parameter data. 3944 * @throws SQLException if parameterIndex does not correspond to a parameter 3945 * marker in the SQL statement; if the length specified is less than zero; 3946 * a database access error occurs or 3947 * this method is called on a closed <code>CallableStatement</code> 3948 * @exception SQLFeatureNotSupportedException if the JDBC driver does not support 3949 * this method 3950 * 3951 * @since 1.6 3952 */ 3953 public void setClob(String parameterName, Reader reader, long length) 3954 throws SQLException { 3955 throw new SQLFeatureNotSupportedException("Feature not supported"); 3956 } 3957 3958 /** 3959 * Sets the designated parameter to the given <code>java.sql.Clob</code> object. 3960 * The driver converts this to an SQL <code>CLOB</code> value when it 3961 * sends it to the database. 3962 * 3963 * @param parameterName the name of the parameter 3964 * @param x a <code>Clob</code> object that maps an SQL <code>CLOB</code> value 3965 * @exception SQLException if a database access error occurs or 3966 * this method is called on a closed <code>CallableStatement</code> 3967 * @exception SQLFeatureNotSupportedException if the JDBC driver does not support 3968 * this method 3969 * @since 1.6 3970 */ 3971 public void setClob (String parameterName, Clob x) throws SQLException { 3972 throw new SQLFeatureNotSupportedException("Feature not supported"); 3973 } 3974 3975 /** 3976 * Sets the designated parameter to a <code>Reader</code> object. 3977 * This method differs from the <code>setCharacterStream (int, Reader)</code> method 3978 * because it informs the driver that the parameter value should be sent to 3979 * the server as a <code>CLOB</code>. When the <code>setCharacterStream</code> method is used, the 3980 * driver may have to do extra work to determine whether the parameter 3981 * data should be send to the server as a <code>LONGVARCHAR</code> or a <code>CLOB</code> 3982 * 3983 * <P><B>Note:</B> Consult your JDBC driver documentation to determine if 3984 * it might be more efficient to use a version of 3985 * <code>setClob</code> which takes a length parameter. 3986 * 3987 * @param parameterName the name of the parameter 3988 * @param reader An object that contains the data to set the parameter value to. 3989 * @throws SQLException if a database access error occurs or this method is called on 3990 * a closed <code>CallableStatement</code> 3991 * 3992 * @throws SQLFeatureNotSupportedException if the JDBC driver does not support this method 3993 * @since 1.6 3994 */ 3995 public void setClob(String parameterName, Reader reader) throws SQLException { 3996 throw new SQLFeatureNotSupportedException("Feature not supported"); 3997 } 3998 3999 /** 4000 * Sets the designated parameter to the given <code>java.sql.Date</code> value 4001 * using the default time zone of the virtual machine that is running 4002 * the application. 4003 * The driver converts this 4004 * to an SQL <code>DATE</code> value when it sends it to the database. 4005 * 4006 * @param parameterName the name of the parameter 4007 * @param x the parameter value 4008 * @exception SQLException if a database access error occurs or 4009 * this method is called on a closed <code>CallableStatement</code> 4010 * @exception SQLFeatureNotSupportedException if the JDBC driver does not support 4011 * this method 4012 * @see #getParams 4013 */ 4014 public void setDate(String parameterName, java.sql.Date x) 4015 throws SQLException { 4016 throw new SQLFeatureNotSupportedException("Feature not supported"); 4017 } 4018 4019 /** 4020 * Sets the designated parameter to the given <code>java.sql.Date</code> value, 4021 * using the given <code>Calendar</code> object. The driver uses 4022 * the <code>Calendar</code> object to construct an SQL <code>DATE</code> value, 4023 * which the driver then sends to the database. With a 4024 * a <code>Calendar</code> object, the driver can calculate the date 4025 * taking into account a custom timezone. If no 4026 * <code>Calendar</code> object is specified, the driver uses the default 4027 * timezone, which is that of the virtual machine running the application. 4028 * 4029 * @param parameterName the name of the parameter 4030 * @param x the parameter value 4031 * @param cal the <code>Calendar</code> object the driver will use 4032 * to construct the date 4033 * @exception SQLException if a database access error occurs or 4034 * this method is called on a closed <code>CallableStatement</code> 4035 * @exception SQLFeatureNotSupportedException if the JDBC driver does not support 4036 * this method 4037 * @see #getParams 4038 */ 4039 public void setDate(String parameterName, java.sql.Date x, Calendar cal) 4040 throws SQLException { 4041 throw new SQLFeatureNotSupportedException("Feature not supported"); 4042 } 4043 4044 /** 4045 * Sets the designated parameter to the given <code>java.sql.Time</code> value. 4046 * The driver converts this 4047 * to an SQL <code>TIME</code> value when it sends it to the database. 4048 * 4049 * @param parameterName the name of the parameter 4050 * @param x the parameter value 4051 * @exception SQLException if a database access error occurs or 4052 * this method is called on a closed <code>CallableStatement</code> 4053 * @exception SQLFeatureNotSupportedException if the JDBC driver does not support 4054 * this method 4055 * @see #getParams 4056 */ 4057 public void setTime(String parameterName, java.sql.Time x) 4058 throws SQLException { 4059 throw new SQLFeatureNotSupportedException("Feature not supported"); 4060 } 4061 4062 /** 4063 * Sets the designated parameter to the given <code>java.sql.Time</code> value, 4064 * using the given <code>Calendar</code> object. The driver uses 4065 * the <code>Calendar</code> object to construct an SQL <code>TIME</code> value, 4066 * which the driver then sends to the database. With a 4067 * a <code>Calendar</code> object, the driver can calculate the time 4068 * taking into account a custom timezone. If no 4069 * <code>Calendar</code> object is specified, the driver uses the default 4070 * timezone, which is that of the virtual machine running the application. 4071 * 4072 * @param parameterName the name of the parameter 4073 * @param x the parameter value 4074 * @param cal the <code>Calendar</code> object the driver will use 4075 * to construct the time 4076 * @exception SQLException if a database access error occurs or 4077 * this method is called on a closed <code>CallableStatement</code> 4078 * @exception SQLFeatureNotSupportedException if the JDBC driver does not support 4079 * this method 4080 * @see #getParams 4081 */ 4082 public void setTime(String parameterName, java.sql.Time x, Calendar cal) 4083 throws SQLException { 4084 throw new SQLFeatureNotSupportedException("Feature not supported"); 4085 } 4086 4087 /** 4088 * Sets the designated parameter to the given <code>java.sql.Timestamp</code> value, 4089 * using the given <code>Calendar</code> object. The driver uses 4090 * the <code>Calendar</code> object to construct an SQL <code>TIMESTAMP</code> value, 4091 * which the driver then sends to the database. With a 4092 * a <code>Calendar</code> object, the driver can calculate the timestamp 4093 * taking into account a custom timezone. If no 4094 * <code>Calendar</code> object is specified, the driver uses the default 4095 * timezone, which is that of the virtual machine running the application. 4096 * 4097 * @param parameterName the name of the parameter 4098 * @param x the parameter value 4099 * @param cal the <code>Calendar</code> object the driver will use 4100 * to construct the timestamp 4101 * @exception SQLException if a database access error occurs or 4102 * this method is called on a closed <code>CallableStatement</code> 4103 * @exception SQLFeatureNotSupportedException if the JDBC driver does not support 4104 * this method 4105 * @see #getParams 4106 */ 4107 public void setTimestamp(String parameterName, java.sql.Timestamp x, Calendar cal) 4108 throws SQLException { 4109 throw new SQLFeatureNotSupportedException("Feature not supported"); 4110 } 4111 4112 /** 4113 * Sets the designated parameter to the given <code>java.sql.SQLXML</code> object. The driver converts this to an 4114 * SQL <code>XML</code> value when it sends it to the database. 4115 * @param parameterIndex index of the first parameter is 1, the second is 2, ... 4116 * @param xmlObject a <code>SQLXML</code> object that maps an SQL <code>XML</code> value 4117 * @throws SQLException if a database access error occurs, this method 4118 * is called on a closed result set, 4119 * the <code>java.xml.transform.Result</code>, 4120 * <code>Writer</code> or <code>OutputStream</code> has not been closed 4121 * for the <code>SQLXML</code> object or 4122 * if there is an error processing the XML value. The <code>getCause</code> method 4123 * of the exception may provide a more detailed exception, for example, if the 4124 * stream does not contain valid XML. 4125 * @throws SQLFeatureNotSupportedException if the JDBC driver does not 4126 * support this method 4127 * @since 1.6 4128 */ 4129 public void setSQLXML(int parameterIndex, SQLXML xmlObject) throws SQLException { 4130 throw new SQLFeatureNotSupportedException("Feature not supported"); 4131 } 4132 4133 /** 4134 * Sets the designated parameter to the given <code>java.sql.SQLXML</code> object. The driver converts this to an 4135 * <code>SQL XML</code> value when it sends it to the database. 4136 * @param parameterName the name of the parameter 4137 * @param xmlObject a <code>SQLXML</code> object that maps an <code>SQL XML</code> value 4138 * @throws SQLException if a database access error occurs, this method 4139 * is called on a closed result set, 4140 * the <code>java.xml.transform.Result</code>, 4141 * <code>Writer</code> or <code>OutputStream</code> has not been closed 4142 * for the <code>SQLXML</code> object or 4143 * if there is an error processing the XML value. The <code>getCause</code> method 4144 * of the exception may provide a more detailed exception, for example, if the 4145 * stream does not contain valid XML. 4146 * @throws SQLFeatureNotSupportedException if the JDBC driver does not 4147 * support this method 4148 * @since 1.6 4149 */ 4150 public void setSQLXML(String parameterName, SQLXML xmlObject) throws SQLException { 4151 throw new SQLFeatureNotSupportedException("Feature not supported"); 4152 } 4153 4154 /** 4155 * Sets the designated parameter to the given <code>java.sql.RowId</code> object. The 4156 * driver converts this to a SQL <code>ROWID</code> value when it sends it 4157 * to the database 4158 * 4159 * @param parameterIndex the first parameter is 1, the second is 2, ... 4160 * @param x the parameter value 4161 * @throws SQLException if a database access error occurs 4162 * @throws SQLFeatureNotSupportedException if the JDBC driver does not 4163 * support this method 4164 * 4165 * @since 1.6 4166 */ 4167 public void setRowId(int parameterIndex, RowId x) throws SQLException { 4168 throw new SQLFeatureNotSupportedException("Feature not supported"); 4169 } 4170 4171 /** 4172 * Sets the designated parameter to the given <code>java.sql.RowId</code> object. The 4173 * driver converts this to a SQL <code>ROWID</code> when it sends it to the 4174 * database. 4175 * 4176 * @param parameterName the name of the parameter 4177 * @param x the parameter value 4178 * @throws SQLException if a database access error occurs 4179 * @throws SQLFeatureNotSupportedException if the JDBC driver does not 4180 * support this method 4181 * @since 1.6 4182 */ 4183 public void setRowId(String parameterName, RowId x) throws SQLException { 4184 throw new SQLFeatureNotSupportedException("Feature not supported"); 4185 } 4186 4187 /** 4188 * Sets the designated parameter to the given <code>String</code> object. 4189 * The driver converts this to a SQL <code>NCHAR</code> or 4190 * <code>NVARCHAR</code> or <code>LONGNVARCHAR</code> value 4191 * (depending on the argument's 4192 * size relative to the driver's limits on <code>NVARCHAR</code> values) 4193 * when it sends it to the database. 4194 * 4195 * @param parameterIndex of the first parameter is 1, the second is 2, ... 4196 * @param value the parameter value 4197 * @throws SQLException if the driver does not support national 4198 * character sets; if the driver can detect that a data conversion 4199 * error could occur ; or if a database access error occurs 4200 * @throws SQLFeatureNotSupportedException if the JDBC driver does not 4201 * support this method 4202 * @since 1.6 4203 */ 4204 public void setNString(int parameterIndex, String value) throws SQLException { 4205 throw new SQLFeatureNotSupportedException("Feature not supported"); 4206 } 4207 4208 /** 4209 * Sets the designated parameter to the given <code>String</code> object. 4210 * The driver converts this to a SQL <code>NCHAR</code> or 4211 * <code>NVARCHAR</code> or <code>LONGNVARCHAR</code> 4212 * @param parameterName the name of the column to be set 4213 * @param value the parameter value 4214 * @throws SQLException if the driver does not support national 4215 * character sets; if the driver can detect that a data conversion 4216 * error could occur; or if a database access error occurs 4217 * @throws SQLFeatureNotSupportedException if the JDBC driver does not 4218 * support this method 4219 * @since 1.6 4220 */ 4221 public void setNString(String parameterName, String value) throws SQLException { 4222 throw new SQLFeatureNotSupportedException("Feature not supported"); 4223 } 4224 4225 /** 4226 * Sets the designated parameter to a <code>Reader</code> object. The 4227 * <code>Reader</code> reads the data till end-of-file is reached. The 4228 * driver does the necessary conversion from Java character format to 4229 * the national character set in the database. 4230 * @param parameterIndex of the first parameter is 1, the second is 2, ... 4231 * @param value the parameter value 4232 * @param length the number of characters in the parameter data. 4233 * @throws SQLException if the driver does not support national 4234 * character sets; if the driver can detect that a data conversion 4235 * error could occur ; or if a database access error occurs 4236 * @throws SQLFeatureNotSupportedException if the JDBC driver does not 4237 * support this method 4238 * @since 1.6 4239 */ 4240 public void setNCharacterStream(int parameterIndex, Reader value, long length) 4241 throws SQLException { 4242 throw new SQLFeatureNotSupportedException("Feature not supported"); 4243 } 4244 4245 /** 4246 * Sets the designated parameter to a <code>Reader</code> object. The 4247 * <code>Reader</code> reads the data till end-of-file is reached. The 4248 * driver does the necessary conversion from Java character format to 4249 * the national character set in the database. 4250 * @param parameterName the name of the column to be set 4251 * @param value the parameter value 4252 * @param length the number of characters in the parameter data. 4253 * @throws SQLException if the driver does not support national 4254 * character sets; if the driver can detect that a data conversion 4255 * error could occur; or if a database access error occurs 4256 * @throws SQLFeatureNotSupportedException if the JDBC driver does not 4257 * support this method 4258 * @since 1.6 4259 */ 4260 public void setNCharacterStream(String parameterName, Reader value, long length) 4261 throws SQLException { 4262 throw new SQLFeatureNotSupportedException("Feature not supported"); 4263 } 4264 4265 /** 4266 * Sets the designated parameter to a <code>Reader</code> object. The 4267 * <code>Reader</code> reads the data till end-of-file is reached. The 4268 * driver does the necessary conversion from Java character format to 4269 * the national character set in the database. 4270 * <P><B>Note:</B> This stream object can either be a standard 4271 * Java stream object or your own subclass that implements the 4272 * standard interface. 4273 * <P><B>Note:</B> Consult your JDBC driver documentation to determine if 4274 * it might be more efficient to use a version of 4275 * <code>setNCharacterStream</code> which takes a length parameter. 4276 * 4277 * @param parameterName the name of the parameter 4278 * @param value the parameter value 4279 * @throws SQLException if the driver does not support national 4280 * character sets; if the driver can detect that a data conversion 4281 * error could occur ; if a database access error occurs; or 4282 * this method is called on a closed <code>CallableStatement</code> 4283 * @throws SQLFeatureNotSupportedException if the JDBC driver does not support this method 4284 * @since 1.6 4285 */ 4286 public void setNCharacterStream(String parameterName, Reader value) 4287 throws SQLException { 4288 throw new SQLFeatureNotSupportedException("Feature not supported"); 4289 } 4290 4291 /** 4292 * Sets the designated parameter to a <code>java.sql.NClob</code> object. The object 4293 * implements the <code>java.sql.NClob</code> interface. This <code>NClob</code> 4294 * object maps to a SQL <code>NCLOB</code>. 4295 * @param parameterName the name of the column to be set 4296 * @param value the parameter value 4297 * @throws SQLException if the driver does not support national 4298 * character sets; if the driver can detect that a data conversion 4299 * error could occur; or if a database access error occurs 4300 * @throws SQLFeatureNotSupportedException if the JDBC driver does not 4301 * support this method 4302 * @since 1.6 4303 */ 4304 public void setNClob(String parameterName, NClob value) throws SQLException { 4305 throw new SQLFeatureNotSupportedException("Feature not supported"); 4306 } 4307 4308 /** 4309 * Sets the designated parameter to a <code>Reader</code> object. The <code>reader</code> must contain 4310 * the number 4311 * of characters specified by length otherwise a <code>SQLException</code> will be 4312 * generated when the <code>CallableStatement</code> is executed. 4313 * This method differs from the <code>setCharacterStream (int, Reader, int)</code> method 4314 * because it informs the driver that the parameter value should be sent to 4315 * the server as a <code>NCLOB</code>. When the <code>setCharacterStream</code> method is used, the 4316 * driver may have to do extra work to determine whether the parameter 4317 * data should be send to the server as a <code>LONGNVARCHAR</code> or a <code>NCLOB</code> 4318 * 4319 * @param parameterName the name of the parameter to be set 4320 * @param reader An object that contains the data to set the parameter value to. 4321 * @param length the number of characters in the parameter data. 4322 * @throws SQLException if parameterIndex does not correspond to a parameter 4323 * marker in the SQL statement; if the length specified is less than zero; 4324 * if the driver does not support national 4325 * character sets; if the driver can detect that a data conversion 4326 * error could occur; if a database access error occurs or 4327 * this method is called on a closed <code>CallableStatement</code> 4328 * @exception SQLFeatureNotSupportedException if the JDBC driver does not support 4329 * this method 4330 * @since 1.6 4331 */ 4332 public void setNClob(String parameterName, Reader reader, long length) 4333 throws SQLException { 4334 throw new SQLFeatureNotSupportedException("Feature not supported"); 4335 } 4336 4337 /** 4338 * Sets the designated parameter to a <code>Reader</code> object. 4339 * This method differs from the <code>setCharacterStream (int, Reader)</code> method 4340 * because it informs the driver that the parameter value should be sent to 4341 * the server as a <code>NCLOB</code>. When the <code>setCharacterStream</code> method is used, the 4342 * driver may have to do extra work to determine whether the parameter 4343 * data should be send to the server as a <code>LONGNVARCHAR</code> or a <code>NCLOB</code> 4344 * <P><B>Note:</B> Consult your JDBC driver documentation to determine if 4345 * it might be more efficient to use a version of 4346 * <code>setNClob</code> which takes a length parameter. 4347 * 4348 * @param parameterName the name of the parameter 4349 * @param reader An object that contains the data to set the parameter value to. 4350 * @throws SQLException if the driver does not support national character sets; 4351 * if the driver can detect that a data conversion 4352 * error could occur; if a database access error occurs or 4353 * this method is called on a closed <code>CallableStatement</code> 4354 * @throws SQLFeatureNotSupportedException if the JDBC driver does not support this method 4355 * 4356 * @since 1.6 4357 */ 4358 public void setNClob(String parameterName, Reader reader) throws SQLException { 4359 throw new SQLFeatureNotSupportedException("Feature not supported"); 4360 } 4361 4362 /** 4363 * Sets the designated parameter to a <code>Reader</code> object. The reader must contain the number 4364 * of characters specified by length otherwise a <code>SQLException</code> will be 4365 * generated when the <code>PreparedStatement</code> is executed. 4366 * This method differs from the <code>setCharacterStream (int, Reader, int)</code> method 4367 * because it informs the driver that the parameter value should be sent to 4368 * the server as a <code>NCLOB</code>. When the <code>setCharacterStream</code> method is used, the 4369 * driver may have to do extra work to determine whether the parameter 4370 * data should be sent to the server as a <code>LONGNVARCHAR</code> or a <code>NCLOB</code> 4371 * @param parameterIndex index of the first parameter is 1, the second is 2, ... 4372 * @param reader An object that contains the data to set the parameter value to. 4373 * @param length the number of characters in the parameter data. 4374 * @throws SQLException if parameterIndex does not correspond to a parameter 4375 * marker in the SQL statement; if the length specified is less than zero; 4376 * if the driver does not support national character sets; 4377 * if the driver can detect that a data conversion 4378 * error could occur; if a database access error occurs or 4379 * this method is called on a closed <code>PreparedStatement</code> 4380 * @throws SQLFeatureNotSupportedException if the JDBC driver does not 4381 * support this method 4382 * 4383 * @since 1.6 4384 */ 4385 public void setNClob(int parameterIndex, Reader reader, long length) 4386 throws SQLException { 4387 throw new SQLFeatureNotSupportedException("Feature not supported"); 4388 } 4389 4390 /** 4391 * Sets the designated parameter to a <code>java.sql.NClob</code> object. The driver converts this oa 4392 * SQL <code>NCLOB</code> value when it sends it to the database. 4393 * @param parameterIndex of the first parameter is 1, the second is 2, ... 4394 * @param value the parameter value 4395 * @throws SQLException if the driver does not support national 4396 * character sets; if the driver can detect that a data conversion 4397 * error could occur ; or if a database access error occurs 4398 * @throws SQLFeatureNotSupportedException if the JDBC driver does not 4399 * support this method 4400 * @since 1.6 4401 */ 4402 public void setNClob(int parameterIndex, NClob value) throws SQLException { 4403 throw new SQLFeatureNotSupportedException("Feature not supported"); 4404 } 4405 4406 /** 4407 * Sets the designated parameter to a <code>Reader</code> object. 4408 * This method differs from the <code>setCharacterStream (int, Reader)</code> method 4409 * because it informs the driver that the parameter value should be sent to 4410 * the server as a <code>NCLOB</code>. When the <code>setCharacterStream</code> method is used, the 4411 * driver may have to do extra work to determine whether the parameter 4412 * data should be sent to the server as a <code>LONGNVARCHAR</code> or a <code>NCLOB</code> 4413 * <P><B>Note:</B> Consult your JDBC driver documentation to determine if 4414 * it might be more efficient to use a version of 4415 * <code>setNClob</code> which takes a length parameter. 4416 * 4417 * @param parameterIndex index of the first parameter is 1, the second is 2, ... 4418 * @param reader An object that contains the data to set the parameter value to. 4419 * @throws SQLException if parameterIndex does not correspond to a parameter 4420 * marker in the SQL statement; 4421 * if the driver does not support national character sets; 4422 * if the driver can detect that a data conversion 4423 * error could occur; if a database access error occurs or 4424 * this method is called on a closed <code>PreparedStatement</code> 4425 * @throws SQLFeatureNotSupportedException if the JDBC driver does not support this method 4426 * 4427 * @since 1.6 4428 */ 4429 public void setNClob(int parameterIndex, Reader reader)throws SQLException { 4430 throw new SQLFeatureNotSupportedException("Feature not supported"); 4431 } 4432 4433 /** 4434 * Sets the designated parameter to the given <code>java.net.URL</code> value. 4435 * The driver converts this to an SQL <code>DATALINK</code> value 4436 * when it sends it to the database. 4437 * 4438 * @param parameterIndex the first parameter is 1, the second is 2, ... 4439 * @param x the <code>java.net.URL</code> object to be set 4440 * @exception SQLException if a database access error occurs or 4441 * this method is called on a closed <code>PreparedStatement</code> 4442 * @throws SQLFeatureNotSupportedException if the JDBC driver does not support this method 4443 */ 4444 public void setURL(int parameterIndex, java.net.URL x) throws SQLException { 4445 throw new SQLFeatureNotSupportedException("Feature not supported"); 4446 } 4447 4448 static final long serialVersionUID = 4886719666485113312L; 4449 4450 } //end class