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