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