0001 /*
0002 * Copyright 2003-2006 Sun Microsystems, Inc. All Rights Reserved.
0003 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
0004 *
0005 * This code is free software; you can redistribute it and/or modify it
0006 * under the terms of the GNU General Public License version 2 only, as
0007 * published by the Free Software Foundation. Sun designates this
0008 * particular file as subject to the "Classpath" exception as provided
0009 * by Sun in the LICENSE file that accompanied this code.
0010 *
0011 * This code is distributed in the hope that it will be useful, but WITHOUT
0012 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
0013 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
0014 * version 2 for more details (a copy is included in the LICENSE file that
0015 * accompanied this code).
0016 *
0017 * You should have received a copy of the GNU General Public License version
0018 * 2 along with this work; if not, write to the Free Software Foundation,
0019 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
0020 *
0021 * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
0022 * CA 95054 USA or visit www.sun.com if you need additional information or
0023 * have any questions.
0024 */
0025
0026 package javax.sql.rowset;
0027
0028 import java.sql.*;
0029 import javax.sql.*;
0030 import java.util.*;
0031 import java.io.*;
0032 import java.math.*;
0033 import java.io.Serializable;
0034
0035 import javax.sql.rowset.serial.*;
0036
0037 /**
0038 * An abstract class providing a <code>RowSet</code> object with its basic functionality.
0039 * The basic functions include having properties and sending event notifications,
0040 * which all JavaBeans<sup><font size=-2>TM</font></sup> components must implement.
0041 * <P>
0042 * <h3>1.0 Overview</h3>
0043 * The <code>BaseRowSet</code> class provides the core functionality
0044 * for all <code>RowSet</code> implementations,
0045 * and all standard implementations <b>may</b> use this class in combination with
0046 * one or more <code>RowSet</code> interfaces in order to provide a standard
0047 * vendor-specific implementation. To clarify, all implementations must implement
0048 * at least one of the <code>RowSet</code> interfaces (<code>JdbcRowSet</code>,
0049 * <code>CachedRowSet</code>, <code>JoinRowSet</code>, <code>FilteredRowSet</code>,
0050 * or <code>WebRowSet</code>). This means that any implementation that extends
0051 * the <code>BaseRowSet</code> class must also implement one of the <code>RowSet</code>
0052 * interfaces.
0053 * <p>
0054 * The <code>BaseRowSet</code> class provides the following:
0055 * <p>
0056 * <UL>
0057 * <LI><b>Properties</b>
0058 * <ul>
0059 * <li>Fields for storing current properties
0060 * <li>Methods for getting and setting properties
0061 * </ul>
0062 * <p>
0063 * <LI><b>Event notification</b>
0064 * <P>
0065 * <LI><b>A complete set of setter methods</b> for setting the parameters in a
0066 * <code>RowSet</code> object's command
0067 * <p>
0068 * <LI> <b>Streams</b>
0069 * <ul>
0070 * <li>Fields for storing stream instances
0071 * <li>Constants for indicating the type of a stream
0072 * </ul>
0073 * <p>
0074 * </UL>
0075 *
0076 * <h3>2.0 Setting Properties</h3>
0077 * All rowsets maintain a set of properties, which will usually be set using
0078 * a tool. The number and kinds of properties a rowset has will vary,
0079 * depending on what the <code>RowSet</code> implementation does and how it gets
0080 * its data. For example,
0081 * rowsets that get their data from a <code>ResultSet</code> object need to
0082 * set the properties that are required for making a database connection.
0083 * If a <code>RowSet</code> object uses the <code>DriverManager</code> facility to make a
0084 * connection, it needs to set a property for the JDBC URL that identifies the
0085 * appropriate driver, and it needs to set the properties that give the
0086 * user name and password.
0087 * If, on the other hand, the rowset uses a <code>DataSource</code> object
0088 * to make the connection, which is the preferred method, it does not need to
0089 * set the property for the JDBC URL. Instead, it needs to set the property
0090 * for the logical name of the data source along with the properties for
0091 * the user name and password.
0092 * <P>
0093 * NOTE: In order to use a <code>DataSource</code> object for making a
0094 * connection, the <code>DataSource</code> object must have been registered
0095 * with a naming service that uses the Java Naming and Directory
0096 * Interface<sup><font size=-2>TM</font></sup> (JNDI) API. This registration
0097 * is usually done by a person acting in the capacity of a system administrator.
0098 * <P>
0099 * <h3>3.0 Setting the Command and Its Parameters</h3>
0100 * When a rowset gets its data from a relational database, it executes a command (a query)
0101 * that produces a <code>ResultSet</code> object. This query is the command that is set
0102 * for the <code>RowSet</code> object's command property. The rowset populates itself with data by reading the
0103 * data from the <code>ResultSet</code> object into itself. If the query
0104 * contains placeholders for values to be set, the <code>BaseRowSet</code> setter methods
0105 * are used to set these values. All setter methods allow these values to be set
0106 * to <code>null</code> if required.
0107 * <P>
0108 * The following code fragment illustrates how the
0109 * <code>CachedRowSet</code><sup><font size=-2>TM</font></sup>
0110 * object <code>crs</code> might have its command property set. Note that if a
0111 * tool is used to set properties, this is the code that the tool would use.
0112 * <PRE>
0113 * crs.setCommand("SELECT FIRST_NAME, LAST_NAME, ADDRESS FROM CUSTOMERS" +
0114 * "WHERE CREDIT_LIMIT > ? AND REGION = ?");
0115 * </PRE>
0116 * <P>
0117 * In this example, the values for <code>CREDIT_LIMIT</code> and
0118 * <code>REGION</code> are placeholder parameters, which are indicated with a
0119 * question mark (?). The first question mark is placeholder parameter number
0120 * <code>1</code>, the second question mark is placeholder parameter number
0121 * <code>2</code>, and so on. Any placeholder parameters must be set with
0122 * values before the query can be executed. To set these
0123 * placeholder parameters, the <code>BaseRowSet</code> class provides a set of setter
0124 * methods, similar to those provided by the <code>PreparedStatement</code>
0125 * interface, for setting values of each data type. A <code>RowSet</code> object stores the
0126 * parameter values internally, and its <code>execute</code> method uses them internally
0127 * to set values for the placeholder parameters
0128 * before it sends the command to the DBMS to be executed.
0129 * <P>
0130 * The following code fragment demonstrates
0131 * setting the two parameters in the query from the previous example.
0132 * <PRE>
0133 * crs.setInt(1, 5000);
0134 * crs.setString(2, "West");
0135 * </PRE>
0136 * If the <code>execute</code> method is called at this point, the query
0137 * sent to the DBMS will be:
0138 * <PRE>
0139 * "SELECT FIRST_NAME, LAST_NAME, ADDRESS FROM CUSTOMERS" +
0140 * "WHERE CREDIT_LIMIT > 5000 AND REGION = 'West'"
0141 * </PRE>
0142 * NOTE: Setting <code>Array</code>, <code>Clob</code>, <code>Blob</code> and
0143 * <code>Ref</code> objects as a command parameter, stores these values as
0144 * <code>SerialArray</code>, <code>SerialClob</code>, <code>SerialBlob</code>
0145 * and <code>SerialRef</code> objects respectively.
0146 *
0147 * <h3>4.0 Handling of Parameters Behind the Scenes</h3>
0148 *
0149 * NOTE: The <code>BaseRowSet</code> class provides two kinds of setter methods,
0150 * those that set properties and those that set placeholder parameters. The setter
0151 * methods discussed in this section are those that set placeholder parameters.
0152 * <P>
0153 * The placeholder parameters set with the <code>BaseRowSet</code> setter methods
0154 * are stored as objects in an internal <code>Hashtable</code> object.
0155 * Primitives are stored as their <code>Object</code> type. For example, <code>byte</code>
0156 * is stored as <code>Byte</code> object, and <code>int</code> is stored as
0157 * an <code>Integer</code> object.
0158 * When the method <code>execute</code> is called, the values in the
0159 * <code>Hashtable</code> object are substituted for the appropriate placeholder
0160 * parameters in the command.
0161 * <P)>
0162 * A call to the method <code>getParams</code> returns the values stored in the
0163 * <code>Hashtable</code> object as an array of <code>Object</code> instances.
0164 * An element in this array may be a simple <code>Object</code> instance or an
0165 * array (which is a type of <code>Object</code>). The particular setter method used
0166 * determines whether an element in this array is an <code>Object</code> or an array.
0167 * <P>
0168 * The majority of methods for setting placeholder parameters take two parameters,
0169 * with the first parameter
0170 * indicating which placeholder parameter is to be set, and the second parameter
0171 * giving the value to be set. Methods such as <code>getInt</code>,
0172 * <code>getString</code>, <code>getBoolean</code>, and <code>getLong</code> fall into
0173 * this category. After these methods have been called, a call to the method
0174 * <code>getParams</code> will return an array with the values that have been set. Each
0175 * element in the array is an <code>Object</code> instance representing the
0176 * values that have been set. The order of these values in the array is determined by the
0177 * <code>int</code> (the first parameter) passed to the setter method. The values in the
0178 * array are the values (the second parameter) passed to the setter method.
0179 * In other words, the first element in the array is the value
0180 * to be set for the first placeholder parameter in the <code>RowSet</code> object's
0181 * command. The second element is the value to
0182 * be set for the second placeholder parameter, and so on.
0183 * <P>
0184 * Several setter methods send the driver and DBMS information beyond the value to be set.
0185 * When the method <code>getParams</code> is called after one of these setter methods has
0186 * been used, the elements in the array will themselves be arrays to accommodate the
0187 * additional information. In this category, the method <code>setNull</code> is a special case
0188 * because one version takes only
0189 * two parameters (<code>setNull(int parameterIndex, int SqlType)</code>). Nevertheless,
0190 * it requires
0191 * an array to contain the information that will be passed to the driver and DBMS. The first
0192 * element in this array is the value to be set, which is <code>null</code>, and the
0193 * second element is the <code>int</code> supplied for <i>sqlType</i>, which
0194 * indicates the type of SQL value that is being set to <code>null</code>. This information
0195 * is needed by some DBMSs and is therefore required in order to ensure that applications
0196 * are portable.
0197 * The other version is intended to be used when the value to be set to <code>null</code>
0198 * is a user-defined type. It takes three parameters
0199 * (<code>setNull(int parameterIndex, int sqlType, String typeName)</code>) and also
0200 * requires an array to contain the information to be passed to the driver and DBMS.
0201 * The first two elements in this array are the same as for the first version of
0202 * <code>setNull</code>. The third element, <i>typeName</i>, gives the SQL name of
0203 * the user-defined type. As is true with the other setter methods, the number of the
0204 * placeholder parameter to be set is indicated by an element's position in the array
0205 * returned by <code>getParams</code>. So, for example, if the parameter
0206 * supplied to <code>setNull</code> is <code>2</code>, the second element in the array
0207 * returned by <code>getParams</code> will be an array of two or three elements.
0208 * <P>
0209 * Some methods, such as <code>setObject</code> and <code>setDate</code> have versions
0210 * that take more than two parameters, with the extra parameters giving information
0211 * to the driver or the DBMS. For example, the methods <code>setDate</code>,
0212 * <code>setTime</code>, and <code>setTimestamp</code> can take a <code>Calendar</code>
0213 * object as their third parameter. If the DBMS does not store time zone information,
0214 * the drivern uses the <code>Calendar</code> object to construct the <code>Date</code>,
0215 * <code>Time</code>, or <code>Timestamp</code> object being set. As is true with other
0216 * methods that provide additional information, the element in the array returned
0217 * by <code>getParams</code> is an array instead of a simple <code>Object</code> instance.
0218 * <P>
0219 * The methods <code>setAsciiStream</code>, <code>setBinaryStream</code>,
0220 * <code>setCharacterStream</code>, and <code>setUnicodeStream</code> (which is
0221 * deprecated, so applications should use <code>getCharacterStream</code> instead)
0222 * take three parameters, so for them, the element in the array returned by
0223 * <code>getParams</code> is also an array. What is different about these setter
0224 * methods is that in addition to the information provided by parameters, the array contains
0225 * one of the <code>BaseRowSet</code> constants indicating the type of stream being set.
0226 * <p>
0227 * NOTE: The method <code>getParams</code> is called internally by
0228 * <code>RowSet</code> implementations extending this class; it is not normally called by an
0229 * application programmer directly.
0230 *
0231 * <h3>5.0 Event Notification</h3>
0232 * The <code>BaseRowSet</code> class provides the event notification
0233 * mechanism for rowsets. It contains the field
0234 * <code>listeners</code>, methods for adding and removing listeners, and
0235 * methods for notifying listeners of changes.
0236 * <P>
0237 * A listener is an object that has implemented the <code>RowSetListener</code> interface.
0238 * If it has been added to a <code>RowSet</code> object's list of listeners, it will be notified
0239 * when an event occurs on that <code>RowSet</code> object. Each listener's
0240 * implementation of the <code>RowSetListener</code> methods defines what that object
0241 * will do when it is notified that an event has occurred.
0242 * <P>
0243 * There are three possible events for a <code>RowSet</code> object:
0244 * <OL>
0245 * <LI>the cursor moves
0246 * <LI>an individual row is changed (updated, deleted, or inserted)
0247 * <LI>the contents of the entire <code>RowSet</code> object are changed
0248 * </OL>
0249 * <P>
0250 * The <code>BaseRowSet</code> method used for the notification indicates the
0251 * type of event that has occurred. For example, the method
0252 * <code>notifyRowChanged</code> indicates that a row has been updated,
0253 * deleted, or inserted. Each of the notification methods creates a
0254 * <code>RowSetEvent</code> object, which is supplied to the listener in order to
0255 * identify the <code>RowSet</code> object on which the event occurred.
0256 * What the listener does with this information, which may be nothing, depends on how it was
0257 * implemented.
0258 * <p>
0259 * <h3>6.0 Default Behavior</h3>
0260 * A default <code>BaseRowSet</code> object is initialized with many starting values.
0261 *
0262 * The following is true of a default <code>RowSet</code> instance that extends
0263 * the <code>BaseRowSet</code> class:
0264 * <UL>
0265 * <LI>Has a scrollable cursor and does not show changes
0266 * made by others.
0267 * <LI>Is updatable.
0268 * <LI>Does not show rows that have been deleted.
0269 * <LI>Has no time limit for how long a driver may take to
0270 * execute the <code>RowSet</code> object's command.
0271 * <LI>Has no limit for the number of rows it may contain.
0272 * <LI>Has no limit for the number of bytes a column may contain. NOTE: This
0273 * limit applies only to columns that hold values of the
0274 * following types: <code>BINARY</code>, <code>VARBINARY</code>,
0275 * <code>LONGVARBINARY</code>, <code>CHAR</code>, <code>VARCHAR</code>,
0276 * and <code>LONGVARCHAR</code>.
0277 * <LI>Will not see uncommitted data (make "dirty" reads).
0278 * <LI>Has escape processing turned on.
0279 * <LI>Has its connection's type map set to <code>null</code>.
0280 * <LI>Has an empty <code>Vector</code> object for storing the values set
0281 * for the placeholder parameters in the <code>RowSet</code> object's command.
0282 * </UL>
0283 * <p>
0284 * If other values are desired, an application must set the property values
0285 * explicitly. For example, the following line of code sets the maximum number
0286 * of rows for the <code>CachedRowSet</code> object <i>crs</i> to 500.
0287 * <PRE>
0288 * crs.setMaxRows(500);
0289 * </PRE>
0290 * Methods implemented in extensions of this <code>BaseRowSet</code> class <b>must</b> throw an
0291 * <code>SQLException</code> object for any violation of the defined assertions. Also, if the
0292 * extending class overrides and reimplements any <code>BaseRowSet</code> method and encounters
0293 * connectivity or underlying data source issues, that method <b>may</b> in addition throw an
0294 * <code>SQLException</code> object for that reason.
0295 */
0296
0297 public abstract class BaseRowSet implements Serializable, Cloneable {
0298
0299 /**
0300 * A constant indicating to a <code>RowSetReaderImpl</code> object
0301 * that a given parameter is a Unicode stream. This
0302 * <code>RowSetReaderImpl</code> object is provided as an extension of the
0303 * <code>SyncProvider</code> abstract class defined in the
0304 * <code>SyncFactory</code> static factory SPI mechanism.
0305 */
0306 public static final int UNICODE_STREAM_PARAM = 0;
0307
0308 /**
0309 * A constant indicating to a <code>RowSetReaderImpl</code> object
0310 * that a given parameter is a binary stream. A
0311 * <code>RowSetReaderImpl</code> object is provided as an extension of the
0312 * <code>SyncProvider</code> abstract class defined in the
0313 * <code>SyncFactory</code> static factory SPI mechanism.
0314 */
0315 public static final int BINARY_STREAM_PARAM = 1;
0316
0317 /**
0318 * A constant indicating to a <code>RowSetReaderImpl</code> object
0319 * that a given parameter is an ASCII stream. A
0320 * <code>RowSetReaderImpl</code> object is provided as an extension of the
0321 * <code>SyncProvider</code> abstract class defined in the
0322 * <code>SyncFactory</code> static factory SPI mechanism.
0323 */
0324 public static final int ASCII_STREAM_PARAM = 2;
0325
0326 /**
0327 * The <code>InputStream</code> object that will be
0328 * returned by the method <code>getBinaryStream</code>, which is
0329 * specified in the <code>ResultSet</code> interface.
0330 * @serial
0331 */
0332 protected java.io.InputStream binaryStream;
0333
0334 /**
0335 * The <code>InputStream</code> object that will be
0336 * returned by the method <code>getUnicodeStream</code>,
0337 * which is specified in the <code>ResultSet</code> interface.
0338 * @serial
0339 */
0340 protected java.io.InputStream unicodeStream;
0341
0342 /**
0343 * The <code>InputStream</code> object that will be
0344 * returned by the method <code>getAsciiStream</code>,
0345 * which is specified in the <code>ResultSet</code> interface.
0346 * @serial
0347 */
0348 protected java.io.InputStream asciiStream;
0349
0350 /**
0351 * The <code>Reader</code> object that will be
0352 * returned by the method <code>getCharacterStream</code>,
0353 * which is specified in the <code>ResultSet</code> interface.
0354 * @serial
0355 */
0356 protected java.io.Reader charStream;
0357
0358 /**
0359 * The query that will be sent to the DBMS for execution when the
0360 * method <code>execute</code> is called.
0361 * @serial
0362 */
0363 private String command;
0364
0365 /**
0366 * The JDBC URL the reader, writer, or both supply to the method
0367 * <code>DriverManager.getConnection</code> when the
0368 * <code>DriverManager</code> is used to get a connection.
0369 * <P>
0370 * The JDBC URL identifies the driver to be used to make the conndection.
0371 * This URL can be found in the documentation supplied by the driver
0372 * vendor.
0373 * @serial
0374 */
0375 private String URL;
0376
0377 /**
0378 * The logical name of the data source that the reader/writer should use
0379 * in order to retrieve a <code>DataSource</code> object from a Java
0380 * Directory and Naming Interface (JNDI) naming service.
0381 * @serial
0382 */
0383 private String dataSource;
0384
0385 /**
0386 * The user name the reader, writer, or both supply to the method
0387 * <code>DriverManager.getConnection</code> when the
0388 * <code>DriverManager</code> is used to get a connection.
0389 * @serial
0390 */
0391 private transient String username;
0392
0393 /**
0394 * The password the reader, writer, or both supply to the method
0395 * <code>DriverManager.getConnection</code> when the
0396 * <code>DriverManager</code> is used to get a connection.
0397 * @serial
0398 */
0399 private transient String password;
0400
0401 /**
0402 * A constant indicating the type of this JDBC <code>RowSet</code>
0403 * object. It must be one of the following <code>ResultSet</code>
0404 * constants: <code>TYPE_FORWARD_ONLY</code>,
0405 * <code>TYPE_SCROLL_INSENSITIVE</code>, or
0406 * <code>TYPE_SCROLL_SENSITIVE</code>.
0407 * @serial
0408 */
0409 private int rowSetType = ResultSet.TYPE_SCROLL_INSENSITIVE;
0410
0411 /**
0412 * A <code>boolean</code> indicating whether deleted rows are visible in this
0413 * JDBC <code>RowSet</code> object .
0414 * @serial
0415 */
0416 private boolean showDeleted = false; // default is false
0417
0418 /**
0419 * The maximum number of seconds the driver
0420 * will wait for a command to execute. This limit applies while
0421 * this JDBC <code>RowSet</code> object is connected to its data
0422 * source, that is, while it is populating itself with
0423 * data and while it is writing data back to the data source.
0424 * @serial
0425 */
0426 private int queryTimeout = 0; // default is no timeout
0427
0428 /**
0429 * The maximum number of rows the reader should read.
0430 * @serial
0431 */
0432 private int maxRows = 0; // default is no limit
0433
0434 /**
0435 * The maximum field size the reader should read.
0436 * @serial
0437 */
0438 private int maxFieldSize = 0; // default is no limit
0439
0440 /**
0441 * A constant indicating the concurrency of this JDBC <code>RowSet</code>
0442 * object. It must be one of the following <code>ResultSet</code>
0443 * constants: <code>CONCUR_READ_ONLY</code> or
0444 * <code>CONCUR_UPDATABLE</code>.
0445 * @serial
0446 */
0447 private int concurrency = ResultSet.CONCUR_UPDATABLE;
0448
0449 /**
0450 * A <code>boolean</code> indicating whether this JDBC <code>RowSet</code>
0451 * object is read-only. <code>true</code> indicates that it is read-only;
0452 * <code>false</code> that it is writable.
0453 * @serial
0454 */
0455 private boolean readOnly;
0456
0457 /**
0458 * A <code>boolean</code> indicating whether the reader for this
0459 * JDBC <code>RowSet</code> object should perform escape processing.
0460 * <code>true</code> means that escape processing is turned on;
0461 * <code>false</code> that it is not. The default is <code>true</code>.
0462 * @serial
0463 */
0464 private boolean escapeProcessing;
0465
0466 /**
0467 * A constant indicating the isolation level of the connection
0468 * for this JDBC <code>RowSet</code> object . It must be one of
0469 * the following <code>Connection</code> constants:
0470 * <code>TRANSACTION_NONE</code>,
0471 * <code>TRANSACTION_READ_UNCOMMITTED</code>,
0472 * <code>TRANSACTION_READ_COMMITTED</code>,
0473 * <code>TRANSACTION_REPEATABLE_READ</code> or
0474 * <code>TRANSACTION_SERIALIZABLE</code>.
0475 * @serial
0476 */
0477 private int isolation;
0478
0479 /**
0480 * A constant used as a hint to the driver that indicates the direction in
0481 * which data from this JDBC <code>RowSet</code> object is going
0482 * to be fetched. The following <code>ResultSet</code> constants are
0483 * possible values:
0484 * <code>FETCH_FORWARD</code>,
0485 * <code>FETCH_REVERSE</code>,
0486 * <code>FETCH_UNKNOWN</code>.
0487 * <P>
0488 * Unused at this time.
0489 * @serial
0490 */
0491 private int fetchDir = ResultSet.FETCH_FORWARD; // default fetch direction
0492
0493 /**
0494 * A hint to the driver that indicates the expected number of rows
0495 * in this JDBC <code>RowSet</code> object .
0496 * <P>
0497 * Unused at this time.
0498 * @serial
0499 */
0500 private int fetchSize = 0; // default fetchSize
0501
0502 /**
0503 * The <code>java.util.Map</code> object that contains entries mapping
0504 * SQL type names to classes in the Java programming language for the
0505 * custom mapping of user-defined types.
0506 * @serial
0507 */
0508 private Map map;
0509
0510 /**
0511 * A <code>Vector</code> object that holds the list of listeners
0512 * that have registered with this <code>RowSet</code> object.
0513 * @serial
0514 */
0515 private Vector listeners;
0516
0517 /**
0518 * A <code>Vector</code> object that holds the parameters set
0519 * for this <code>RowSet</code> object's current command.
0520 * @serial
0521 */
0522 private Hashtable params; // could be transient?
0523
0524 /**
0525 * Constructs a new <code>BaseRowSet</code> object initialized with
0526 * a default <code>Vector</code> object for its <code>listeners</code>
0527 * field. The other default values with which it is initialized are listed
0528 * in Section 6.0 of the class comment for this class.
0529 */
0530 public BaseRowSet() {
0531 // allocate the listeners collection
0532 listeners = new Vector();
0533 }
0534
0535 /**
0536 * Performs the necessary internal configurations and initializations
0537 * to allow any JDBC <code>RowSet</code> implementation to start using
0538 * the standard facilities provided by a <code>BaseRowSet</code>
0539 * instance. This method <b>should</b> be called after the <code>RowSet</code> object
0540 * has been instantiated to correctly initialize all parameters. This method
0541 * <b>should</b> never be called by an application, but is called from with
0542 * a <code>RowSet</code> implementation extending this class.
0543 */
0544 protected void initParams() {
0545 params = new Hashtable();
0546 }
0547
0548 //--------------------------------------------------------------------
0549 // Events
0550 //--------------------------------------------------------------------
0551
0552 /**
0553 * The listener will be notified whenever an event occurs on this <code>RowSet</code>
0554 * object.
0555 * <P>
0556 * A listener might, for example, be a table or graph that needs to
0557 * be updated in order to accurately reflect the current state of
0558 * the <code>RowSet</code> object.
0559 * <p>
0560 * <b>Note</b>: if the <code>RowSetListener</code> object is
0561 * <code>null</code>, this method silently discards the <code>null</code>
0562 * value and does not add a null reference to the set of listeners.
0563 * <p>
0564 * <b>Note</b>: if the listener is already set, and the new <code>RowSetListerner</code>
0565 * instance is added to the set of listeners already registered to receive
0566 * event notifications from this <code>RowSet</code>.
0567 *
0568 * @param listener an object that has implemented the
0569 * <code>javax.sql.RowSetListener</code> interface and wants to be notified
0570 * of any events that occur on this <code>RowSet</code> object; May be
0571 * null.
0572 * @see #removeRowSetListener
0573 */
0574 public void addRowSetListener(RowSetListener listener) {
0575 listeners.add(listener);
0576 }
0577
0578 /**
0579 * Removes the designated object from this <code>RowSet</code> object's list of listeners.
0580 * If the given argument is not a registered listener, this method
0581 * does nothing.
0582 *
0583 * <b>Note</b>: if the <code>RowSetListener</code> object is
0584 * <code>null</code>, this method silently discards the <code>null</code>
0585 * value.
0586 *
0587 * @param listener a <code>RowSetListener</code> object that is on the list
0588 * of listeners for this <code>RowSet</code> object
0589 * @see #addRowSetListener
0590 */
0591 public void removeRowSetListener(RowSetListener listener) {
0592 listeners.remove(listener);
0593 }
0594
0595 /**
0596 * Determine if instance of this class extends the RowSet interface.
0597 */
0598 private void checkforRowSetInterface() throws SQLException {
0599 if ((this instanceof javax.sql.RowSet) == false) {
0600 throw new SQLException(
0601 "The class extending abstract class BaseRowSet "
0602 + "must implement javax.sql.RowSet or one of it's sub-interfaces.");
0603 }
0604 }
0605
0606 /**
0607 * Notifies all of the listeners registered with this
0608 * <code>RowSet</code> object that its cursor has moved.
0609 * <P>
0610 * When an application calls a method to move the cursor,
0611 * that method moves the cursor and then calls this method
0612 * internally. An application <b>should</b> never invoke
0613 * this method directly.
0614 *
0615 * @throws SQLException if the class extending the <code>BaseRowSet</code>
0616 * abstract class does not implement the <code>RowSet</code> interface or
0617 * one of it's sub-interfaces.
0618 */
0619 protected void notifyCursorMoved() throws SQLException {
0620 checkforRowSetInterface();
0621 if (listeners.isEmpty() == false) {
0622 RowSetEvent event = new RowSetEvent((RowSet) this );
0623 for (Iterator i = listeners.iterator(); i.hasNext();) {
0624 ((RowSetListener) i.next()).cursorMoved(event);
0625 }
0626 }
0627 }
0628
0629 /**
0630 * Notifies all of the listeners registered with this <code>RowSet</code> object that
0631 * one of its rows has changed.
0632 * <P>
0633 * When an application calls a method that changes a row, such as
0634 * the <code>CachedRowSet</code> methods <code>insertRow</code>,
0635 * <code>updateRow</code>, or <code>deleteRow</code>,
0636 * that method calls <code>notifyRowChanged</code>
0637 * internally. An application <b>should</b> never invoke
0638 * this method directly.
0639 *
0640 * @throws SQLException if the class extending the <code>BaseRowSet</code>
0641 * abstract class does not implement the <code>RowSet</code> interface or
0642 * one of it's sub-interfaces.
0643 */
0644 protected void notifyRowChanged() throws SQLException {
0645 checkforRowSetInterface();
0646 if (listeners.isEmpty() == false) {
0647 RowSetEvent event = new RowSetEvent((RowSet) this );
0648 for (Iterator i = listeners.iterator(); i.hasNext();) {
0649 ((RowSetListener) i.next()).rowChanged(event);
0650 }
0651 }
0652 }
0653
0654 /**
0655 * Notifies all of the listeners registered with this <code>RowSet</code>
0656 * object that its entire contents have changed.
0657 * <P>
0658 * When an application calls methods that change the entire contents
0659 * of the <code>RowSet</code> object, such as the <code>CachedRowSet</code> methods
0660 * <code>execute</code>, <code>populate</code>, <code>restoreOriginal</code>,
0661 * or <code>release</code>, that method calls <code>notifyRowSetChanged</code>
0662 * internally (either directly or indirectly). An application <b>should</b>
0663 * never invoke this method directly.
0664 *
0665 * @throws SQLException if the class extending the <code>BaseRowSet</code>
0666 * abstract class does not implement the <code>RowSet</code> interface or
0667 * one of it's sub-interfaces.
0668 */
0669 protected void notifyRowSetChanged() throws SQLException {
0670 checkforRowSetInterface();
0671 if (listeners.isEmpty() == false) {
0672 RowSetEvent event = new RowSetEvent((RowSet) this );
0673 for (Iterator i = listeners.iterator(); i.hasNext();) {
0674 ((RowSetListener) i.next()).rowSetChanged(event);
0675 }
0676 }
0677 }
0678
0679 /**
0680 * Retrieves the SQL query that is the command for this
0681 * <code>RowSet</code> object. The command property contains the query that
0682 * will be executed to populate this <code>RowSet</code> object.
0683 * <P>
0684 * The SQL query returned by this method is used by <code>RowSet</code> methods
0685 * such as <code>execute</code> and <code>populate</code>, which may be implemented
0686 * by any class that extends the <code>BaseRowSet</code> abstract class and
0687 * implements one or more of the standard JSR-114 <code>RowSet</code>
0688 * interfaces.
0689 * <P>
0690 * The command is used by the <code>RowSet</code> object's
0691 * reader to obtain a <code>ResultSet</code> object. The reader then
0692 * reads the data from the <code>ResultSet</code> object and uses it to
0693 * to populate this <code>RowSet</code> object.
0694 * <P>
0695 * The default value for the <code>command</code> property is <code>null</code>.
0696 *
0697 * @return the <code>String</code> that is the value for this
0698 * <code>RowSet</code> object's <code>command</code> property;
0699 * may be <code>null</code>
0700 * @see #setCommand
0701 */
0702 public String getCommand() {
0703 return command;
0704 }
0705
0706 /**
0707 * Sets this <code>RowSet</code> object's <code>command</code> property to
0708 * the given <code>String</code> object and clears the parameters, if any,
0709 * that were set for the previous command.
0710 * <P>
0711 * The <code>command</code> property may not be needed if the <code>RowSet</code>
0712 * object gets its data from a source that does not support commands,
0713 * such as a spreadsheet or other tabular file.
0714 * Thus, this property is optional and may be <code>null</code>.
0715 *
0716 * @param cmd a <code>String</code> object containing an SQL query
0717 * that will be set as this <code>RowSet</code> object's command
0718 * property; may be <code>null</code> but may not be an empty string
0719 * @throws SQLException if an empty string is provided as the command value
0720 * @see #getCommand
0721 */
0722 public void setCommand(String cmd) throws SQLException {
0723 // cmd equal to null or
0724 // cmd with length 0 (implies url =="")
0725 // are not independent events.
0726
0727 if (cmd == null) {
0728 command = null;
0729 } else if (cmd.length() == 0) {
0730 throw new SQLException("Invalid command string detected. "
0731 + "Cannot be of length less than 0");
0732 } else {
0733 // "unbind" any parameters from any previous command.
0734 if (params == null) {
0735 throw new SQLException(
0736 "Set initParams() before setCommand");
0737 }
0738 params.clear();
0739 command = new String(cmd);
0740 }
0741
0742 }
0743
0744 /**
0745 * Retrieves the JDBC URL that this <code>RowSet</code> object's
0746 * <code>javax.sql.Reader</code> object uses to make a connection
0747 * with a relational database using a JDBC technology-enabled driver.
0748 *<P>
0749 * The <code>Url</code> property will be <code>null</code> if the underlying data
0750 * source is a non-SQL data source, such as a spreadsheet or an XML
0751 * data source.
0752 *
0753 * @return a <code>String</code> object that contains the JDBC URL
0754 * used to establish the connection for this <code>RowSet</code>
0755 * object; may be <code>null</code> (default value) if not set
0756 * @throws SQLException if an error occurs retrieving the URL value
0757 * @see #setUrl
0758 */
0759 public String getUrl() throws SQLException {
0760 return URL;
0761 }
0762
0763 /**
0764 * Sets the Url property for this <code>RowSet</code> object
0765 * to the given <code>String</code> object and sets the dataSource name
0766 * property to <code>null</code>. The Url property is a
0767 * JDBC URL that is used when
0768 * the connection is created using a JDBC technology-enabled driver
0769 * ("JDBC driver") and the <code>DriverManager</code>.
0770 * The correct JDBC URL for the specific driver to be used can be found
0771 * in the driver documentation. Although there are guidelines for for how
0772 * a JDBC URL is formed,
0773 * a driver vendor can specify any <code>String</code> object except
0774 * one with a length of <code>0</code> (an empty string).
0775 * <P>
0776 * Setting the Url property is optional if connections are established using
0777 * a <code>DataSource</code> object instead of the <code>DriverManager</code>.
0778 * The driver will use either the URL property or the
0779 * dataSourceName property to create a connection, whichever was
0780 * specified most recently. If an application uses a JDBC URL, it
0781 * must load a JDBC driver that accepts the JDBC URL before it uses the
0782 * <code>RowSet</code> object to connect to a database. The <code>RowSet</code>
0783 * object will use the URL internally to create a database connection in order
0784 * to read or write data.
0785 *
0786 * @param url a <code>String</code> object that contains the JDBC URL
0787 * that will be used to establish the connection to a database for this
0788 * <code>RowSet</code> object; may be <code>null</code> but must not
0789 * be an empty string
0790 * @throws SQLException if an error occurs setting the Url property or the
0791 * parameter supplied is a string with a length of <code>0</code> (an
0792 * empty string)
0793 * @see #getUrl
0794 */
0795 public void setUrl(String url) throws SQLException {
0796 if (url == null) {
0797 url = null;
0798 } else if (url.length() < 1) {
0799 throw new SQLException("Invalid url string detected. "
0800 + "Cannot be of length less than 1");
0801 } else {
0802 URL = new String(url);
0803 }
0804
0805 dataSource = null;
0806
0807 }
0808
0809 /**
0810 * Returns the logical name that when supplied to a naming service
0811 * that uses the Java Naming and Directory Interface (JNDI) API, will
0812 * retrieve a <code>javax.sql.DataSource</code> object. This
0813 * <code>DataSource</code> object can be used to establish a connection
0814 * to the data source that it represents.
0815 * <P>
0816 * Users should set either the url or the data source name property.
0817 * The driver will use the property set most recently to establish a
0818 * connection.
0819 *
0820 * @return a <code>String</code> object that identifies the
0821 * <code>DataSource</code> object to be used for making a
0822 * connection; if no logical name has been set, <code>null</code>
0823 * is returned.
0824 * @see #setDataSourceName
0825 */
0826 public String getDataSourceName() {
0827 return dataSource;
0828 }
0829
0830 /**
0831 * Sets the <code>DataSource</code> name property for this <code>RowSet</code>
0832 * object to the given logical name and sets this <code>RowSet</code> object's
0833 * Url property to <code>null</code>. The name must have been bound to a
0834 * <code>DataSource</code> object in a JNDI naming service so that an
0835 * application can do a lookup using that name to retrieve the
0836 * <code>DataSource</code> object bound to it. The <code>DataSource</code>
0837 * object can then be used to establish a connection to the data source it
0838 * represents.
0839 * <P>
0840 * Users should set either the Url property or the dataSourceName property.
0841 * If both properties are set, the driver will use the property set most recently.
0842 *
0843 * @param name a <code>String</code> object with the name that can be supplied
0844 * to a naming service based on JNDI technology to retrieve the
0845 * <code>DataSource</code> object that can be used to get a connection;
0846 * may be <code>null</code> but must not be an empty string
0847 * @throws SQLException if an empty string is provided as the <code>DataSource</code>
0848 * name
0849 * @see #getDataSourceName
0850 */
0851 public void setDataSourceName(String name) throws SQLException {
0852
0853 if (name == null) {
0854 dataSource = null;
0855 } else if (name.equals("")) {
0856 throw new SQLException(
0857 "DataSource name cannot be empty string");
0858 } else {
0859 dataSource = new String(name);
0860 }
0861
0862 URL = null;
0863 }
0864
0865 /**
0866 * Returns the user name used to create a database connection. Because it
0867 * is not serialized, the username property is set at runtime before
0868 * calling the method <code>execute</code>.
0869 *
0870 * @return the <code>String</code> object containing the user name that
0871 * is supplied to the data source to create a connection; may be
0872 * <code>null</code> (default value) if not set
0873 * @see #setUsername
0874 */
0875 public String getUsername() {
0876 return username;
0877 }
0878
0879 /**
0880 * Sets the username property for this <code>RowSet</code> object
0881 * to the given user name. Because it
0882 * is not serialized, the username property is set at run time before
0883 * calling the method <code>execute</code>.
0884 *
0885 * @param name the <code>String</code> object containing the user name that
0886 * is supplied to the data source to create a connection. It may be null.
0887 * @see #getUsername
0888 */
0889 public void setUsername(String name) {
0890 if (name == null) {
0891 username = null;
0892 } else {
0893 username = new String(name);
0894 }
0895 }
0896
0897 /**
0898 * Returns the password used to create a database connection for this
0899 * <code>RowSet</code> object. Because the password property is not
0900 * serialized, it is set at run time before calling the method
0901 * <code>execute</code>. The default value is <code>null</code>
0902 *
0903 * @return the <code>String</code> object that represents the password
0904 * that must be supplied to the database to create a connection
0905 * @see #setPassword
0906 */
0907 public String getPassword() {
0908 return password;
0909 }
0910
0911 /**
0912 * Sets the password used to create a database connection for this
0913 * <code>RowSet</code> object to the given <code>String</code>
0914 * object. Because the password property is not
0915 * serialized, it is set at run time before calling the method
0916 * <code>execute</code>.
0917 *
0918 * @param pass the <code>String</code> object that represents the password
0919 * that is supplied to the database to create a connection. It may be
0920 * null.
0921 * @see #getPassword
0922 */
0923 public void setPassword(String pass) {
0924 if (pass == null) {
0925 password = null;
0926 } else {
0927 password = new String(pass);
0928 }
0929 }
0930
0931 /**
0932 * Sets the type for this <code>RowSet</code> object to the specified type.
0933 * The default type is <code>ResultSet.TYPE_SCROLL_INSENSITIVE</code>.
0934 *
0935 * @param type one of the following constants:
0936 * <code>ResultSet.TYPE_FORWARD_ONLY</code>,
0937 * <code>ResultSet.TYPE_SCROLL_INSENSITIVE</code>, or
0938 * <code>ResultSet.TYPE_SCROLL_SENSITIVE</code>
0939 * @throws SQLException if the parameter supplied is not one of the
0940 * following constants:
0941 * <code>ResultSet.TYPE_FORWARD_ONLY</code> or
0942 * <code>ResultSet.TYPE_SCROLL_INSENSITIVE</code>
0943 * <code>ResultSet.TYPE_SCROLL_SENSITIVE</code>
0944 * @see #getConcurrency
0945 * @see #getType
0946 */
0947 public void setType(int type) throws SQLException {
0948
0949 if ((type != ResultSet.TYPE_FORWARD_ONLY)
0950 && (type != ResultSet.TYPE_SCROLL_INSENSITIVE)
0951 && (type != ResultSet.TYPE_SCROLL_SENSITIVE)) {
0952 throw new SQLException(
0953 "Invalid type of RowSet set. Must be either "
0954 + "ResultSet.TYPE_FORWARD_ONLY or ResultSet.TYPE_SCROLL_INSENSITIVE "
0955 + "or ResultSet.TYPE_SCROLL_SENSITIVE.");
0956 }
0957 this .rowSetType = type;
0958 }
0959
0960 /**
0961 * Returns the type of this <code>RowSet</code> object. The type is initially
0962 * determined by the statement that created the <code>RowSet</code> object.
0963 * The <code>RowSet</code> object can call the method
0964 * <code>setType</code> at any time to change its
0965 * type. The default is <code>TYPE_SCROLL_INSENSITIVE</code>.
0966 *
0967 * @return the type of this JDBC <code>RowSet</code>
0968 * object, which must be one of the following:
0969 * <code>ResultSet.TYPE_FORWARD_ONLY</code>,
0970 * <code>ResultSet.TYPE_SCROLL_INSENSITIVE</code>, or
0971 * <code>ResultSet.TYPE_SCROLL_SENSITIVE</code>
0972 * @throws SQLException if an error occurs getting the type of
0973 * of this <code>RowSet</code> object
0974 * @see #setType
0975 */
0976 public int getType() throws SQLException {
0977 return rowSetType;
0978 }
0979
0980 /**
0981 * Sets the concurrency for this <code>RowSet</code> object to
0982 * the specified concurrency. The default concurrency for any <code>RowSet</code>
0983 * object (connected or disconnected) is <code>ResultSet.CONCUR_UPDATABLE</code>,
0984 * but this method may be called at any time to change the concurrency.
0985 * <P>
0986 * @param concurrency one of the following constants:
0987 * <code>ResultSet.CONCUR_READ_ONLY</code> or
0988 * <code>ResultSet.CONCUR_UPDATABLE</code>
0989 * @throws SQLException if the parameter supplied is not one of the
0990 * following constants:
0991 * <code>ResultSet.CONCUR_UPDATABLE</code> or
0992 * <code>ResultSet.CONCUR_READ_ONLY</code>
0993 * @see #getConcurrency
0994 * @see #isReadOnly
0995 */
0996 public void setConcurrency(int concurrency) throws SQLException {
0997
0998 if ((concurrency != ResultSet.CONCUR_READ_ONLY)
0999 && (concurrency != ResultSet.CONCUR_UPDATABLE)) {
1000 throw new SQLException(
1001 "Invalid concurrency set. Must be either "
1002 + "ResultSet.CONCUR_READ_ONLY or ResultSet.CONCUR_UPDATABLE.");
1003 }
1004 this .concurrency = concurrency;
1005 }
1006
1007 /**
1008 * Returns a <code>boolean</code> indicating whether this
1009 * <code>RowSet</code> object is read-only.
1010 * Any attempts to update a read-only <code>RowSet</code> object will result in an
1011 * <code>SQLException</code> being thrown. By default,
1012 * rowsets are updatable if updates are possible.
1013 *
1014 * @return <code>true</code> if this <code>RowSet</code> object
1015 * cannot be updated; <code>false</code> otherwise
1016 * @see #setConcurrency
1017 * @see #setReadOnly
1018 */
1019 public boolean isReadOnly() {
1020 return readOnly;
1021 };
1022
1023 /**
1024 * Sets this <code>RowSet</code> object's readOnly property to the given <code>boolean</code>.
1025 *
1026 * @param value <code>true</code> to indicate that this
1027 * <code>RowSet</code> object is read-only;
1028 * <code>false</code> to indicate that it is updatable
1029 */
1030 public void setReadOnly(boolean value) {
1031 readOnly = value;
1032 }
1033
1034 /**
1035 * Returns the transaction isolation property for this
1036 * <code>RowSet</code> object's connection. This property represents
1037 * the transaction isolation level requested for use in transactions.
1038 * <P>
1039 * For <code>RowSet</code> implementations such as
1040 * the <code>CachedRowSet</code> that operate in a disconnected environment,
1041 * the <code>SyncProvider</code> object
1042 * offers complementary locking and data integrity options. The
1043 * options described below are pertinent only to connected <code>RowSet</code>
1044 * objects (<code>JdbcRowSet</code> objects).
1045 *
1046 * @return one of the following constants:
1047 * <code>Connection.TRANSACTION_NONE</code>,
1048 * <code>Connection.TRANSACTION_READ_UNCOMMITTED</code>,
1049 * <code>Connection.TRANSACTION_READ_COMMITTED</code>,
1050 * <code>Connection.TRANSACTION_REPEATABLE_READ</code>, or
1051 * <code>Connection.TRANSACTION_SERIALIZABLE</code>
1052 * @see javax.sql.rowset.spi.SyncFactory
1053 * @see javax.sql.rowset.spi.SyncProvider
1054 * @see #setTransactionIsolation
1055
1056 */
1057 public int getTransactionIsolation() {
1058 return isolation;
1059 };
1060
1061 /**
1062 * Sets the transaction isolation property for this JDBC <code>RowSet</code> object to the given
1063 * constant. The DBMS will use this transaction isolation level for
1064 * transactions if it can.
1065 * <p>
1066 * For <code>RowSet</code> implementations such as
1067 * the <code>CachedRowSet</code> that operate in a disconnected environment,
1068 * the <code>SyncProvider</code> object being used
1069 * offers complementary locking and data integrity options. The
1070 * options described below are pertinent only to connected <code>RowSet</code>
1071 * objects (<code>JdbcRowSet</code> objects).
1072 *
1073 * @param level one of the following constants, listed in ascending order:
1074 * <code>Connection.TRANSACTION_NONE</code>,
1075 * <code>Connection.TRANSACTION_READ_UNCOMMITTED</code>,
1076 * <code>Connection.TRANSACTION_READ_COMMITTED</code>,
1077 * <code>Connection.TRANSACTION_REPEATABLE_READ</code>, or
1078 * <code>Connection.TRANSACTION_SERIALIZABLE</code>
1079 * @throws SQLException if the given parameter is not one of the Connection
1080 * constants
1081 * @see javax.sql.rowset.spi.SyncFactory
1082 * @see javax.sql.rowset.spi.SyncProvider
1083 * @see #getTransactionIsolation
1084 */
1085 public void setTransactionIsolation(int level) throws SQLException {
1086 if ((level != Connection.TRANSACTION_NONE)
1087 && (level != Connection.TRANSACTION_READ_COMMITTED)
1088 && (level != Connection.TRANSACTION_READ_UNCOMMITTED)
1089 && (level != Connection.TRANSACTION_REPEATABLE_READ)
1090 && (level != Connection.TRANSACTION_SERIALIZABLE)) {
1091 throw new SQLException(
1092 "Invalid transaction isolation set. Must "
1093 + "be either "
1094 + "Connection.TRANSACTION_NONE or "
1095 + "Connection.TRANSACTION_READ_UNCOMMITTED or "
1096 + "Connection.TRANSACTION_READ_COMMITTED or "
1097 + "Connection.RRANSACTION_REPEATABLE_READ or "
1098 + "Connection.TRANSACTION_SERIALIZABLE");
1099 }
1100 this .isolation = level;
1101 }
1102
1103 /**
1104 * Retrieves the type map associated with the <code>Connection</code>
1105 * object for this <code>RowSet</code> object.
1106 * <P>
1107 * Drivers that support the JDBC 3.0 API will create
1108 * <code>Connection</code> objects with an associated type map.
1109 * This type map, which is initially empty, can contain one or more
1110 * fully-qualified SQL names and <code>Class</code> objects indicating
1111 * the class to which the named SQL value will be mapped. The type mapping
1112 * specified in the connection's type map is used for custom type mapping
1113 * when no other type map supersedes it.
1114 * <p>
1115 * If a type map is explicitly supplied to a method that can perform
1116 * custom mapping, that type map supersedes the connection's type map.
1117 *
1118 * @return the <code>java.util.Map</code> object that is the type map
1119 * for this <code>RowSet</code> object's connection
1120 */
1121 public java.util.Map<String, Class<?>> getTypeMap() {
1122 return map;
1123 }
1124
1125 /**
1126 * Installs the given <code>java.util.Map</code> object as the type map
1127 * associated with the <code>Connection</code> object for this
1128 * <code>RowSet</code> object. The custom mapping indicated in
1129 * this type map will be used unless a different type map is explicitly
1130 * supplied to a method, in which case the type map supplied will be used.
1131 *
1132 * @param map a <code>java.util.Map</code> object that contains the
1133 * mapping from SQL type names for user defined types (UDT) to classes in
1134 * the Java programming language. Each entry in the <code>Map</code>
1135 * object consists of the fully qualified SQL name of a UDT and the
1136 * <code>Class</code> object for the <code>SQLData</code> implementation
1137 * of that UDT. May be <code>null</code>.
1138 */
1139 public void setTypeMap(java.util.Map<String, Class<?>> map) {
1140 this .map = map;
1141 }
1142
1143 /**
1144 * Retrieves the maximum number of bytes that can be used for a column
1145 * value in this <code>RowSet</code> object.
1146 * This limit applies only to columns that hold values of the
1147 * following types: <code>BINARY</code>, <code>VARBINARY</code>,
1148 * <code>LONGVARBINARY</code>, <code>CHAR</code>, <code>VARCHAR</code>,
1149 * and <code>LONGVARCHAR</code>. If the limit is exceeded, the excess
1150 * data is silently discarded.
1151 *
1152 * @return an <code>int</code> indicating the current maximum column size
1153 * limit; zero means that there is no limit
1154 * @throws SQLException if an error occurs internally determining the
1155 * maximum limit of the column size
1156 */
1157 public int getMaxFieldSize() throws SQLException {
1158 return maxFieldSize;
1159 }
1160
1161 /**
1162 * Sets the maximum number of bytes that can be used for a column
1163 * value in this <code>RowSet</code> object to the given number.
1164 * This limit applies only to columns that hold values of the
1165 * following types: <code>BINARY</code>, <code>VARBINARY</code>,
1166 * <code>LONGVARBINARY</code>, <code>CHAR</code>, <code>VARCHAR</code>,
1167 * and <code>LONGVARCHAR</code>. If the limit is exceeded, the excess
1168 * data is silently discarded. For maximum portability, it is advisable to
1169 * use values greater than 256.
1170 *
1171 * @param max an <code>int</code> indicating the new maximum column size
1172 * limit; zero means that there is no limit
1173 * @throws SQLException if (1) an error occurs internally setting the
1174 * maximum limit of the column size or (2) a size of less than 0 is set
1175 */
1176 public void setMaxFieldSize(int max) throws SQLException {
1177 if (max < 0) {
1178 throw new SQLException(
1179 "Invalid max field size set. Cannot be of "
1180 + "value: " + max);
1181 }
1182 maxFieldSize = max;
1183 }
1184
1185 /**
1186 * Retrieves the maximum number of rows that this <code>RowSet</code> object may contain. If
1187 * this limit is exceeded, the excess rows are silently dropped.
1188 *
1189 * @return an <code>int</code> indicating the current maximum number of
1190 * rows; zero means that there is no limit
1191 * @throws SQLException if an error occurs internally determining the
1192 * maximum limit of rows that a <code>Rowset</code> object can contain
1193 */
1194 public int getMaxRows() throws SQLException {
1195 return maxRows;
1196 }
1197
1198 /**
1199 * Sets the maximum number of rows that this <code>RowSet</code> object may contain to
1200 * the given number. If this limit is exceeded, the excess rows are
1201 * silently dropped.
1202 *
1203 * @param max an <code>int</code> indicating the current maximum number
1204 * of rows; zero means that there is no limit
1205 * @throws SQLException if an error occurs internally setting the
1206 * maximum limit on the number of rows that a JDBC <code>RowSet</code> object
1207 * can contain; or if <i>max</i> is less than <code>0</code>; or
1208 * if <i>max</i> is less than the <code>fetchSize</code> of the
1209 * <code>RowSet</code>
1210 */
1211 public void setMaxRows(int max) throws SQLException {
1212 if (max < 0) {
1213 throw new SQLException(
1214 "Invalid max row size set. Cannot be of "
1215 + "value: " + max);
1216 } else if (max < this .getFetchSize()) {
1217 throw new SQLException(
1218 "Invalid max row size set. Cannot be less "
1219 + "than the fetchSize.");
1220 }
1221 this .maxRows = max;
1222 }
1223
1224 /**
1225 * Sets to the given <code>boolean</code> whether or not the driver will
1226 * scan for escape syntax and do escape substitution before sending SQL
1227 * statements to the database. The default is for the driver to do escape
1228 * processing.
1229 * <P>
1230 * Note: Since <code>PreparedStatement</code> objects have usually been
1231 * parsed prior to making this call, disabling escape processing for
1232 * prepared statements will likely have no effect.
1233 *
1234 * @param enable <code>true</code> to enable escape processing;
1235 * <code>false</code> to disable it
1236 * @throws SQLException if an error occurs setting the underlying JDBC
1237 * technology-enabled driver to process the escape syntax
1238 */
1239 public void setEscapeProcessing(boolean enable) throws SQLException {
1240 escapeProcessing = enable;
1241 }
1242
1243 /**
1244 * Retrieves the maximum number of seconds the driver will wait for a
1245 * query to execute. If the limit is exceeded, an <code>SQLException</code>
1246 * is thrown.
1247 *
1248 * @return the current query timeout limit in seconds; zero means that
1249 * there is no limit
1250 * @throws SQLException if an error occurs in determining the query
1251 * time-out value
1252 */
1253 public int getQueryTimeout() throws SQLException {
1254 return queryTimeout;
1255 }
1256
1257 /**
1258 * Sets to the given number the maximum number of seconds the driver will
1259 * wait for a query to execute. If the limit is exceeded, an
1260 * <code>SQLException</code> is thrown.
1261 *
1262 * @param seconds the new query time-out limit in seconds; zero means that
1263 * there is no limit; must not be less than zero
1264 * @throws SQLException if an error occurs setting the query
1265 * time-out or if the query time-out value is less than 0
1266 */
1267 public void setQueryTimeout(int seconds) throws SQLException {
1268 if (seconds < 0) {
1269 throw new SQLException(
1270 "Invalid query timeout value set. Cannot be "
1271 + "of value: " + seconds);
1272 }
1273 this .queryTimeout = seconds;
1274 }
1275
1276 /**
1277 * Retrieves a <code>boolean</code> indicating whether rows marked
1278 * for deletion appear in the set of current rows.
1279 * The default value is <code>false</code>.
1280 * <P>
1281 * Note: Allowing deleted rows to remain visible complicates the behavior
1282 * of some of the methods. However, most <code>RowSet</code> object users
1283 * can simply ignore this extra detail because only sophisticated
1284 * applications will likely want to take advantage of this feature.
1285 *
1286 * @return <code>true</code> if deleted rows are visible;
1287 * <code>false</code> otherwise
1288 * @throws SQLException if an error occurs determining if deleted rows
1289 * are visible or not
1290 * @see #setShowDeleted
1291 */
1292 public boolean getShowDeleted() throws SQLException {
1293 return showDeleted;
1294 }
1295
1296 /**
1297 * Sets the property <code>showDeleted</code> to the given
1298 * <code>boolean</code> value, which determines whether
1299 * rows marked for deletion appear in the set of current rows.
1300 *
1301 * @param value <code>true</code> if deleted rows should be shown;
1302 * <code>false</code> otherwise
1303 * @throws SQLException if an error occurs setting whether deleted
1304 * rows are visible or not
1305 * @see #getShowDeleted
1306 */
1307 public void setShowDeleted(boolean value) throws SQLException {
1308 showDeleted = value;
1309 }
1310
1311 /**
1312 * Ascertains whether escape processing is enabled for this
1313 * <code>RowSet</code> object.
1314 *
1315 * @return <code>true</code> if escape processing is turned on;
1316 * <code>false</code> otherwise
1317 * @throws SQLException if an error occurs determining if escape
1318 * processing is enabled or not or if the internal escape
1319 * processing trigger has not been enabled
1320 */
1321 public boolean getEscapeProcessing() throws SQLException {
1322 return escapeProcessing;
1323 }
1324
1325 /**
1326 * Gives the driver a performance hint as to the direction in
1327 * which the rows in this <code>RowSet</code> object will be
1328 * processed. The driver may ignore this hint.
1329 * <P>
1330 * A <code>RowSet</code> object inherits the default properties of the
1331 * <code>ResultSet</code> object from which it got its data. That
1332 * <code>ResultSet</code> object's default fetch direction is set by
1333 * the <code>Statement</code> object that created it.
1334 * <P>
1335 * This method applies to a <code>RowSet</code> object only while it is
1336 * connected to a database using a JDBC driver.
1337 * <p>
1338 * A <code>RowSet</code> object may use this method at any time to change
1339 * its setting for the fetch direction.
1340 *
1341 * @param direction one of <code>ResultSet.FETCH_FORWARD</code>,
1342 * <code>ResultSet.FETCH_REVERSE</code>, or
1343 * <code>ResultSet.FETCH_UNKNOWN</code>
1344 * @throws SQLException if (1) the <code>RowSet</code> type is
1345 * <code>TYPE_FORWARD_ONLY</code> and the given fetch direction is not
1346 * <code>FETCH_FORWARD</code> or (2) the given fetch direction is not
1347 * one of the following:
1348 * ResultSet.FETCH_FORWARD,
1349 * ResultSet.FETCH_REVERSE, or
1350 * ResultSet.FETCH_UNKNOWN
1351 * @see #getFetchDirection
1352 */
1353 public void setFetchDirection(int direction) throws SQLException {
1354 // Changed the condition checking to the below as there were two
1355 // conditions that had to be checked
1356 // 1. RowSet is TYPE_FORWARD_ONLY and direction is not FETCH_FORWARD
1357 // 2. Direction is not one of the valid values
1358
1359 if (((getType() == ResultSet.TYPE_FORWARD_ONLY) && (direction != ResultSet.FETCH_FORWARD))
1360 || ((direction != ResultSet.FETCH_FORWARD)
1361 && (direction != ResultSet.FETCH_REVERSE) && (direction != ResultSet.FETCH_UNKNOWN))) {
1362 throw new SQLException("Invalid Fetch Direction");
1363 }
1364 fetchDir = direction;
1365 }
1366
1367 /**
1368 * Retrieves this <code>RowSet</code> object's current setting for the
1369 * fetch direction. The default type is <code>ResultSet.FETCH_FORWARD</code>
1370 *
1371 * @return one of <code>ResultSet.FETCH_FORWARD</code>,
1372 * <code>ResultSet.FETCH_REVERSE</code>, or
1373 * <code>ResultSet.FETCH_UNKNOWN</code>
1374 * @throws SQLException if an error occurs in determining the
1375 * current fetch direction for fetching rows
1376 * @see #setFetchDirection
1377 */
1378 public int getFetchDirection() throws SQLException {
1379
1380 //Added the following code to throw a
1381 //SQL Exception if the fetchDir is not
1382 //set properly.Bug id:4914155
1383
1384 // This checking is not necessary!
1385
1386 /*
1387 if((fetchDir != ResultSet.FETCH_FORWARD) &&
1388 (fetchDir != ResultSet.FETCH_REVERSE) &&
1389 (fetchDir != ResultSet.FETCH_UNKNOWN)) {
1390 throw new SQLException("Fetch Direction Invalid");
1391 }
1392 */
1393 return (fetchDir);
1394 }
1395
1396 /**
1397 * Sets the fetch size for this <code>RowSet</code> object to the given number of
1398 * rows. The fetch size gives a JDBC technology-enabled driver ("JDBC driver")
1399 * a hint as to the
1400 * number of rows that should be fetched from the database when more rows
1401 * are needed for this <code>RowSet</code> object. If the fetch size specified
1402 * is zero, the driver ignores the value and is free to make its own best guess
1403 * as to what the fetch size should be.
1404 * <P>
1405 * A <code>RowSet</code> object inherits the default properties of the
1406 * <code>ResultSet</code> object from which it got its data. That
1407 * <code>ResultSet</code> object's default fetch size is set by
1408 * the <code>Statement</code> object that created it.
1409 * <P>
1410 * This method applies to a <code>RowSet</code> object only while it is
1411 * connected to a database using a JDBC driver.
1412 * For connected <code>RowSet</code> implementations such as
1413 * <code>JdbcRowSet</code>, this method has a direct and immediate effect
1414 * on the underlying JDBC driver.
1415 * <P>
1416 * A <code>RowSet</code> object may use this method at any time to change
1417 * its setting for the fetch size.
1418 * <p>
1419 * For <code>RowSet</code> implementations such as
1420 * <code>CachedRowSet</code>, which operate in a disconnected environment,
1421 * the <code>SyncProvider</code> object being used
1422 * may leverage the fetch size to poll the data source and
1423 * retrieve a number of rows that do not exceed the fetch size and that may
1424 * form a subset of the actual rows returned by the original query. This is
1425 * an implementation variance determined by the specific <code>SyncProvider</code>
1426 * object employed by the disconnected <code>RowSet</code> object.
1427 * <P>
1428 *
1429 * @param rows the number of rows to fetch; <code>0</code> to let the
1430 * driver decide what the best fetch size is; must not be less
1431 * than <code>0</code> or more than the maximum number of rows
1432 * allowed for this <code>RowSet</code> object (the number returned
1433 * by a call to the method {@link #getMaxRows})
1434 * @throws SQLException if the specified fetch size is less than <code>0</code>
1435 * or more than the limit for the maximum number of rows
1436 * @see #getFetchSize
1437 */
1438 public void setFetchSize(int rows) throws SQLException {
1439 //Added this checking as maxRows can be 0 when this function is called
1440 //maxRows = 0 means rowset can hold any number of rows, os this checking
1441 // is needed to take care of this condition.
1442 if (getMaxRows() == 0 && rows >= 0) {
1443 fetchSize = rows;
1444 return;
1445 }
1446 if ((rows < 0) || (rows > getMaxRows())) {
1447 throw new SQLException(
1448 "Invalid fetch size set. Cannot be of " + "value: "
1449 + rows);
1450 }
1451 fetchSize = rows;
1452 }
1453
1454 /**
1455 * Returns the fetch size for this <code>RowSet</code> object. The default
1456 * value is zero.
1457 *
1458 * @return the number of rows suggested as the fetch size when this <code>RowSet</code> object
1459 * needs more rows from the database
1460 * @throws SQLException if an error occurs determining the number of rows in the
1461 * current fetch size
1462 * @see #setFetchSize
1463 */
1464 public int getFetchSize() throws SQLException {
1465 return fetchSize;
1466 }
1467
1468 /**
1469 * Returns the concurrency for this <code>RowSet</code> object.
1470 * The default is <code>CONCUR_UPDATABLE</code> for both connected and
1471 * disconnected <code>RowSet</code> objects.
1472 * <P>
1473 * An application can call the method <code>setConcurrency</code> at any time
1474 * to change a <code>RowSet</code> object's concurrency.
1475 * <p>
1476 * @return the concurrency type for this <code>RowSet</code>
1477 * object, which must be one of the following:
1478 * <code>ResultSet.CONCUR_READ_ONLY</code> or
1479 * <code>ResultSet.CONCUR_UPDATABLE</code>
1480 * @throws SQLException if an error occurs getting the concurrency
1481 * of this <code>RowSet</code> object
1482 * @see #setConcurrency
1483 * @see #isReadOnly
1484 */
1485 public int getConcurrency() throws SQLException {
1486 return concurrency;
1487 }
1488
1489 //-----------------------------------------------------------------------
1490 // Parameters
1491 //-----------------------------------------------------------------------
1492
1493 /**
1494 * Checks the given index to see whether it is less than <code>1</code> and
1495 * throws an <code>SQLException</code> object if it is.
1496 * <P>
1497 * This method is called by many methods internally; it is never
1498 * called by an application directly.
1499 *
1500 * @param idx an <code>int</code> indicating which parameter is to be
1501 * checked; the first parameter is <code>1</code>
1502 * @throws SQLException if the parameter is less than <code>1</code>
1503 */
1504 private void checkParamIndex(int idx) throws SQLException {
1505 if ((idx < 1)) {
1506 throw new SQLException("Invalid Parameter Index");
1507 }
1508 }
1509
1510 //---------------------------------------------------------------------
1511 // setter methods for setting the parameters in a <code>RowSet</code> object's command
1512 //---------------------------------------------------------------------
1513
1514 /**
1515 * Sets the designated parameter to SQL <code>NULL</code>.
1516 * Note that the parameter's SQL type must be specified using one of the
1517 * type codes defined in <code>java.sql.Types</code>. This SQL type is
1518 * specified in the second parameter.
1519 * <p>
1520 * Note that the second parameter tells the DBMS the data type of the value being
1521 * set to <code>NULL</code>. Some DBMSs require this information, so it is required
1522 * in order to make code more portable.
1523 * <P>
1524 * The parameter value set by this method is stored internally and
1525 * will be supplied as the appropriate parameter in this <code>RowSet</code>
1526 * object's command when the method <code>execute</code> is called.
1527 * Methods such as <code>execute</code> and <code>populate</code> must be
1528 * provided in any class that extends this class and implements one or
1529 * more of the standard JSR-114 <code>RowSet</code> interfaces.
1530 * <P>
1531 * NOTE: <code>JdbcRowSet</code> does not require the <code>populate</code> method
1532 * as it is undefined in this class.
1533 * <P>
1534 * Calls made to the method <code>getParams</code> after this version of
1535 * <code>setNull</code>
1536 * has been called will return an <code>Object</code> array containing the parameter values that
1537 * have been set. In that array, the element that represents the values
1538 * set with this method will itself be an array. The first element of that array
1539 * is <code>null</code>.
1540 * The second element is the value set for <i>sqlType</i>.
1541 * The parameter number is indicated by an element's position in the array
1542 * returned by the method <code>getParams</code>,
1543 * with the first element being the value for the first placeholder parameter, the
1544 * second element being the value for the second placeholder parameter, and so on.
1545 * In other words, if the second placeholder parameter is being set to
1546 * <code>null</code>, the array containing it will be the second element in
1547 * the array returned by <code>getParams</code>.
1548 * <P>
1549 * Note that because the numbering of elements in an array starts at zero,
1550 * the array element that corresponds to placeholder parameter number
1551 * <i>parameterIndex</i> is <i>parameterIndex</i> -1.
1552 *
1553 * @param parameterIndex the ordinal number of the placeholder parameter
1554 * in this <code>RowSet</code> object's command that is to be set.
1555 * The first parameter is 1, the second is 2, and so on; must be
1556 * <code>1</code> or greater
1557 * @param sqlType an <code>int</code> that is one of the SQL type codes
1558 * defined in the class {@link java.sql.Types}. If a non-standard
1559 * <i>sqlType</i> is supplied, this method will not throw a
1560 * <code>SQLException</code>. This allows implicit support for
1561 * non-standard SQL types.
1562 * @throws SQLException if a database access error occurs or the given
1563 * parameter index is out of bounds
1564 * @see #getParams
1565 */
1566 public void setNull(int parameterIndex, int sqlType)
1567 throws SQLException {
1568 Object nullVal[];
1569 checkParamIndex(parameterIndex);
1570
1571 nullVal = new Object[2];
1572 nullVal[0] = null;
1573 nullVal[1] = new Integer(sqlType);
1574
1575 if (params == null) {
1576 throw new SQLException("Set initParams() before setNull");
1577 }
1578
1579 params.put(new Integer(parameterIndex - 1), nullVal);
1580 }
1581
1582 /**
1583 * Sets the designated parameter to SQL <code>NULL</code>.
1584 *
1585 * Although this version of the method <code>setNull</code> is intended
1586 * for user-defined
1587 * and <code>REF</code> parameters, this method may be used to set a null
1588 * parameter for any JDBC type. The following are user-defined types:
1589 * <code>STRUCT</code>, <code>DISTINCT</code>, and <code>JAVA_OBJECT</code>,
1590 * and named array types.
1591 *
1592 * <P><B>Note:</B> To be portable, applications must give the
1593 * SQL type code and the fully qualified SQL type name when specifying
1594 * a <code>NULL</code> user-defined or <code>REF</code> parameter.
1595 * In the case of a user-defined type, the name is the type name of
1596 * the parameter itself. For a <code>REF</code> parameter, the name is
1597 * the type name of the referenced type. If a JDBC technology-enabled
1598 * driver does not need the type code or type name information,
1599 * it may ignore it.
1600 * <P>
1601 * If the parameter does not have a user-defined or <code>REF</code> type,
1602 * the given <code>typeName</code> parameter is ignored.
1603 * <P>
1604 * The parameter value set by this method is stored internally and
1605 * will be supplied as the appropriate parameter in this <code>RowSet</code>
1606 * object's command when the method <code>execute</code> is called.
1607 * Methods such as <code>execute</code> and <code>populate</code> must be
1608 * provided in any class that extends this class and implements one or
1609 * more of the standard JSR-114 <code>RowSet</code> interfaces.
1610 * <P>
1611 * NOTE: <code>JdbcRowSet</code> does not require the <code>populate</code> method
1612 * as it is undefined in this class.
1613 * <P>
1614 * Calls made to the method <code>getParams</code> after this version of
1615 * <code>setNull</code>
1616 * has been called will return an <code>Object</code> array containing the parameter values that
1617 * have been set. In that array, the element that represents the values
1618 * set with this method will itself be an array. The first element of that array
1619 * is <code>null</code>.
1620 * The second element is the value set for <i>sqlType</i>, and the third
1621 * element is the value set for <i>typeName</i>.
1622 * The parameter number is indicated by an element's position in the array
1623 * returned by the method <code>getParams</code>,
1624 * with the first element being the value for the first placeholder parameter, the
1625 * second element being the value for the second placeholder parameter, and so on.
1626 * In other words, if the second placeholder parameter is being set to
1627 * <code>null</code>, the array containing it will be the second element in
1628 * the array returned by <code>getParams</code>.
1629 * <P>
1630 * Note that because the numbering of elements in an array starts at zero,
1631 * the array element that corresponds to placeholder parameter number
1632 * <i>parameterIndex</i> is <i>parameterIndex</i> -1.
1633 *
1634 * @param parameterIndex the ordinal number of the placeholder parameter
1635 * in this <code>RowSet</code> object's command that is to be set.
1636 * The first parameter is 1, the second is 2, and so on; must be
1637 * <code>1</code> or greater
1638 * @param sqlType a value from <code>java.sql.Types</code>
1639 * @param typeName the fully qualified name of an SQL user-defined type,
1640 * which is ignored if the parameter is not a user-defined
1641 * type or <code>REF</code> value
1642 * @throws SQLException if an error occurs or the given parameter index
1643 * is out of bounds
1644 * @see #getParams
1645 */
1646 public void setNull(int parameterIndex, int sqlType, String typeName)
1647 throws SQLException {
1648
1649 Object nullVal[];
1650 checkParamIndex(parameterIndex);
1651
1652 nullVal = new Object[3];
1653 nullVal[0] = null;
1654 nullVal[1] = new Integer(sqlType);
1655 nullVal[2] = new String(typeName);
1656
1657 if (params == null) {
1658 throw new SQLException("Set initParams() before setNull");
1659 }
1660
1661 params.put(new Integer(parameterIndex - 1), nullVal);
1662 }
1663
1664 /**
1665 * Sets the designated parameter to the given <code>boolean</code> in the
1666 * Java programming language. The driver converts this to an SQL
1667 * <code>BIT</code> value when it sends it to the database.
1668 * <P>
1669 * The parameter value set by this method is stored internally and
1670 * will be supplied as the appropriate parameter in this <code>RowSet</code>
1671 * object's command when the method <code>execute</code> is called.
1672 * Methods such as <code>execute</code>, <code>populate</code> must be
1673 * provided in any class that extends this class and implements one or
1674 * more of the standard JSR-114 <code>RowSet</code> interfaces.
1675 * <p>
1676 * NOTE: <code>JdbcRowSet</code> does not require the <code>populate</code> method
1677 * as it is undefined in this class.
1678 *
1679 * @param parameterIndex the ordinal number of the placeholder parameter
1680 * in this <code>RowSet</code> object's command that is to be set.
1681 * The first parameter is 1, the second is 2, and so on; must be
1682 * <code>1</code> or greater
1683 * @param x the parameter value
1684 * @throws SQLException if an error occurs or the
1685 * parameter index is out of bounds
1686 * @see #getParams
1687 */
1688 public void setBoolean(int parameterIndex, boolean x)
1689 throws SQLException {
1690 checkParamIndex(parameterIndex);
1691
1692 if (params == null) {
1693 throw new SQLException("Set initParams() before setNull");
1694 }
1695
1696 params.put(new Integer(parameterIndex - 1), new Boolean(x));
1697 }
1698
1699 /**
1700 * Sets the designated parameter to the given <code>byte</code> in the Java
1701 * programming language. The driver converts this to an SQL
1702 * <code>TINYINT</code> value when it sends it to the database.
1703 * <P>
1704 * The parameter value set by this method is stored internally and
1705 * will be supplied as the appropriate parameter in this <code>RowSet</code>
1706 * object's command when the method <code>execute</code> is called.
1707 * Methods such as <code>execute</code> and <code>populate</code> must be
1708 * provided in any class that extends this class and implements one or
1709 * more of the standard JSR-114 <code>RowSet</code> interfaces.
1710 * <p>
1711 * NOTE: <code>JdbcRowSet</code> does not require the <code>populate</code> method
1712 * as it is undefined in this class.
1713 *
1714 * @param parameterIndex the ordinal number of the placeholder parameter
1715 * in this <code>RowSet</code> object's command that is to be set.
1716 * The first parameter is 1, the second is 2, and so on; must be
1717 * <code>1</code> or greater
1718 * @param x the parameter value
1719 * @throws SQLException if an error occurs or the
1720 * parameter index is out of bounds
1721 * @see #getParams
1722 */
1723 public void setByte(int parameterIndex, byte x) throws SQLException {
1724 checkParamIndex(parameterIndex);
1725
1726 if (params == null) {
1727 throw new SQLException("Set initParams() before setByte");
1728 }
1729
1730 params.put(new Integer(parameterIndex - 1), new Byte(x));
1731 }
1732
1733 /**
1734 * Sets the designated parameter to the given <code>short</code> in the
1735 * Java programming language. The driver converts this to an SQL
1736 * <code>SMALLINT</code> value when it sends it to the database.
1737 * <P>
1738 * The parameter value set by this method is stored internally and
1739 * will be supplied as the appropriate parameter in this <code>RowSet</code>
1740 * object's command when the method <code>execute</code> is called.
1741 * Methods such as <code>execute</code> and <code>populate</code> must be
1742 * provided in any class that extends this class and implements one or
1743 * more of the standard JSR-114 <code>RowSet</code> interfaces.
1744 * <p>
1745 * NOTE: <code>JdbcRowSet</code> does not require the <code>populate</code> method
1746 * as it is undefined in this class.
1747 * <p>
1748 * @param parameterIndex the ordinal number of the placeholder parameter
1749 * in this <code>RowSet</code> object's command that is to be set.
1750 * The first parameter is 1, the second is 2, and so on; must be
1751 * <code>1</code> or greater
1752 * @param x the parameter value
1753 * @throws SQLException if an error occurs or the
1754 * parameter index is out of bounds
1755 * @see #getParams
1756 */
1757 public void setShort(int parameterIndex, short x)
1758 throws SQLException {
1759 checkParamIndex(parameterIndex);
1760
1761 if (params == null) {
1762 throw new SQLException("Set initParams() before setShort");
1763 }
1764
1765 params.put(new Integer(parameterIndex - 1), new Short(x));
1766 }
1767
1768 /**
1769 * Sets the designated parameter to an <code>int</code> in the Java
1770 * programming language. The driver converts this to an SQL
1771 * <code>INTEGER</code> value when it sends it to the database.
1772 * <P>
1773 * The parameter value set by this method is stored internally and
1774 * will be supplied as the appropriate parameter in this <code>RowSet</code>
1775 * object's command when the method <code>execute</code> is called.
1776 * Methods such as <code>execute</code> and <code>populate</code> must be
1777 * provided in any class that extends this class and implements one or
1778 * more of the standard JSR-114 <code>RowSet</code> interfaces.
1779 * <P>
1780 * NOTE: <code>JdbcRowSet</code> does not require the <code>populate</code> method
1781 * as it is undefined in this class.
1782 *
1783 * @param parameterIndex the ordinal number of the placeholder parameter
1784 * in this <code>RowSet</code> object's command that is to be set.
1785 * The first parameter is 1, the second is 2, and so on; must be
1786 * <code>1</code> or greater
1787 * @param x the parameter value
1788 * @throws SQLException if an error occurs or the
1789 * parameter index is out of bounds
1790 * @see #getParams
1791 */
1792 public void setInt(int parameterIndex, int x) throws SQLException {
1793 checkParamIndex(parameterIndex);
1794 if (params == null) {
1795 throw new SQLException("Set initParams() before setInt");
1796 }
1797 params.put(new Integer(parameterIndex - 1), new Integer(x));
1798 }
1799
1800 /**
1801 * Sets the designated parameter to the given <code>long</code> in the Java
1802 * programming language. The driver converts this to an SQL
1803 * <code>BIGINT</code> value when it sends it to the database.
1804 * <P>
1805 * The parameter value set by this method is stored internally and
1806 * will be supplied as the appropriate parameter in this <code>RowSet</code>
1807 * object's command when the method <code>execute</code> is called.
1808 * Methods such as <code>execute</code> and <code>populate</code> must be
1809 * provided in any class that extends this class and implements one or
1810 * more of the standard JSR-114 <code>RowSet</code> interfaces.
1811 * <P>
1812 * NOTE: <code>JdbcRowSet</code> does not require the <code>populate</code> method
1813 * as it is undefined in this class.
1814 *
1815 * @param parameterIndex the ordinal number of the placeholder parameter
1816 * in this <code>RowSet</code> object's command that is to be set.
1817 * The first parameter is 1, the second is 2, and so on; must be
1818 * <code>1</code> or greater
1819 * @param x the parameter value
1820 * @throws SQLException if an error occurs or the
1821 * parameter index is out of bounds
1822 * @see #getParams
1823 */
1824 public void setLong(int parameterIndex, long x) throws SQLException {
1825 checkParamIndex(parameterIndex);
1826 if (params == null) {
1827 throw new SQLException("Set initParams() before setLong");
1828 }
1829 params.put(new Integer(parameterIndex - 1), new Long(x));
1830 }
1831
1832 /**
1833 * Sets the designated parameter to the given <code>float</code> in the
1834 * Java programming language. The driver converts this to an SQL
1835 * <code>FLOAT</code> value when it sends it to the database.
1836 * <P>
1837 * The parameter value set by this method is stored internally and
1838 * will be supplied as the appropriate parameter in this <code>RowSet</code>
1839 * object's command when the method <code>execute</code> is called.
1840 * Methods such as <code>execute</code> and <code>populate</code> must be
1841 * provided in any class that extends this class and implements one or
1842 * more of the standard JSR-114 <code>RowSet</code> interfaces.
1843 * <P>
1844 * NOTE: <code>JdbcRowSet</code> does not require the <code>populate</code> method
1845 * as it is undefined in this class.
1846 *
1847 * @param parameterIndex the ordinal number of the placeholder parameter
1848 * in this <code>RowSet</code> object's command that is to be set.
1849 * The first parameter is 1, the second is 2, and so on; must be
1850 * <code>1</code> or greater
1851 * @param x the parameter value
1852 * @throws SQLException if an error occurs or the
1853 * parameter index is out of bounds
1854 * @see #getParams
1855 */
1856 public void setFloat(int parameterIndex, float x)
1857 throws SQLException {
1858 checkParamIndex(parameterIndex);
1859 if (params == null) {
1860 throw new SQLException("Set initParams() before setFloat");
1861 }
1862 params.put(new Integer(parameterIndex - 1), new Float(x));
1863 }
1864
1865 /**
1866 * Sets the designated parameter to the given <code>double</code> in the
1867 * Java programming language. The driver converts this to an SQL
1868 * <code>DOUBLE</code> value when it sends it to the database.
1869 * <P>
1870 * The parameter value set by this method is stored internally and
1871 * will be supplied as the appropriate parameter in this <code>RowSet</code>
1872 * object's command when the method <code>execute</code> is called.
1873 * Methods such as <code>execute</code> and <code>populate</code> must be
1874 * provided in any class that extends this class and implements one or
1875 * more of the standard JSR-114 <code>RowSet</code> interfaces.
1876 * <P>
1877 * NOTE: <code>JdbcRowSet</code> does not require the <code>populate</code> method
1878 * as it is undefined in this class.
1879 * S
1880 * @param parameterIndex the ordinal number of the placeholder parameter
1881 * in this <code>RowSet</code> object's command that is to be set.
1882 * The first parameter is 1, the second is 2, and so on; must be
1883 * <code>1</code> or greater
1884 * @param x the parameter value
1885 * @throws SQLException if an error occurs or the
1886 * parameter index is out of bounds
1887 * @see #getParams
1888 */
1889 public void setDouble(int parameterIndex, double x)
1890 throws SQLException {
1891 checkParamIndex(parameterIndex);
1892 if (params == null) {
1893 throw new SQLException("Set initParams() before setDouble");
1894 }
1895 params.put(new Integer(parameterIndex - 1), new Double(x));
1896 }
1897
1898 /**
1899 * Sets the designated parameter to the given
1900 * <code>java.lang.BigDecimal</code> value. The driver converts this to
1901 * an SQL <code>NUMERIC</code> value when it sends it to the database.
1902 * <P>
1903 * The parameter value set by this method is stored internally and
1904 * will be supplied as the appropriate parameter in this <code>RowSet</code>
1905 * object's command when the method <code>execute</code> is called.
1906 * Methods such as <code>execute</code> and <code>populate</code> must be
1907 * provided in any class that extends this class and implements one or
1908 * more of the standard JSR-114 <code>RowSet</code> interfaces.
1909 * <P>
1910 * Note: <code>JdbcRowSet</code> does not require the <code>populate</code> method
1911 * as it is undefined in this class.
1912 *
1913 * @param parameterIndex the ordinal number of the placeholder parameter
1914 * in this <code>RowSet</code> object's command that is to be set.
1915 * The first parameter is 1, the second is 2, and so on; must be
1916 * <code>1</code> or greater
1917 * @param x the parameter value
1918 * @throws SQLException if an error occurs or the
1919 * parameter index is out of bounds
1920 * @see #getParams
1921 */
1922 public void setBigDecimal(int parameterIndex, java.math.BigDecimal x)
1923 throws SQLException {
1924 checkParamIndex(parameterIndex);
1925 if (params == null) {
1926 throw new SQLException(
1927 "Set initParams() before setBigDecimal");
1928 }
1929 params.put(new Integer(parameterIndex - 1), x);
1930 }
1931
1932 /**
1933 * Sets the designated parameter to the given <code>String</code>
1934 * value. The driver converts this to an SQL
1935 * <code>VARCHAR</code> or <code>LONGVARCHAR</code> value
1936 * (depending on the argument's size relative to the driver's limits
1937 * on <code>VARCHAR</code> values) when it sends it to the database.
1938 * <P>
1939 * The parameter value set by this method is stored internally and
1940 * will be supplied as the appropriate parameter in this <code>RowSet</code>
1941 * object's command when the method <code>execute</code> is called.
1942 * Methods such as <code>execute</code> and <code>populate</code> must be
1943 * provided in any class that extends this class and implements one or
1944 * more of the standard JSR-114 <code>RowSet</code> interfaces.
1945 * <p>
1946 * NOTE: <code>JdbcRowSet</code> does not require the <code>populate</code> method
1947 * as it is undefined in this class.
1948 * <p>
1949 * @param parameterIndex the ordinal number of the placeholder parameter
1950 * in this <code>RowSet</code> object's command that is to be set.
1951 * The first parameter is 1, the second is 2, and so on; must be
1952 * <code>1</code> or greater
1953 * @param x the parameter value
1954 * @throws SQLException if an error occurs or the
1955 * parameter index is out of bounds
1956 * @see #getParams
1957 */
1958 public void setString(int parameterIndex, String x)
1959 throws SQLException {
1960 checkParamIndex(parameterIndex);
1961 if (params == null) {
1962 throw new SQLException("Set initParams() before setString");
1963 }
1964 params.put(new Integer(parameterIndex - 1), x);
1965 }
1966
1967 /**
1968 * Sets the designated parameter to the given array of bytes.
1969 * The driver converts this to an SQL
1970 * <code>VARBINARY</code> or <code>LONGVARBINARY</code> value
1971 * (depending on the argument's size relative to the driver's limits
1972 * on <code>VARBINARY</code> values) when it sends it to the database.
1973 * <P>
1974 * The parameter value set by this method is stored internally and
1975 * will be supplied as the appropriate parameter in this <code>RowSet</code>
1976 * object's command when the method <code>execute</code> is called.
1977 * Methods such as <code>execute</code> and <code>populate</code> must be
1978 * provided in any class that extends this class and implements one or
1979 * more of the standard JSR-114 <code>RowSet</code> interfaces.
1980 * <p>
1981 * NOTE: <code>JdbcRowSet</code> does not require the <code>populate</code> method
1982 * as it is undefined in this class.
1983 *
1984 * @param parameterIndex the ordinal number of the placeholder parameter
1985 * in this <code>RowSet</code> object's command that is to be set.
1986 * The first parameter is 1, the second is 2, and so on; must be
1987 * <code>1</code> or greater
1988 * @param x the parameter value
1989 * @throws SQLException if an error occurs or the
1990 * parameter index is out of bounds
1991 * @see #getParams
1992 */
1993 public void setBytes(int parameterIndex, byte x[])
1994 throws SQLException {
1995 checkParamIndex(parameterIndex);
1996 if (params == null) {
1997 throw new SQLException("Set initParams() before setBytes");
1998 }
1999 params.put(new Integer(parameterIndex - 1), x);
2000 }
2001
2002 /**
2003 * Sets the designated parameter to the given <code>java.sql.Date</code>
2004 * value. The driver converts this to an SQL
2005 * <code>DATE</code> value when it sends it to the database.
2006 * <P>
2007 * The parameter value set by this method is stored internally and
2008 * will be supplied as the appropriate parameter in this <code>RowSet</code>
2009 * object's command when the method <code>execute</code> is called.
2010 * Methods such as <code>execute</code> and <code>populate</code> must be
2011 * provided in any class that extends this class and implements one or
2012 * more of the standard JSR-114 <code>RowSet</code> interfaces.
2013 * <P>
2014 * NOTE: <code>JdbcRowSet</code> does not require the <code>populate</code> method
2015 * as it is undefined in this class.
2016 * <P>
2017 * Calls made to the method <code>getParams</code> after this version
2018 * of <code>setDate</code>
2019 * has been called will return an array with the value to be set for
2020 * placeholder parameter number <i>parameterIndex</i> being the <code>Date</code>
2021 * object supplied as the second parameter.
2022 * Note that because the numbering of elements in an array starts at zero,
2023 * the array element that corresponds to placeholder parameter number
2024 * <i>parameterIndex</i> is <i>parameterIndex</i> -1.
2025 *
2026 * @param parameterIndex the ordinal number of the placeholder parameter
2027 * in this <code>RowSet</code> object's command that is to be set.
2028 * The first parameter is 1, the second is 2, and so on; must be
2029 * <code>1</code> or greater
2030 * @param x the parameter value
2031 * @throws SQLException if an error occurs or the
2032 * parameter index is out of bounds
2033 * @see #getParams
2034 */
2035 public void setDate(int parameterIndex, java.sql.Date x)
2036 throws SQLException {
2037 checkParamIndex(parameterIndex);
2038
2039 if (params == null) {
2040 throw new SQLException("Set initParams() before setDate");
2041 }
2042 params.put(new Integer(parameterIndex - 1), x);
2043 }
2044
2045 /**
2046 * Sets the designated parameter to the given <code>java.sql.Time</code>
2047 * value. The driver converts this to an SQL <code>TIME</code> value
2048 * when it sends it to the database.
2049 * <P>
2050 * The parameter value set by this method is stored internally and
2051 * will be supplied as the appropriate parameter in this <code>RowSet</code>
2052 * object's command when the method <code>execute</code> is called.
2053 * Methods such as <code>execute</code> and <code>populate</code> must be
2054 * provided in any class that extends this class and implements one or
2055 * more of the standard JSR-114 <code>RowSet</code> interfaces.
2056 * <P>
2057 * NOTE: <code>JdbcRowSet</code> does not require the <code>populate</code> method
2058 * as it is undefined in this class.
2059 * <P>
2060 * Calls made to the method <code>getParams</code> after this version
2061 * of the method <code>setTime</code>
2062 * has been called will return an array of the parameters that have been set.
2063 * The parameter to be set for parameter placeholder number <i>parameterIndex</i>
2064 * will be the <code>Time</code> object that was set as the second parameter
2065 * to this method.
2066 * <P>
2067 * Note that because the numbering of elements in an array starts at zero,
2068 * the array element that corresponds to placeholder parameter number
2069 * <i>parameterIndex</i> is <i>parameterIndex</i> -1.
2070 *
2071 * @param parameterIndex the ordinal number of the placeholder parameter
2072 * in this <code>RowSet</code> object's command that is to be set.
2073 * The first parameter is 1, the second is 2, and so on; must be
2074 * <code>1</code> or greater
2075 * @param x a <code>java.sql.Time</code> object, which is to be set as the value
2076 * for placeholder parameter <i>parameterIndex</i>
2077 * @throws SQLException if an error occurs or the
2078 * parameter index is out of bounds
2079 * @see #getParams
2080 */
2081 public void setTime(int parameterIndex, java.sql.Time x)
2082 throws SQLException {
2083 checkParamIndex(parameterIndex);
2084 if (params == null) {
2085 throw new SQLException("Set initParams() before setTime");
2086 }
2087
2088 params.put(new Integer(parameterIndex - 1), x);
2089 }
2090
2091 /**
2092 * Sets the designated parameter to the given
2093 * <code>java.sql.Timestamp</code> value.
2094 * The driver converts this to an SQL <code>TIMESTAMP</code> value when it
2095 * sends it to the database.
2096 * <P>
2097 * The parameter value set by this method is stored internally and
2098 * will be supplied as the appropriate parameter in this <code>RowSet</code>
2099 * object's command when the method <code>execute</code> is called.
2100 * Methods such as <code>execute</code> and <code>populate</code> must be
2101 * provided in any class that extends this class and implements one or
2102 * more of the standard JSR-114 <code>RowSet</code> interfaces.
2103 * <P>
2104 * NOTE: <code>JdbcRowSet</code> does not require the <code>populate</code> method
2105 * as it is undefined in this class.
2106 * <P>
2107 * Calls made to the method <code>getParams</code> after this version of
2108 * <code>setTimestamp</code>
2109 * has been called will return an array with the value for parameter placeholder
2110 * number <i>parameterIndex</i> being the <code>Timestamp</code> object that was
2111 * supplied as the second parameter to this method.
2112 * Note that because the numbering of elements in an array starts at zero,
2113 * the array element that corresponds to placeholder parameter number
2114 * <i>parameterIndex</i> is <i>parameterIndex</i> -1.
2115 *
2116 * @param parameterIndex the ordinal number of the placeholder parameter
2117 * in this <code>RowSet</code> object's command that is to be set.
2118 * The first parameter is 1, the second is 2, and so on; must be
2119 * <code>1</code> or greater
2120 * @param x a <code>java.sql.Timestamp</code> object
2121 * @throws SQLException if an error occurs or the
2122 * parameter index is out of bounds
2123 * @see #getParams
2124 */
2125 public void setTimestamp(int parameterIndex, java.sql.Timestamp x)
2126 throws SQLException {
2127 checkParamIndex(parameterIndex);
2128 if (params == null) {
2129 throw new SQLException(
2130 "Set initParams() before setTimestamp");
2131 }
2132
2133 params.put(new Integer(parameterIndex - 1), x);
2134 }
2135
2136 /**
2137 * Sets the designated parameter to the given
2138 * <code>java.io.InputStream</code> object,
2139 * which will have the specified number of bytes.
2140 * The contents of the stream will be read and sent to the database.
2141 * This method throws an <code>SQLException</code> object if the number of bytes
2142 * read and sent to the database is not equal to <i>length</i>.
2143 * <P>
2144 * When a very large ASCII value is input to a <code>LONGVARCHAR</code>
2145 * parameter, it may be more practical to send it via a
2146 * <code>java.io.InputStream</code> object. A JDBC technology-enabled
2147 * driver will read the data from the stream as needed until it reaches
2148 * end-of-file. The driver will do any necessary conversion from ASCII to
2149 * the database <code>CHAR</code> format.
2150 *
2151 * <P><B>Note:</B> This stream object can be either a standard
2152 * Java stream object or your own subclass that implements the
2153 * standard interface.
2154 * <P>
2155 * The parameter value set by this method is stored internally and
2156 * will be supplied as the appropriate parameter in this <code>RowSet</code>
2157 * object's command when the method <code>execute</code> is called.
2158 * Methods such as <code>execute</code> and <code>populate</code> must be
2159 * provided in any class that extends this class and implements one or
2160 * more of the standard JSR-114 <code>RowSet</code> interfaces.
2161 * <P>
2162 * Note: <code>JdbcRowSet</code> does not require the <code>populate</code> method
2163 * as it is undefined in this class.
2164 * <P>
2165 * Calls made to the method <code>getParams</code> after <code>setAsciiStream</code>
2166 * has been called will return an array containing the parameter values that
2167 * have been set. The element in the array that represents the values
2168 * set with this method will itself be an array. The first element of that array
2169 * is the given <code>java.io.InputStream</code> object.
2170 * The second element is the value set for <i>length</i>.
2171 * The third element is an internal <code>BaseRowSet</code> constant
2172 * specifying that the stream passed to this method is an ASCII stream.
2173 * The parameter number is indicated by an element's position in the array
2174 * returned by the method <code>getParams</code>,
2175 * with the first element being the value for the first placeholder parameter, the
2176 * second element being the value for the second placeholder parameter, and so on.
2177 * In other words, if the input stream being set is the value for the second
2178 * placeholder parameter, the array containing it will be the second element in
2179 * the array returned by <code>getParams</code>.
2180 * <P>
2181 * Note that because the numbering of elements in an array starts at zero,
2182 * the array element that corresponds to placeholder parameter number
2183 * <i>parameterIndex</i> is element number <i>parameterIndex</i> -1.
2184 *
2185 * @param parameterIndex the ordinal number of the placeholder parameter
2186 * in this <code>RowSet</code> object's command that is to be set.
2187 * The first parameter is 1, the second is 2, and so on; must be
2188 * <code>1</code> or greater
2189 * @param x the Java input stream that contains the ASCII parameter value
2190 * @param length the number of bytes in the stream. This is the number of bytes
2191 * the driver will send to the DBMS; lengths of 0 or less are
2192 * are undefined but will cause an invalid length exception to be
2193 * thrown in the underlying JDBC driver.
2194 * @throws SQLException if an error occurs, the parameter index is out of bounds,
2195 * or when connected to a data source, the number of bytes the driver reads
2196 * and sends to the database is not equal to the number of bytes specified
2197 * in <i>length</i>
2198 * @see #getParams
2199 */
2200 public void setAsciiStream(int parameterIndex,
2201 java.io.InputStream x, int length) throws SQLException {
2202 Object asciiStream[];
2203 checkParamIndex(parameterIndex);
2204
2205 asciiStream = new Object[3];
2206 asciiStream[0] = x;
2207 asciiStream[1] = new Integer(length);
2208 asciiStream[2] = new Integer(ASCII_STREAM_PARAM);
2209
2210 if (params == null) {
2211 throw new SQLException(
2212 "Set initParams() before setAsciiStream");
2213 }
2214
2215 params.put(new Integer(parameterIndex - 1), asciiStream);
2216 }
2217
2218 /**
2219 * Sets the designated parameter in this <code>RowSet</code> object's command
2220 * to the given input stream.
2221 * When a very large ASCII value is input to a <code>LONGVARCHAR</code>
2222 * parameter, it may be more practical to send it via a
2223 * <code>java.io.InputStream</code>. Data will be read from the stream
2224 * as needed until end-of-file is reached. The JDBC driver will
2225 * do any necessary conversion from ASCII to the database char format.
2226 *
2227 * <P><B>Note:</B> This stream object can either be a standard
2228 * Java stream object or your own subclass that implements the
2229 * standard interface.
2230 * <P><B>Note:</B> Consult your JDBC driver documentation to determine if
2231 * it might be more efficient to use a version of
2232 * <code>setAsciiStream</code> which takes a length parameter.
2233 *
2234 * @param parameterIndex the first parameter is 1, the second is 2, ...
2235 * @param x the Java input stream that contains the ASCII parameter value
2236 * @exception SQLException if a database access error occurs or
2237 * this method is called on a closed <code>PreparedStatement</code>
2238 * @throws SQLFeatureNotSupportedException if the JDBC driver does not support this method
2239 * @since 1.6
2240 */
2241 public void setAsciiStream(int parameterIndex, java.io.InputStream x)
2242 throws SQLException {
2243 throw new SQLFeatureNotSupportedException(
2244 "Feature not supported");
2245 }
2246
2247 /**
2248 * Sets the designated parameter to the given <code>java.io.InputStream</code>
2249 * object, which will have the specified number of bytes.
2250 * The contents of the stream will be read and sent to the database.
2251 * This method throws an <code>SQLException</code> object if the number of bytes
2252 * read and sent to the database is not equal to <i>length</i>.
2253 * <P>
2254 * When a very large binary value is input to a
2255 * <code>LONGVARBINARY</code> parameter, it may be more practical
2256 * to send it via a <code>java.io.InputStream</code> object.
2257 * A JDBC technology-enabled driver will read the data from the
2258 * stream as needed until it reaches end-of-file.
2259 *
2260 * <P><B>Note:</B> This stream object can be either a standard
2261 * Java stream object or your own subclass that implements the
2262 * standard interface.
2263 * <P>
2264 * The parameter value set by this method is stored internally and
2265 * will be supplied as the appropriate parameter in this <code>RowSet</code>
2266 * object's command when the method <code>execute</code> is called.
2267 * Methods such as <code>execute</code> and <code>populate</code> must be
2268 * provided in any class that extends this class and implements one or
2269 * more of the standard JSR-114 <code>RowSet</code> interfaces.
2270 *<P>
2271 * NOTE: <code>JdbcRowSet</code> does not require the <code>populate</code> method
2272 * as it is undefined in this class.
2273 * <P>
2274 * Calls made to the method <code>getParams</code> after <code>setBinaryStream</code>
2275 * has been called will return an array containing the parameter values that
2276 * have been set. In that array, the element that represents the values
2277 * set with this method will itself be an array. The first element of that array
2278 * is the given <code>java.io.InputStream</code> object.
2279 * The second element is the value set for <i>length</i>.
2280 * The third element is an internal <code>BaseRowSet</code> constant
2281 * specifying that the stream passed to this method is a binary stream.
2282 * The parameter number is indicated by an element's position in the array
2283 * returned by the method <code>getParams</code>,
2284 * with the first element being the value for the first placeholder parameter, the
2285 * second element being the value for the second placeholder parameter, and so on.
2286 * In other words, if the input stream being set is the value for the second
2287 * placeholder parameter, the array containing it will be the second element in
2288 * the array returned by <code>getParams</code>.
2289 * <P>
2290 * Note that because the numbering of elements in an array starts at zero,
2291 * the array element that corresponds to placeholder parameter number
2292 * <i>parameterIndex</i> is element number <i>parameterIndex</i> -1.
2293 *
2294 * @param parameterIndex the ordinal number of the placeholder parameter
2295 * in this <code>RowSet</code> object's command that is to be set.
2296 * The first parameter is 1, the second is 2, and so on; must be
2297 * <code>1</code> or greater
2298 * @param x the input stream that contains the binary value to be set
2299 * @param length the number of bytes in the stream; lengths of 0 or less are
2300 * are undefined but will cause an invalid length exception to be
2301 * thrown in the underlying JDBC driver.
2302 * @throws SQLException if an error occurs, the parameter index is out of bounds,
2303 * or when connected to a data source, the number of bytes the driver
2304 * reads and sends to the database is not equal to the number of bytes
2305 * specified in <i>length</i>
2306 * @see #getParams
2307 */
2308 public void setBinaryStream(int parameterIndex,
2309 java.io.InputStream x, int length) throws SQLException {
2310 Object binaryStream[];
2311 checkParamIndex(parameterIndex);
2312
2313 binaryStream = new Object[3];
2314 binaryStream[0] = x;
2315 binaryStream[1] = new Integer(length);
2316 binaryStream[2] = new Integer(BINARY_STREAM_PARAM);
2317 if (params == null) {
2318 throw new SQLException(
2319 "Set initParams() before setBinaryStream");
2320 }
2321
2322 params.put(new Integer(parameterIndex - 1), binaryStream);
2323 }
2324
2325 /**
2326 * Sets the designated parameter in this <code>RowSet</code> object's command
2327 * to the given input stream.
2328 * When a very large binary value is input to a <code>LONGVARBINARY</code>
2329 * parameter, it may be more practical to send it via a
2330 * <code>java.io.InputStream</code> object. The data will be read from the
2331 * stream as needed until end-of-file is reached.
2332 *
2333 * <P><B>Note:</B> This stream object can either be a standard
2334 * Java stream object or your own subclass that implements the
2335 * standard interface.
2336 * <P><B>Note:</B> Consult your JDBC driver documentation to determine if
2337 * it might be more efficient to use a version of
2338 * <code>setBinaryStream</code> which takes a length parameter.
2339 *
2340 * @param parameterIndex the first parameter is 1, the second is 2, ...
2341 * @param x the java input stream which contains the binary parameter value
2342 * @exception SQLException if a database access error occurs or
2343 * this method is called on a closed <code>PreparedStatement</code>
2344 * @throws SQLFeatureNotSupportedException if the JDBC driver does not support this method
2345 * @since 1.6
2346 */
2347 public void setBinaryStream(int parameterIndex,
2348 java.io.InputStream x) throws SQLException {
2349 throw new SQLFeatureNotSupportedException(
2350 "Feature not supported");
2351 }
2352
2353 /**
2354 * Sets the designated parameter to the given
2355 * <code>java.io.InputStream</code> object, which will have the specified
2356 * number of bytes. The contents of the stream will be read and sent
2357 * to the database.
2358 * This method throws an <code>SQLException</code> if the number of bytes
2359 * read and sent to the database is not equal to <i>length</i>.
2360 * <P>
2361 * When a very large Unicode value is input to a
2362 * <code>LONGVARCHAR</code> parameter, it may be more practical
2363 * to send it via a <code>java.io.InputStream</code> object.
2364 * A JDBC technology-enabled driver will read the data from the
2365 * stream as needed, until it reaches end-of-file.
2366 * The driver will do any necessary conversion from Unicode to the
2367 * database <code>CHAR</code> format.
2368 * The byte format of the Unicode stream must be Java UTF-8, as
2369 * defined in the Java Virtual Machine Specification.
2370 *
2371 * <P><B>Note:</B> This stream object can be either a standard
2372 * Java stream object or your own subclass that implements the
2373 * standard interface.
2374 * <P>
2375 * This method is deprecated; the method <code>getCharacterStream</code>
2376 * should be used in its place.
2377 * <P>
2378 * The parameter value set by this method is stored internally and
2379 * will be supplied as the appropriate parameter in this <code>RowSet</code>
2380 * object's command when the method <code>execute</code> is called.
2381 * Calls made to the method <code>getParams</code> after <code>setUnicodeStream</code>
2382 * has been called will return an array containing the parameter values that
2383 * have been set. In that array, the element that represents the values
2384 * set with this method will itself be an array. The first element of that array
2385 * is the given <code>java.io.InputStream</code> object.
2386 * The second element is the value set for <i>length</i>.
2387 * The third element is an internal <code>BaseRowSet</code> constant
2388 * specifying that the stream passed to this method is a Unicode stream.
2389 * The parameter number is indicated by an element's position in the array
2390 * returned by the method <code>getParams</code>,
2391 * with the first element being the value for the first placeholder parameter, the
2392 * second element being the value for the second placeholder parameter, and so on.
2393 * In other words, if the input stream being set is the value for the second
2394 * placeholder parameter, the array containing it will be the second element in
2395 * the array returned by <code>getParams</code>.
2396 * <P>
2397 * Note that because the numbering of elements in an array starts at zero,
2398 * the array element that corresponds to placeholder parameter number
2399 * <i>parameterIndex</i> is element number <i>parameterIndex</i> -1.
2400 *
2401 * @param parameterIndex the ordinal number of the placeholder parameter
2402 * in this <code>RowSet</code> object's command that is to be set.
2403 * The first parameter is 1, the second is 2, and so on; must be
2404 * <code>1</code> or greater
2405 * @param x the <code>java.io.InputStream</code> object that contains the
2406 * UNICODE parameter value
2407 * @param length the number of bytes in the input stream
2408 * @throws SQLException if an error occurs, the parameter index is out of bounds,
2409 * or the number of bytes the driver reads and sends to the database is
2410 * not equal to the number of bytes specified in <i>length</i>
2411 * @deprecated getCharacterStream should be used in its place
2412 * @see #getParams
2413 */
2414
2415 public void setUnicodeStream(int parameterIndex,
2416 java.io.InputStream x, int length) throws SQLException {
2417 Object unicodeStream[];
2418 checkParamIndex(parameterIndex);
2419
2420 unicodeStream = new Object[3];
2421 unicodeStream[0] = x;
2422 unicodeStream[1] = new Integer(length);
2423 unicodeStream[2] = new Integer(UNICODE_STREAM_PARAM);
2424 if (params == null) {
2425 throw new SQLException(
2426 "Set initParams() before setUnicodeStream");
2427 }
2428 params.put(new Integer(parameterIndex - 1), unicodeStream);
2429 }
2430
2431 /**
2432 * Sets the designated parameter to the given <code>java.io.Reader</code>
2433 * object, which will have the specified number of characters. The
2434 * contents of the reader will be read and sent to the database.
2435 * This method throws an <code>SQLException</code> if the number of bytes
2436 * read and sent to the database is not equal to <i>length</i>.
2437 * <P>
2438 * When a very large Unicode value is input to a
2439 * <code>LONGVARCHAR</code> parameter, it may be more practical
2440 * to send it via a <code>Reader</code> object.
2441 * A JDBC technology-enabled driver will read the data from the
2442 * stream as needed until it reaches end-of-file.
2443 * The driver will do any necessary conversion from Unicode to the
2444 * database <code>CHAR</code> format.
2445 * The byte format of the Unicode stream must be Java UTF-8, as
2446 * defined in the Java Virtual Machine Specification.
2447 *
2448 * <P><B>Note:</B> This stream object can be either a standard
2449 * Java stream object or your own subclass that implements the
2450 * standard interface.
2451 * <P>
2452 * The parameter value set by this method is stored internally and
2453 * will be supplied as the appropriate parameter in this <code>RowSet</code>
2454 * object's command when the method <code>execute</code> is called.
2455 * Methods such as <code>execute</code> and <code>populate</code> must be
2456 * provided in any class that extends this class and implements one or
2457 * more of the standard JSR-114 <code>RowSet</code> interfaces.
2458 * <P>
2459 * NOTE: <code>JdbcRowSet</code> does not require the <code>populate</code> method
2460 * as it is undefined in this class.
2461 * <P>
2462 * Calls made to the method <code>getParams</code> after
2463 * <code>setCharacterStream</code>
2464 * has been called will return an array containing the parameter values that
2465 * have been set. In that array, the element that represents the values
2466 * set with this method will itself be an array. The first element of that array
2467 * is the given <code>java.io.Reader</code> object.
2468 * The second element is the value set for <i>length</i>.
2469 * The parameter number is indicated by an element's position in the array
2470 * returned by the method <code>getParams</code>,
2471 * with the first element being the value for the first placeholder parameter, the
2472 * second element being the value for the second placeholder parameter, and so on.
2473 * In other words, if the reader being set is the value for the second
2474 * placeholder parameter, the array containing it will be the second element in
2475 * the array returned by <code>getParams</code>.
2476 * <P>
2477 * Note that because the numbering of elements in an array starts at zero,
2478 * the array element that corresponds to placeholder parameter number
2479 * <i>parameterIndex</i> is element number <i>parameterIndex</i> -1.
2480 *
2481 * @param parameterIndex the ordinal number of the placeholder parameter
2482 * in this <code>RowSet</code> object's command that is to be set.
2483 * The first parameter is 1, the second is 2, and so on; must be
2484 * <code>1</code> or greater
2485 * @param reader the <code>Reader</code> object that contains the
2486 * Unicode data
2487 * @param length the number of characters in the stream; lengths of 0 or
2488 * less are undefined but will cause an invalid length exception to
2489 * be thrown in the underlying JDBC driver.
2490 * @throws SQLException if an error occurs, the parameter index is out of bounds,
2491 * or when connected to a data source, the number of bytes the driver
2492 * reads and sends to the database is not equal to the number of bytes
2493 * specified in <i>length</i>
2494 * @see #getParams
2495 */
2496 public void setCharacterStream(int parameterIndex, Reader reader,
2497 int length) throws SQLException {
2498 Object charStream[];
2499 checkParamIndex(parameterIndex);
2500
2501 charStream = new Object[2];
2502 charStream[0] = reader;
2503 charStream[1] = new Integer(length);
2504 if (params == null) {
2505 throw new SQLException(
2506 "Set initParams() before setCharacterStream");
2507 }
2508 params.put(new Integer(parameterIndex - 1), charStream);
2509 }
2510
2511 /**
2512 * Sets the designated parameter in this <code>RowSet</code> object's command
2513 * to the given <code>Reader</code>
2514 * object.
2515 * When a very large UNICODE value is input to a <code>LONGVARCHAR</code>
2516 * parameter, it may be more practical to send it via a
2517 * <code>java.io.Reader</code> object. The data will be read from the stream
2518 * as needed until end-of-file is reached. The JDBC driver will
2519 * do any necessary conversion from UNICODE to the database char format.
2520 *
2521 * <P><B>Note:</B> This stream object can either be a standard
2522 * Java stream object or your own subclass that implements the
2523 * standard interface.
2524 * <P><B>Note:</B> Consult your JDBC driver documentation to determine if
2525 * it might be more efficient to use a version of
2526 * <code>setCharacterStream</code> which takes a length parameter.
2527 *
2528 * @param parameterIndex the first parameter is 1, the second is 2, ...
2529 * @param reader the <code>java.io.Reader</code> object that contains the
2530 * Unicode data
2531 * @exception SQLException if a database access error occurs or
2532 * this method is called on a closed <code>PreparedStatement</code>
2533 * @throws SQLFeatureNotSupportedException if the JDBC driver does not support this method
2534 * @since 1.6
2535 */
2536 public void setCharacterStream(int parameterIndex,
2537 java.io.Reader reader) throws SQLException {
2538 throw new SQLFeatureNotSupportedException(
2539 "Feature not supported");
2540 }
2541
2542 /**
2543 * Sets the designated parameter to an <code>Object</code> in the Java
2544 * programming language. The second parameter must be an
2545 * <code>Object</code> type. For integral values, the
2546 * <code>java.lang</code> equivalent
2547 * objects should be used. For example, use the class <code>Integer</code>
2548 * for an <code>int</code>.
2549 * <P>
2550 * The driver converts this object to the specified
2551 * target SQL type before sending it to the database.
2552 * If the object has a custom mapping (is of a class implementing
2553 * <code>SQLData</code>), the driver should call the method
2554 * <code>SQLData.writeSQL</code> to write the object to the SQL
2555 * data stream. If, on the other hand, the object is of a class
2556 * implementing <code>Ref</code>, <code>Blob</code>, <code>Clob</code>,
2557 * <code>Struct</code>, or <code>Array</code>,
2558 * the driver should pass it to the database as a value of the
2559 * corresponding SQL type.
2560 * <P>
2561 * <p>Note that this method may be used to pass database-
2562 * specific abstract data types.
2563 * <P>
2564 * The parameter value set by this method is stored internally and
2565 * will be supplied as the appropriate parameter in this <code>RowSet</code
2566 * object's command when the method <code>execute</code> is called.
2567 * Methods such as <code>execute</code> and <code>populate</code> must be
2568 * provided in any class that extends this class and implements one or
2569 * more of the standard JSR-114 <code>RowSet</code> interfaces.
2570 * <P>
2571 * NOTE: <code>JdbcRowSet</code> does not require the <code>populate</code> method
2572 * as it is undefined in this class.
2573 * <P>
2574 * Calls made to the method <code>getParams</code> after this version of
2575 * <code>setObject</code>
2576 * has been called will return an array containing the parameter values that
2577 * have been set. In that array, the element that represents the values
2578 * set with this method will itself be an array. The first element of that array
2579 * is the given <code>Object</code> instance, and the
2580 * second element is the value set for <i>targetSqlType</i>. The
2581 * third element is the value set for <i>scale</i>, which the driver will
2582 * ignore if the type of the object being set is not
2583 * <code>java.sql.Types.NUMERIC</code> or <code>java.sql.Types.DECIMAL</code>.
2584 * The parameter number is indicated by an element's position in the array
2585 * returned by the method <code>getParams</code>,
2586 * with the first element being the value for the first placeholder parameter, the
2587 * second element being the value for the second placeholder parameter, and so on.
2588 * In other words, if the object being set is the value for the second
2589 * placeholder parameter, the array containing it will be the second element in
2590 * the array returned by <code>getParams</code>.
2591 *<P>
2592 * Note that because the numbering of elements in an array starts at zero,
2593 * the array element that corresponds to placeholder parameter number
2594 * <i>parameterIndex</i> is element number <i>parameterIndex</i> -1.
2595 *
2596 *
2597 * @param parameterIndex the ordinal number of the placeholder parameter
2598 * in this <code>RowSet</code> object's command that is to be set.
2599 * The first parameter is 1, the second is 2, and so on; must be
2600 * <code>1</code> or greater
2601 * @param x the <code>Object</code> containing the input parameter value;
2602 * must be an <code>Object</code> type
2603 * @param targetSqlType the SQL type (as defined in <code>java.sql.Types</code>)
2604 * to be sent to the database. The <code>scale</code> argument may
2605 * further qualify this type. If a non-standard <i>targetSqlType</i>
2606 * is supplied, this method will not throw a <code>SQLException</code>.
2607 * This allows implicit support for non-standard SQL types.
2608 * @param scale for the types <code>java.sql.Types.DECIMAL</code> and
2609 * <code>java.sql.Types.NUMERIC</code>, this is the number
2610 * of digits after the decimal point. For all other types, this
2611 * value will be ignored.
2612 * @throws SQLException if an error occurs or the parameter index is out of bounds
2613 * @see #getParams
2614 */
2615 public void setObject(int parameterIndex, Object x,
2616 int targetSqlType, int scale) throws SQLException {
2617 Object obj[];
2618 checkParamIndex(parameterIndex);
2619
2620 obj = new Object[3];
2621 obj[0] = x;
2622 obj[1] = new Integer(targetSqlType);
2623 obj[2] = new Integer(scale);
2624 if (params == null) {
2625 throw new SQLException("Set initParams() before setObject");
2626 }
2627 params.put(new Integer(parameterIndex - 1), obj);
2628 }
2629
2630 /**
2631 * Sets the value of the designated parameter with the given
2632 * <code>Object</code> value.
2633 * This method is like <code>setObject(int parameterIndex, Object x, int
2634 * targetSqlType, int scale)</code> except that it assumes a scale of zero.
2635 * <P>
2636 * The parameter value set by this method is stored internally and
2637 * will be supplied as the appropriate parameter in this <code>RowSet</code>
2638 * object's command when the method <code>execute</code> is called.
2639 * Methods such as <code>execute</code> and <code>populate</code> must be
2640 * provided in any class that extends this class and implements one or
2641 * more of the standard JSR-114 <code>RowSet</code> interfaces.
2642 * <P>
2643 * NOTE: <code>JdbcRowSet</code> does not require the <code>populate</code> method
2644 * as it is undefined in this class.
2645 * <P>
2646 * Calls made to the method <code>getParams</code> after this version of
2647 * <code>setObject</code>
2648 * has been called will return an array containing the parameter values that
2649 * have been set. In that array, the element that represents the values
2650 * set with this method will itself be an array. The first element of that array
2651 * is the given <code>Object</code> instance.
2652 * The second element is the value set for <i>targetSqlType</i>.
2653 * The parameter number is indicated by an element's position in the array
2654 * returned by the method <code>getParams</code>,
2655 * with the first element being the value for the first placeholder parameter, the
2656 * second element being the value for the second placeholder parameter, and so on.
2657 * In other words, if the object being set is the value for the second
2658 * placeholder parameter, the array containing it will be the second element in
2659 * the array returned by <code>getParams</code>.
2660 * <P>
2661 * Note that because the numbering of elements in an array starts at zero,
2662 * the array element that corresponds to placeholder parameter number
2663 * <i>parameterIndex</i> is element number <i>parameterIndex</i> -1.
2664 *
2665 * @param parameterIndex the ordinal number of the placeholder parameter
2666 * in this <code>RowSet</code> object's command that is to be set.
2667 * The first parameter is 1, the second is 2, and so on; must be
2668 * <code>1</code> or greater
2669 * @param x the <code>Object</code> containing the input parameter value;
2670 * must be an <code>Object</code> type
2671 * @param targetSqlType the SQL type (as defined in <code>java.sql.Types</code>)
2672 * to be sent to the database. If a non-standard <i>targetSqlType</i>
2673 * is supplied, this method will not throw a <code>SQLException</code>.
2674 * This allows implicit support for non-standard SQL types.
2675 * @throws SQLException if an error occurs or the parameter index
2676 * is out of bounds
2677 * @see #getParams
2678 */
2679 public void setObject(int parameterIndex, Object x,
2680 int targetSqlType) throws SQLException {
2681 Object obj[];
2682 checkParamIndex(parameterIndex);
2683
2684 obj = new Object[2];
2685 obj[0] = x;
2686 obj[1] = new Integer(targetSqlType);
2687 if (params == null) {
2688 throw new SQLException("Set initParams() before setObject");
2689 }
2690 params.put(new Integer(parameterIndex - 1), obj);
2691 }
2692
2693 /**
2694 * Sets the designated parameter to an <code>Object</code> in the Java
2695 * programming language. The second parameter must be an
2696 * <code>Object</code>
2697 * type. For integral values, the <code>java.lang</code> equivalent
2698 * objects should be used. For example, use the class <code>Integer</code>
2699 * for an <code>int</code>.
2700 * <P>
2701 * The JDBC specification defines a standard mapping from
2702 * Java <code>Object</code> types to SQL types. The driver will
2703 * use this standard mapping to convert the given object
2704 * to its corresponding SQL type before sending it to the database.
2705 * If the object has a custom mapping (is of a class implementing
2706 * <code>SQLData</code>), the driver should call the method
2707 * <code>SQLData.writeSQL</code> to write the object to the SQL
2708 * data stream.
2709 * <P>
2710 * If, on the other hand, the object is of a class
2711 * implementing <code>Ref</code>, <code>Blob</code>, <code>Clob</code>,
2712 * <code>Struct</code>, or <code>Array</code>,
2713 * the driver should pass it to the database as a value of the
2714 * corresponding SQL type.
2715 * <P>
2716 * This method throws an exception if there
2717 * is an ambiguity, for example, if the object is of a class
2718 * implementing more than one interface.
2719 * <P>
2720 * Note that this method may be used to pass database-specific
2721 * abstract data types.
2722 * <P>
2723 * The parameter value set by this method is stored internally and
2724 * will be supplied as the appropriate parameter in this <code>RowSet</code>
2725 * object's command when the method <code>execute</code> is called.
2726 * Methods such as <code>execute</code> and <code>populate</code> must be
2727 * provided in any class that extends this class and implements one or
2728 * more of the standard JSR-114 <code>RowSet</code> interfaces.
2729 * <p>
2730 * NOTE: <code>JdbcRowSet</code> does not require the <code>populate</code> method
2731 * as it is undefined in this class.
2732 * <P>
2733 * After this method has been called, a call to the
2734 * method <code>getParams</code>
2735 * will return an object array of the current command parameters, which will
2736 * include the <code>Object</code> set for placeholder parameter number
2737 * <code>parameterIndex</code>.
2738 * Note that because the numbering of elements in an array starts at zero,
2739 * the array element that corresponds to placeholder parameter number
2740 * <i>parameterIndex</i> is element number <i>parameterIndex</i> -1.
2741 *
2742 * @param parameterIndex the ordinal number of the placeholder parameter
2743 * in this <code>RowSet</code> object's command that is to be set.
2744 * The first parameter is 1, the second is 2, and so on; must be
2745 * <code>1</code> or greater
2746 * @param x the object containing the input parameter value
2747 * @throws SQLException if an error occurs the
2748 * parameter index is out of bounds, or there
2749 * is ambiguity in the implementation of the
2750 * object being set
2751 * @see #getParams
2752 */
2753 public void setObject(int parameterIndex, Object x)
2754 throws SQLException {
2755 checkParamIndex(parameterIndex);
2756 if (params == null) {
2757 throw new SQLException("Set initParams() before setObject");
2758 }
2759 params.put(new Integer(parameterIndex - 1), x);
2760 }
2761
2762 /**
2763 * Sets the designated parameter to the given <code>Ref</code> object in
2764 * the Java programming language. The driver converts this to an SQL
2765 * <code>REF</code> value when it sends it to the database. Internally, the
2766 * <code>Ref</code> is represented as a <code>SerialRef</code> to ensure
2767 * serializability.
2768 * <P>
2769 * The parameter value set by this method is stored internally and
2770 * will be supplied as the appropriate parameter in this <code>RowSet</code>
2771 * object's command when the method <code>execute</code> is called.
2772 * Methods such as <code>execute</code> and <code>populate</code> must be
2773 * provided in any class that extends this class and implements one or
2774 * more of the standard JSR-114 <code>RowSet</code> interfaces.
2775 * <p>
2776 * NOTE: <code>JdbcRowSet</code> does not require the <code>populate</code> method
2777 * as it is undefined in this class.
2778 * <p>
2779 * After this method has been called, a call to the
2780 * method <code>getParams</code>
2781 * will return an object array of the current command parameters, which will
2782 * include the <code>Ref</code> object set for placeholder parameter number
2783 * <code>parameterIndex</code>.
2784 * Note that because the numbering of elements in an array starts at zero,
2785 * the array element that corresponds to placeholder parameter number
2786 * <i>parameterIndex</i> is element number <i>parameterIndex</i> -1.
2787 *
2788 * @param parameterIndex the ordinal number of the placeholder parameter
2789 * in this <code>RowSet</code> object's command that is to be set.
2790 * The first parameter is 1, the second is 2, and so on; must be
2791 * <code>1</code> or greater
2792 * @param ref a <code>Ref</code> object representing an SQL <code>REF</code>
2793 * value; cannot be null
2794 * @throws SQLException if an error occurs; the parameter index is out of
2795 * bounds or the <code>Ref</code> object is <code>null</code>; or
2796 * the <code>Ref</code> object returns a <code>null</code> base type
2797 * name.
2798 * @see #getParams
2799 * @see javax.sql.rowset.serial.SerialRef
2800 */
2801 public void setRef(int parameterIndex, Ref ref) throws SQLException {
2802 checkParamIndex(parameterIndex);
2803 if (params == null) {
2804 throw new SQLException("Set initParams() before setRef");
2805 }
2806 params.put(new Integer(parameterIndex - 1), new SerialRef(ref));
2807 }
2808
2809 /**
2810 * Sets the designated parameter to the given <code>Blob</code> object in
2811 * the Java programming language. The driver converts this to an SQL
2812 * <code>BLOB</code> value when it sends it to the database. Internally,
2813 * the <code>Blob</code> is represented as a <code>SerialBlob</code>
2814 * to ensure serializability.
2815 * <P>
2816 * The parameter value set by this method is stored internally and
2817 * will be supplied as the appropriate parameter in this <code>RowSet</code>
2818 * object's command when the method <code>execute</code> is called.
2819 * Methods such as <code>execute</code> and <code>populate</code> must be
2820 * provided in any class that extends this class and implements one or
2821 * more of the standard JSR-114 <code>RowSet</code> interfaces.
2822 * NOTE: <code>JdbcRowSet</code> does not require the <code>populate</code> method
2823 * as it is undefined in this class.
2824 * <p>
2825 * After this method has been called, a call to the
2826 * method <code>getParams</code>
2827 * will return an object array of the current command parameters, which will
2828 * include the <code>Blob</code> object set for placeholder parameter number
2829 * <code>parameterIndex</code>.
2830 * Note that because the numbering of elements in an array starts at zero,
2831 * the array element that corresponds to placeholder parameter number
2832 * <i>parameterIndex</i> is element number <i>parameterIndex</i> -1.
2833 *
2834 * @param parameterIndex the ordinal number of the placeholder parameter
2835 * in this <code>RowSet</code> object's command that is to be set.
2836 * The first parameter is 1, the second is 2, and so on; must be
2837 * <code>1</code> or greater
2838 * @param x a <code>Blob</code> object representing an SQL
2839 * <code>BLOB</code> value
2840 * @throws SQLException if an error occurs or the
2841 * parameter index is out of bounds
2842 * @see #getParams
2843 * @see javax.sql.rowset.serial.SerialBlob
2844 */
2845 public void setBlob(int parameterIndex, Blob x) throws SQLException {
2846 checkParamIndex(parameterIndex);
2847 if (params == null) {
2848 throw new SQLException("Set initParams() before setBlob");
2849 }
2850 params.put(new Integer(parameterIndex - 1), new SerialBlob(x));
2851 }
2852
2853 /**
2854 * Sets the designated parameter to the given <code>Clob</code> object in
2855 * the Java programming language. The driver converts this to an SQL
2856 * <code>CLOB</code> value when it sends it to the database. Internally, the
2857 * <code>Clob</code> is represented as a <code>SerialClob</code> to ensure
2858 * serializability.
2859 * <P>
2860 * The parameter value set by this method is stored internally and
2861 * will be supplied as the appropriate parameter in this <code>RowSet</code>
2862 * object's command when the method <code>execute</code> is called.
2863 * Methods such as <code>execute</code> and <code>populate</code> must be
2864 * provided in any class that extends this class and implements one or
2865 * more of the standard JSR-114 <code>RowSet</code> interfaces.
2866 * <p>
2867 * NOTE: <code>JdbcRowSet</code> does not require the <code>populate</code> method
2868 * as it is undefined in this class.
2869 * <p>
2870 * After this method has been called, a call to the
2871 * method <code>getParams</code>
2872 * will return an object array of the current command parameters, which will
2873 * include the <code>Clob</code> object set for placeholder parameter number
2874 * <code>parameterIndex</code>.
2875 * Note that because the numbering of elements in an array starts at zero,
2876 * the array element that corresponds to placeholder parameter number
2877 * <i>parameterIndex</i> is element number <i>parameterIndex</i> -1.
2878 *
2879 * @param parameterIndex the ordinal number of the placeholder parameter
2880 * in this <code>RowSet</code> object's command that is to be set.
2881 * The first parameter is 1, the second is 2, and so on; must be
2882 * <code>1</code> or greater
2883 * @param x a <code>Clob</code> object representing an SQL
2884 * <code>CLOB</code> value; cannot be null
2885 * @throws SQLException if an error occurs; the parameter index is out of
2886 * bounds or the <code>Clob</code> is null
2887 * @see #getParams
2888 * @see javax.sql.rowset.serial.SerialBlob
2889 */
2890 public void setClob(int parameterIndex, Clob x) throws SQLException {
2891 checkParamIndex(parameterIndex);
2892 if (params == null) {
2893 throw new SQLException("Set initParams() before setClob");
2894 }
2895 params.put(new Integer(parameterIndex - 1), new SerialClob(x));
2896 }
2897
2898 /**
2899 * Sets the designated parameter to an <code>Array</code> object in the
2900 * Java programming language. The driver converts this to an SQL
2901 * <code>ARRAY</code> value when it sends it to the database. Internally,
2902 * the <code>Array</code> is represented as a <code>SerialArray</code>
2903 * to ensure serializability.
2904 * <P>
2905 * The parameter value set by this method is stored internally and
2906 * will be supplied as the appropriate parameter in this <code>RowSet</code>
2907 * object's command when the method <code>execute</code> is called.
2908 * Methods such as <code>execute</code> and <code>populate</code> must be
2909 * provided in any class that extends this class and implements one or
2910 * more of the standard JSR-114 <code>RowSet</code> interfaces.
2911 * <P>
2912 * Note: <code>JdbcRowSet</code> does not require the <code>populate</code> method
2913 * as it is undefined in this class.
2914 * <p>
2915 * After this method has been called, a call to the
2916 * method <code>getParams</code>
2917 * will return an object array of the current command parameters, which will
2918 * include the <code>Array</code> object set for placeholder parameter number
2919 * <code>parameterIndex</code>.
2920 * Note that because the numbering of elements in an array starts at zero,
2921 * the array element that corresponds to placeholder parameter number
2922 * <i>parameterIndex</i> is element number <i>parameterIndex</i> -1.
2923 *
2924 * @param parameterIndex the ordinal number of the placeholder parameter
2925 * in this <code>RowSet</code> object's command that is to be set.
2926 * The first parameter is 1, the second is 2, and so on; must be
2927 * <code>1</code> or greater
2928 * @param array an <code>Array</code> object representing an SQL
2929 * <code>ARRAY</code> value; cannot be null. The <code>Array</code> object
2930 * passed to this method must return a non-null Object for all
2931 * <code>getArray()</code> method calls. A null value will cause a
2932 * <code>SQLException</code> to be thrown.
2933 * @throws SQLException if an error occurs; the parameter index is out of
2934 * bounds or the <code>ARRAY</code> is null
2935 * @see #getParams
2936 * @see javax.sql.rowset.serial.SerialArray
2937 */
2938 public void setArray(int parameterIndex, Array array)
2939 throws SQLException {
2940 checkParamIndex(parameterIndex);
2941 if (params == null) {
2942 throw new SQLException("Set initParams() before setArray");
2943 }
2944 params.put(new Integer(parameterIndex - 1), new SerialArray(
2945 array));
2946 }
2947
2948 /**
2949 * Sets the designated parameter to the given <code>java.sql.Date</code>
2950 * object.
2951 * When the DBMS does not store time zone information, the driver will use
2952 * the given <code>Calendar</code> object to construct the SQL <code>DATE</code>
2953 * value to send to the database. With a
2954 * <code>Calendar</code> object, the driver can calculate the date
2955 * taking into account a custom time zone. If no <code>Calendar</code>
2956 * object is specified, the driver uses the time zone of the Virtual Machine
2957 * that is running the application.
2958 * <P>
2959 * The parameter value set by this method is stored internally and
2960 * will be supplied as the appropriate parameter in this <code>RowSet</code>
2961 * object's command when the method <code>execute</code> is called.
2962 * Methods such as <code>execute</code> and <code>populate</code> must be
2963 * provided in any class that extends this class and implements one or
2964 * more of the standard JSR-114 <code>RowSet</code> interfaces.
2965 * <P>
2966 * NOTE: <code>JdbcRowSet</code> does not require the <code>populate</code> method
2967 * as it is undefined in this class.
2968 * <P>
2969 * Calls made to the method <code>getParams</code> after this version of
2970 * <code>setDate</code>
2971 * has been called will return an array containing the parameter values that
2972 * have been set. In that array, the element that represents the values
2973 * set with this method will itself be an array. The first element of that array
2974 * is the given <code>java.sql.Date</code> object.
2975 * The second element is the value set for <i>cal</i>.
2976 * The parameter number is indicated by an element's position in the array
2977 * returned by the method <code>getParams</code>,
2978 * with the first element being the value for the first placeholder parameter, the
2979 * second element being the value for the second placeholder parameter, and so on.
2980 * In other words, if the date being set is the value for the second
2981 * placeholder parameter, the array containing it will be the second element in
2982 * the array returned by <code>getParams</code>.
2983 * <P>
2984 * Note that because the numbering of elements in an array starts at zero,
2985 * the array element that corresponds to placeholder parameter number
2986 * <i>parameterIndex</i> is <i>parameterIndex</i> -1.
2987 *
2988 * @param parameterIndex the ordinal number of the placeholder parameter
2989 * in this <code>RowSet</code> object's command that is to be set.
2990 * The first parameter is 1, the second is 2, and so on; must be
2991 * <code>1</code> or greater
2992 * @param x a <code>java.sql.Date</code> object representing an SQL
2993 * <code>DATE</code> value
2994 * @param cal a <code>java.util.Calendar</code> object to use when
2995 * when constructing the date
2996 * @throws SQLException if an error occurs or the
2997 * parameter index is out of bounds
2998 * @see #getParams
2999 */
3000 public void setDate(int parameterIndex, java.sql.Date x,
3001 Calendar cal) throws SQLException {
3002 Object date[];
3003 checkParamIndex(parameterIndex);
3004
3005 date = new Object[2];
3006 date[0] = x;
3007 date[1] = cal;
3008 if (params == null) {
3009 throw new SQLException("Set initParams() before setDate");
3010 }
3011 params.put(new Integer(parameterIndex - 1), date);
3012 }
3013
3014 /**
3015 * Sets the designated parameter to the given <code>java.sql.Time</code>
3016 * object. The driver converts this
3017 * to an SQL <code>TIME</code> value when it sends it to the database.
3018 * <P>
3019 * When the DBMS does not store time zone information, the driver will use
3020 * the given <code>Calendar</code> object to construct the SQL <code>TIME</code>
3021 * value to send to the database. With a
3022 * <code>Calendar</code> object, the driver can calculate the date
3023 * taking into account a custom time zone. If no <code>Calendar</code>
3024 * object is specified, the driver uses the time zone of the Virtual Machine
3025 * that is running the application.
3026 * <P>
3027 * The parameter value set by this method is stored internally and
3028 * will be supplied as the appropriate parameter in this <code>RowSet</code>
3029 * object's command when the method <code>execute</code> is called.
3030 * Methods such as <code>execute</code> and <code>populate</code> must be
3031 * provided in any class that extends this class and implements one or
3032 * more of the standard JSR-114 <code>RowSet</code> interfaces.
3033 * <P>
3034 * NOTE: <code>JdbcRowSet</code> does not require the <code>populate</code> method
3035 * as it is undefined in this class.
3036 * <P>
3037 * Calls made to the method <code>getParams</code> after this version of
3038 * <code>setTime</code>
3039 * has been called will return an array containing the parameter values that
3040 * have been set. In that array, the element that represents the values
3041 * set with this method will itself be an array. The first element of that array
3042 * is the given <code>java.sql.Time</code> object.
3043 * The second element is the value set for <i>cal</i>.
3044 * The parameter number is indicated by an element's position in the array
3045 * returned by the method <code>getParams</code>,
3046 * with the first element being the value for the first placeholder parameter, the
3047 * second element being the value for the second placeholder parameter, and so on.
3048 * In other words, if the time being set is the value for the second
3049 * placeholder parameter, the array containing it will be the second element in
3050 * the array returned by <code>getParams</code>.
3051 * <P>
3052 * Note that because the numbering of elements in an array starts at zero,
3053 * the array element that corresponds to placeholder parameter number
3054 * <i>parameterIndex</i> is <i>parameterIndex</i> -1.
3055 *
3056 * @param parameterIndex the ordinal number of the placeholder parameter
3057 * in this <code>RowSet</code> object's command that is to be set.
3058 * The first parameter is 1, the second is 2, and so on; must be
3059 * <code>1</code> or greater
3060 * @param x a <code>java.sql.Time</code> object
3061 * @param cal the <code>java.util.Calendar</code> object the driver can use to
3062 * construct the time
3063 * @throws SQLException if an error occurs or the
3064 * parameter index is out of bounds
3065 * @see #getParams
3066 */
3067 public void setTime(int parameterIndex, java.sql.Time x,
3068 Calendar cal) throws SQLException {
3069 Object time[];
3070 checkParamIndex(parameterIndex);
3071
3072 time = new Object[2];
3073 time[0] = x;
3074 time[1] = cal;
3075 if (params == null) {
3076 throw new SQLException("Set initParams() before setTime");
3077 }
3078 params.put(new Integer(parameterIndex - 1), time);
3079 }
3080
3081 /**
3082 * Sets the designated parameter to the given
3083 * <code>java.sql.Timestamp</code> object. The driver converts this
3084 * to an SQL <code>TIMESTAMP</code> value when it sends it to the database.
3085 * <P>
3086 * When the DBMS does not store time zone information, the driver will use
3087 * the given <code>Calendar</code> object to construct the SQL <code>TIMESTAMP</code>
3088 * value to send to the database. With a
3089 * <code>Calendar</code> object, the driver can calculate the timestamp
3090 * taking into account a custom time zone. If no <code>Calendar</code>
3091 * object is specified, the driver uses the time zone of the Virtual Machine
3092 * that is running the application.
3093 * <P>
3094 * The parameter value set by this method is stored internally and
3095 * will be supplied as the appropriate parameter in this <code>RowSet</code>
3096 * object's command when the method <code>execute</code> is called.
3097 * Methods such as <code>execute</code> and <code>populate</code> must be
3098 * provided in any class that extends this class and implements one or
3099 * more of the standard JSR-114 <code>RowSet</code> interfaces.
3100 * <P>
3101 * NOTE: <code>JdbcRowSet</code> does not require the <code>populate</code> method
3102 * as it is undefined in this class.
3103 * <P>
3104 * Calls made to the method <code>getParams</code> after this version of
3105 * <code>setTimestamp</code>
3106 * has been called will return an array containing the parameter values that
3107 * have been set. In that array, the element that represents the values
3108 * set with this method will itself be an array. The first element of that array
3109 * is the given <code>java.sql.Timestamp</code> object.
3110 * The second element is the value set for <i>cal</i>.
3111 * The parameter number is indicated by an element's position in the array
3112 * returned by the method <code>getParams</code>,
3113 * with the first element being the value for the first placeholder parameter, the
3114 * second element being the value for the second placeholder parameter, and so on.
3115 * In other words, if the timestamp being set is the value for the second
3116 * placeholder parameter, the array containing it will be the second element in
3117 * the array returned by <code>getParams</code>.
3118 * <P>
3119 * Note that because the numbering of elements in an array starts at zero,
3120 * the array element that corresponds to placeholder parameter number
3121 * <i>parameterIndex</i> is <i>parameterIndex</i> -1.
3122 *
3123 * @param parameterIndex the ordinal number of the placeholder parameter
3124 * in this <code>RowSet</code> object's command that is to be set.
3125 * The first parameter is 1, the second is 2, and so on; must be
3126 * <code>1</code> or greater
3127 * @param x a <code>java.sql.Timestamp</code> object
3128 * @param cal the <code>java.util.Calendar</code> object the driver can use to
3129 * construct the timestamp
3130 * @throws SQLException if an error occurs or the
3131 * parameter index is out of bounds
3132 * @see #getParams
3133 */
3134 public void setTimestamp(int parameterIndex, java.sql.Timestamp x,
3135 Calendar cal) throws SQLException {
3136 Object timestamp[];
3137 checkParamIndex(parameterIndex);
3138
3139 timestamp = new Object[2];
3140 timestamp[0] = x;
3141 timestamp[1] = cal;
3142 if (params == null) {
3143 throw new SQLException(
3144 "Set initParams() before setTimestamp");
3145 }
3146 params.put(new Integer(parameterIndex - 1), timestamp);
3147 }
3148
3149 /**
3150 * Clears all of the current parameter values in this <code>RowSet</code>
3151 * object's internal representation of the parameters to be set in
3152 * this <code>RowSet</code> object's command when it is executed.
3153 * <P>
3154 * In general, parameter values remain in force for repeated use in
3155 * this <code>RowSet</code> object's command. Setting a parameter value with the
3156 * setter methods automatically clears the value of the
3157 * designated parameter and replaces it with the new specified value.
3158 * <P>
3159 * This method is called internally by the <code>setCommand</code>
3160 * method to clear all of the parameters set for the previous command.
3161 * <P>
3162 * Furthermore, this method differs from the <code>initParams</code>
3163 * method in that it maintains the schema of the <code>RowSet</code> object.
3164 *
3165 * @throws SQLException if an error occurs clearing the parameters
3166 */
3167 public void clearParameters() throws SQLException {
3168 params.clear();
3169 }
3170
3171 /**
3172 * Retrieves an array containing the parameter values (both Objects and
3173 * primitives) that have been set for this
3174 * <code>RowSet</code> object's command and throws an <code>SQLException</code> object
3175 * if all parameters have not been set. Before the command is sent to the
3176 * DBMS to be executed, these parameters will be substituted
3177 * for placeholder parameters in the <code>PreparedStatement</code> object
3178 * that is the command for a <code>RowSet</code> implementation extending
3179 * the <code>BaseRowSet</code> class.
3180 * <P>
3181 * Each element in the array that is returned is an <code>Object</code> instance
3182 * that contains the values of the parameters supplied to a setter method.
3183 * The order of the elements is determined by the value supplied for
3184 * <i>parameterIndex</i>. If the setter method takes only the parameter index
3185 * and the value to be set (possibly null), the array element will contain the value to be set
3186 * (which will be expressed as an <code>Object</code>). If there are additional
3187 * parameters, the array element will itself be an array containing the value to be set
3188 * plus any additional parameter values supplied to the setter method. If the method
3189 * sets a stream, the array element includes the type of stream being supplied to the
3190 * method. These additional parameters are for the use of the driver or the DBMS and may or
3191 * may not be used.
3192 * <P>
3193 * NOTE: Stored parameter values of types <code>Array</code>, <code>Blob</code>,
3194 * <code>Clob</code> and <code>Ref</code> are returned as <code>SerialArray</code>,
3195 * <code>SerialBlob</code>, <code>SerialClob</code> and <code>SerialRef</code>
3196 * respectively.
3197 *
3198 * @return an array of <code>Object</code> instances that includes the
3199 * parameter values that may be set in this <code>RowSet</code> object's
3200 * command; an empty array if no parameters have been set
3201 * @throws SQLException if an error occurs retrieveing the object array of
3202 * parameters of this <code>RowSet</code> object or if not all parameters have
3203 * been set
3204 */
3205 public Object[] getParams() throws SQLException {
3206 if (params == null) {
3207
3208 initParams();
3209 Object[] paramsArray = new Object[params.size()];
3210 return paramsArray;
3211
3212 } else {
3213 // The parameters may be set in random order
3214 // but all must be set, check to verify all
3215 // have been set till the last parameter
3216 // else throw exception.
3217
3218 Object[] paramsArray = new Object[params.size()];
3219 for (int i = 0; i < params.size(); i++) {
3220 paramsArray[i] = params.get(new Integer(i));
3221 if (paramsArray[i] == null) {
3222 throw new SQLException("missing parameter: "
3223 + (i + 1));
3224 } //end if
3225 } //end for
3226 return paramsArray;
3227
3228 } //end if
3229
3230 } //end getParams
3231
3232 /**
3233 * Sets the designated parameter to SQL <code>NULL</code>.
3234 *
3235 * <P><B>Note:</B> You must specify the parameter's SQL type.
3236 *
3237 * @param parameterName the name of the parameter
3238 * @param sqlType the SQL type code defined in <code>java.sql.Types</code>
3239 * @exception SQLException if a database access error occurs or
3240 * this method is called on a closed <code>CallableStatement</code>
3241 * @exception SQLFeatureNotSupportedException if the JDBC driver does not support
3242 * this method
3243 * @since 1.4
3244 */
3245 public void setNull(String parameterName, int sqlType)
3246 throws SQLException {
3247 throw new SQLFeatureNotSupportedException(
3248 "Feature not supported");
3249 }
3250
3251 /**
3252 * Sets the designated parameter to SQL <code>NULL</code>.
3253 * This version of the method <code>setNull</code> should
3254 * be used for user-defined types and REF type parameters. Examples
3255 * of user-defined types include: STRUCT, DISTINCT, JAVA_OBJECT, and
3256 * named array types.
3257 *
3258 * <P><B>Note:</B> To be portable, applications must give the
3259 * SQL type code and the fully-qualified SQL type name when specifying
3260 * a NULL user-defined or REF parameter. In the case of a user-defined type
3261 * the name is the type name of the parameter itself. For a REF
3262 * parameter, the name is the type name of the referenced type. If
3263 * a JDBC driver does not need the type code or type name information,
3264 * it may ignore it.
3265 *
3266 * Although it is intended for user-defined and Ref parameters,
3267 * this method may be used to set a null parameter of any JDBC type.
3268 * If the parameter does not have a user-defined or REF type, the given
3269 * typeName is ignored.
3270 *
3271 *
3272 * @param parameterName the name of the parameter
3273 * @param sqlType a value from <code>java.sql.Types</code>
3274 * @param typeName the fully-qualified name of an SQL user-defined type;
3275 * ignored if the parameter is not a user-defined type or
3276 * SQL <code>REF</code> value
3277 * @exception SQLException if a database access error occurs or
3278 * this method is called on a closed <code>CallableStatement</code>
3279 * @exception SQLFeatureNotSupportedException if the JDBC driver does not support
3280 * this method
3281 * @since 1.4
3282 */
3283 public void setNull(String parameterName, int sqlType,
3284 String typeName) throws SQLException {
3285 throw new SQLFeatureNotSupportedException(
3286 "Feature not supported");
3287 }
3288
3289 /**
3290 * Sets the designated parameter to the given Java <code>boolean</code> value.
3291 * The driver converts this
3292 * to an SQL <code>BIT</code> or <code>BOOLEAN</code> value when it sends it to the database.
3293 *
3294 * @param parameterName the name of the parameter
3295 * @param x the parameter value
3296 * @exception SQLException if a database access error occurs or
3297 * this method is called on a closed <code>CallableStatement</code>
3298 * @see #getBoolean
3299 * @exception SQLFeatureNotSupportedException if the JDBC driver does not support
3300 * this method
3301 * @since 1.4
3302 */
3303 public void setBoolean(String parameterName, boolean x)
3304 throws SQLException {
3305 throw new SQLFeatureNotSupportedException(
3306 "Feature not supported");
3307 }
3308
3309 /**
3310 * Sets the designated parameter to the given Java <code>byte</code> value.
3311 * The driver converts this
3312 * to an SQL <code>TINYINT</code> value when it sends it to the database.
3313 *
3314 * @param parameterName the name of the parameter
3315 * @param x the parameter value
3316 * @exception SQLException if a database access error occurs or
3317 * this method is called on a closed <code>CallableStatement</code>
3318 * @exception SQLFeatureNotSupportedException if the JDBC driver does not support
3319 * this method
3320 * @see #getByte
3321 * @since 1.4
3322 */
3323 public void setByte(String parameterName, byte x)
3324 throws SQLException {
3325 throw new SQLFeatureNotSupportedException(
3326 "Feature not supported");
3327 }
3328
3329 /**
3330 * Sets the designated parameter to the given Java <code>short</code> value.
3331 * The driver converts this
3332 * to an SQL <code>SMALLINT</code> value when it sends it to the database.
3333 *
3334 * @param parameterName the name of the parameter
3335 * @param x the parameter value
3336 * @exception SQLException if a database access error occurs or
3337 * this method is called on a closed <code>CallableStatement</code>
3338 * @exception SQLFeatureNotSupportedException if the JDBC driver does not support
3339 * this method
3340 * @see #getShort
3341 * @since 1.4
3342 */
3343 public void setShort(String parameterName, short x)
3344 throws SQLException {
3345 throw new SQLFeatureNotSupportedException(
3346 "Feature not supported");
3347 }
3348
3349 /**
3350 * Sets the designated parameter to the given Java <code>int</code> value.
3351 * The driver converts this
3352 * to an SQL <code>INTEGER</code> value when it sends it to the database.
3353 *
3354 * @param parameterName the name of the parameter
3355 * @param x the parameter value
3356 * @exception SQLException if a database access error occurs or
3357 * this method is called on a closed <code>CallableStatement</code>
3358 * @exception SQLFeatureNotSupportedException if the JDBC driver does not support
3359 * this method
3360 * @see #getInt
3361 * @since 1.4
3362 */
3363 public void setInt(String parameterName, int x) throws SQLException {
3364 throw new SQLFeatureNotSupportedException(
3365 "Feature not supported");
3366 }
3367
3368 /**
3369 * Sets the designated parameter to the given Java <code>long</code> value.
3370 * The driver converts this
3371 * to an SQL <code>BIGINT</code> value when it sends it to the database.
3372 *
3373 * @param parameterName the name of the parameter
3374 * @param x the parameter value
3375 * @exception SQLException if a database access error occurs or
3376 * this method is called on a closed <code>CallableStatement</code>
3377 * @exception SQLFeatureNotSupportedException if the JDBC driver does not support
3378 * this method
3379 * @see #getLong
3380 * @since 1.4
3381 */
3382 public void setLong(String parameterName, long x)
3383 throws SQLException {
3384 throw new SQLFeatureNotSupportedException(
3385 "Feature not supported");
3386 }
3387
3388 /**
3389 * Sets the designated parameter to the given Java <code>float</code> value.
3390 * The driver converts this
3391 * to an SQL <code>FLOAT</code> value when it sends it to the database.
3392 *
3393 * @param parameterName the name of the parameter
3394 * @param x the parameter value
3395 * @exception SQLException if a database access error occurs or
3396 * this method is called on a closed <code>CallableStatement</code>
3397 * @exception SQLFeatureNotSupportedException if the JDBC driver does not support
3398 * this method
3399 * @see #getFloat
3400 * @since 1.4
3401 */
3402 public void setFloat(String parameterName, float x)
3403 throws SQLException {
3404 throw new SQLFeatureNotSupportedException(
3405 "Feature not supported");
3406 }
3407
3408 /**
3409 * Sets the designated parameter to the given Java <code>double</code> value.
3410 * The driver converts this
3411 * to an SQL <code>DOUBLE</code> value when it sends it to the database.
3412 *
3413 * @param parameterName the name of the parameter
3414 * @param x the parameter value
3415 * @exception SQLException if a database access error occurs or
3416 * this method is called on a closed <code>CallableStatement</code>
3417 * @exception SQLFeatureNotSupportedException if the JDBC driver does not support
3418 * this method
3419 * @see #getDouble
3420 * @since 1.4
3421 */
3422 public void setDouble(String parameterName, double x)
3423 throws SQLException {
3424 throw new SQLFeatureNotSupportedException(
3425 "Feature not supported");
3426 }
3427
3428 /**
3429 * Sets the designated parameter to the given
3430 * <code>java.math.BigDecimal</code> value.
3431 * The driver converts this to an SQL <code>NUMERIC</code> value when
3432 * it sends it to the database.
3433 *
3434 * @param parameterName the name of the parameter
3435 * @param x the parameter value
3436 * @exception SQLException if a database access error occurs or
3437 * this method is called on a closed <code>CallableStatement</code>
3438 * @exception SQLFeatureNotSupportedException if the JDBC driver does not support
3439 * this method
3440 * @see #getBigDecimal
3441 * @since 1.4
3442 */
3443 public void setBigDecimal(String parameterName, BigDecimal x)
3444 throws SQLException {
3445 throw new SQLFeatureNotSupportedException(
3446 "Feature not supported");
3447 }
3448
3449 /**
3450 * Sets the designated parameter to the given Java <code>String</code> value.
3451 * The driver converts this
3452 * to an SQL <code>VARCHAR</code> or <code>LONGVARCHAR</code> value
3453 * (depending on the argument's
3454 * size relative to the driver's limits on <code>VARCHAR</code> values)
3455 * when it sends it to the database.
3456 *
3457 * @param parameterName the name of the parameter
3458 * @param x the parameter value
3459 * @exception SQLException if a database access error occurs or
3460 * this method is called on a closed <code>CallableStatement</code>
3461 * @exception SQLFeatureNotSupportedException if the JDBC driver does not support
3462 * this method
3463 * @see #getString
3464 * @since 1.4
3465 */
3466 public void setString(String parameterName, String x)
3467 throws SQLException {
3468 throw new SQLFeatureNotSupportedException(
3469 "Feature not supported");
3470 }
3471
3472 /**
3473 * Sets the designated parameter to the given Java array of bytes.
3474 * The driver converts this to an SQL <code>VARBINARY</code> or
3475 * <code>LONGVARBINARY</code> (depending on the argument's size relative
3476 * to the driver's limits on <code>VARBINARY</code> values) when it sends
3477 * it to the database.
3478 *
3479 * @param parameterName the name of the parameter
3480 * @param x the parameter value
3481 * @exception SQLException if a database access error occurs or
3482 * this method is called on a closed <code>CallableStatement</code>
3483 * @exception SQLFeatureNotSupportedException if the JDBC driver does not support
3484 * this method
3485 * @see #getBytes
3486 * @since 1.4
3487 */
3488 public void setBytes(String parameterName, byte x[])
3489 throws SQLException {
3490 throw new SQLFeatureNotSupportedException(
3491 "Feature not supported");
3492 }
3493
3494 /**
3495 * Sets the designated parameter to the given <code>java.sql.Timestamp</code> value.
3496 * The driver
3497 * converts this to an SQL <code>TIMESTAMP</code> value when it sends it to the
3498 * database.
3499 *
3500 * @param parameterName the name of the parameter
3501 * @param x the parameter value
3502 * @exception SQLException if a database access error occurs or
3503 * this method is called on a closed <code>CallableStatement</code>
3504 * @exception SQLFeatureNotSupportedException if the JDBC driver does not support
3505 * this method
3506 * @see #getTimestamp
3507 * @since 1.4
3508 */
3509 public void setTimestamp(String parameterName, java.sql.Timestamp x)
3510 throws SQLException {
3511 throw new SQLFeatureNotSupportedException(
3512 "Feature not supported");
3513 }
3514
3515 /**
3516 * Sets the designated parameter to the given input stream, which will have
3517 * the specified number of bytes.
3518 * When a very large ASCII value is input to a <code>LONGVARCHAR</code>
3519 * parameter, it may be more practical to send it via a
3520 * <code>java.io.InputStream</code>. Data will be read from the stream
3521 * as needed until end-of-file is reached. The JDBC driver will
3522 * do any necessary conversion from ASCII to the database char format.
3523 *
3524 * <P><B>Note:</B> This stream object can either be a standard
3525 * Java stream object or your own subclass that implements the
3526 * standard interface.
3527 *
3528 * @param parameterName the name of the parameter
3529 * @param x the Java input stream that contains the ASCII parameter value
3530 * @param length the number of bytes in the stream
3531 * @exception SQLException if a database access error occurs or
3532 * this method is called on a closed <code>CallableStatement</code>
3533 * @exception SQLFeatureNotSupportedException if the JDBC driver does not support
3534 * this method
3535 * @since 1.4
3536 */
3537 public void setAsciiStream(String parameterName,
3538 java.io.InputStream x, int length) throws SQLException {
3539 throw new SQLFeatureNotSupportedException(
3540 "Feature not supported");
3541 }
3542
3543 /**
3544 * Sets the designated parameter to the given input stream, which will have
3545 * the specified number of bytes.
3546 * When a very large binary value is input to a <code>LONGVARBINARY</code>
3547 * parameter, it may be more practical to send it via a
3548 * <code>java.io.InputStream</code> object. The data will be read from the stream
3549 * as needed until end-of-file is reached.
3550 *
3551 * <P><B>Note:</B> This stream object can either be a standard
3552 * Java stream object or your own subclass that implements the
3553 * standard interface.
3554 *
3555 * @param parameterName the name of the parameter
3556 * @param x the java input stream which contains the binary parameter value
3557 * @param length the number of bytes in the stream
3558 * @exception SQLException if a database access error occurs or
3559 * this method is called on a closed <code>CallableStatement</code>
3560 * @exception SQLFeatureNotSupportedException if the JDBC driver does not support
3561 * this method
3562 * @since 1.4
3563 */
3564 public void setBinaryStream(String parameterName,
3565 java.io.InputStream x, int length) throws SQLException {
3566 throw new SQLFeatureNotSupportedException(
3567 "Feature not supported");
3568 }
3569
3570 /**
3571 * Sets the designated parameter to the given <code>Reader</code>
3572 * object, which is the given number of characters long.
3573 * When a very large UNICODE value is input to a <code>LONGVARCHAR</code>
3574 * parameter, it may be more practical to send it via a
3575 * <code>java.io.Reader</code> object. The data will be read from the stream
3576 * as needed until end-of-file is reached. The JDBC driver will
3577 * do any necessary conversion from UNICODE to the database char format.
3578 *
3579 * <P><B>Note:</B> This stream object can either be a standard
3580 * Java stream object or your own subclass that implements the
3581 * standard interface.
3582 *
3583 * @param parameterName the name of the parameter
3584 * @param reader the <code>java.io.Reader</code> object that
3585 * contains the UNICODE data used as the designated parameter
3586 * @param length the number of characters in the stream
3587 * @exception SQLException if a database access error occurs or
3588 * this method is called on a closed <code>CallableStatement</code>
3589 * @exception SQLFeatureNotSupportedException if the JDBC driver does not support
3590 * this method
3591 * @since 1.4
3592 */
3593 public void setCharacterStream(String parameterName,
3594 java.io.Reader reader, int length) throws SQLException {
3595 throw new SQLFeatureNotSupportedException(
3596 "Feature not supported");
3597 }
3598
3599 /**
3600 * Sets the designated parameter to the given input stream.
3601 * When a very large ASCII value is input to a <code>LONGVARCHAR</code>
3602 * parameter, it may be more practical to send it via a
3603 * <code>java.io.InputStream</code>. Data will be read from the stream
3604 * as needed until end-of-file is reached. The JDBC driver will
3605 * do any necessary conversion from ASCII to the database char format.
3606 *
3607 * <P><B>Note:</B> This stream object can either be a standard
3608 * Java stream object or your own subclass that implements the
3609 * standard interface.
3610 * <P><B>Note:</B> Consult your JDBC driver documentation to determine if
3611 * it might be more efficient to use a version of
3612 * <code>setAsciiStream</code> which takes a length parameter.
3613 *
3614 * @param parameterName the name of the parameter
3615 * @param x the Java input stream that contains the ASCII parameter value
3616 * @exception SQLException if a database access error occurs or
3617 * this method is called on a closed <code>CallableStatement</code>
3618 * @throws SQLFeatureNotSupportedException if the JDBC driver does not support this method
3619 * @since 1.6
3620 */
3621 public void setAsciiStream(String parameterName,
3622 java.io.InputStream x) throws SQLException {
3623 throw new SQLFeatureNotSupportedException(
3624 "Feature not supported");
3625 }
3626
3627 /**
3628 * Sets the designated parameter to the given input stream.
3629 * When a very large binary value is input to a <code>LONGVARBINARY</code>
3630 * parameter, it may be more practical to send it via a
3631 * <code>java.io.InputStream</code> object. The data will be read from the
3632 * stream as needed until end-of-file is reached.
3633 *
3634 * <P><B>Note:</B> This stream object can either be a standard
3635 * Java stream object or your own subclass that implements the
3636 * standard interface.
3637 * <P><B>Note:</B> Consult your JDBC driver documentation to determine if
3638 * it might be more efficient to use a version of
3639 * <code>setBinaryStream</code> which takes a length parameter.
3640 *
3641 * @param parameterName the name of the parameter
3642 * @param x the java input stream which contains the binary parameter value
3643 * @exception SQLException if a database access error occurs or
3644 * this method is called on a closed <code>CallableStatement</code>
3645 * @throws SQLFeatureNotSupportedException if the JDBC driver does not support this method
3646 * @since 1.6
3647 */
3648 public void setBinaryStream(String parameterName,
3649 java.io.InputStream x) throws SQLException {
3650 throw new SQLFeatureNotSupportedException(
3651 "Feature not supported");
3652 }
3653
3654 /**
3655 * Sets the designated parameter to the given <code>Reader</code>
3656 * object.
3657 * When a very large UNICODE value is input to a <code>LONGVARCHAR</code>
3658 * parameter, it may be more practical to send it via a
3659 * <code>java.io.Reader</code> object. The data will be read from the stream
3660 * as needed until end-of-file is reached. The JDBC driver will
3661 * do any necessary conversion from UNICODE to the database char format.
3662 *
3663 * <P><B>Note:</B> This stream object can either be a standard
3664 * Java stream object or your own subclass that implements the
3665 * standard interface.
3666 * <P><B>Note:</B> Consult your JDBC driver documentation to determine if
3667 * it might be more efficient to use a version of
3668 * <code>setCharacterStream</code> which takes a length parameter.
3669 *
3670 * @param parameterName the name of the parameter
3671 * @param reader the <code>java.io.Reader</code> object that contains the
3672 * Unicode data
3673 * @exception SQLException if a database access error occurs or
3674 * this method is called on a closed <code>CallableStatement</code>
3675 * @throws SQLFeatureNotSupportedException if the JDBC driver does not support this method
3676 * @since 1.6
3677 */
3678 public void setCharacterStream(String parameterName,
3679 java.io.Reader reader) throws SQLException {
3680 throw new SQLFeatureNotSupportedException(
3681 "Feature not supported");
3682 }
3683
3684 /**
3685 * Sets the designated parameter in this <code>RowSet</code> object's command
3686 * to a <code>Reader</code> object. The
3687 * <code>Reader</code> reads the data till end-of-file is reached. The
3688 * driver does the necessary conversion from Java character format to
3689 * the national character set in the database.
3690
3691 * <P><B>Note:</B> This stream object can either be a standard
3692 * Java stream object or your own subclass that implements the
3693 * standard interface.
3694 * <P><B>Note:</B> Consult your JDBC driver documentation to determine if
3695 * it might be more efficient to use a version of
3696 * <code>setNCharacterStream</code> which takes a length parameter.
3697 *
3698 * @param parameterIndex of the first parameter is 1, the second is 2, ...
3699 * @param value the parameter value
3700 * @throws SQLException if the driver does not support national
3701 * character sets; if the driver can detect that a data conversion
3702 * error could occur ; if a database access error occurs; or
3703 * this method is called on a closed <code>PreparedStatement</code>
3704 * @throws SQLFeatureNotSupportedException if the JDBC driver does not support this method
3705 * @since 1.6
3706 */
3707 public void setNCharacterStream(int parameterIndex, Reader value)
3708 throws SQLException {
3709 throw new SQLFeatureNotSupportedException(
3710 "Feature not supported");
3711 }
3712
3713 /**
3714 * Sets the value of the designated parameter with the given object. The second
3715 * argument must be an object type; for integral values, the
3716 * <code>java.lang</code> equivalent objects should be used.
3717 *
3718 * <p>The given Java object will be converted to the given targetSqlType
3719 * before being sent to the database.
3720 *
3721 * If the object has a custom mapping (is of a class implementing the
3722 * interface <code>SQLData</code>),
3723 * the JDBC driver should call the method <code>SQLData.writeSQL</code> to write it
3724 * to the SQL data stream.
3725 * If, on the other hand, the object is of a class implementing
3726 * <code>Ref</code>, <code>Blob</code>, <code>Clob</code>, <code>NClob</code>,
3727 * <code>Struct</code>, <code>java.net.URL</code>,
3728 * or <code>Array</code>, the driver should pass it to the database as a
3729 * value of the corresponding SQL type.
3730 * <P>
3731 * Note that this method may be used to pass datatabase-
3732 * specific abstract data types.
3733 *
3734 * @param parameterName the name of the parameter
3735 * @param x the object containing the input parameter value
3736 * @param targetSqlType the SQL type (as defined in java.sql.Types) to be
3737 * sent to the database. The scale argument may further qualify this type.
3738 * @param scale for java.sql.Types.DECIMAL or java.sql.Types.NUMERIC types,
3739 * this is the number of digits after the decimal point. For all other
3740 * types, this value will be ignored.
3741 * @exception SQLException if a database access error occurs or
3742 * this method is called on a closed <code>CallableStatement</code>
3743 * @exception SQLFeatureNotSupportedException if <code>targetSqlType</code> is
3744 * a <code>ARRAY</code>, <code>BLOB</code>, <code>CLOB</code>,
3745 * <code>DATALINK</code>, <code>JAVA_OBJECT</code>, <code>NCHAR</code>,
3746 * <code>NCLOB</code>, <code>NVARCHAR</code>, <code>LONGNVARCHAR</code>,
3747 * <code>REF</code>, <code>ROWID</code>, <code>SQLXML</code>
3748 * or <code>STRUCT</code> data type and the JDBC driver does not support
3749 * this data type
3750 * @see Types
3751 * @see #getObject
3752 * @since 1.4
3753 */
3754 public void setObject(String parameterName, Object x,
3755 int targetSqlType, int scale) throws SQLException {
3756 throw new SQLFeatureNotSupportedException(
3757 "Feature not supported");
3758 }
3759
3760 /**
3761 * Sets the value of the designated parameter with the given object.
3762 * This method is like the method <code>setObject</code>
3763 * above, except that it assumes a scale of zero.
3764 *
3765 * @param parameterName the name of the parameter
3766 * @param x the object containing the input parameter value
3767 * @param targetSqlType the SQL type (as defined in java.sql.Types) to be
3768 * sent to the database
3769 * @exception SQLException if a database access error occurs or
3770 * this method is called on a closed <code>CallableStatement</code>
3771 * @exception SQLFeatureNotSupportedException if <code>targetSqlType</code> is
3772 * a <code>ARRAY</code>, <code>BLOB</code>, <code>CLOB</code>,
3773 * <code>DATALINK</code>, <code>JAVA_OBJECT</code>, <code>NCHAR</code>,
3774 * <code>NCLOB</code>, <code>NVARCHAR</code>, <code>LONGNVARCHAR</code>,
3775 * <code>REF</code>, <code>ROWID</code>, <code>SQLXML</code>
3776 * or <code>STRUCT</code> data type and the JDBC driver does not support
3777 * this data type
3778 * @see #getObject
3779 * @since 1.4
3780 */
3781 public void setObject(String parameterName, Object x,
3782 int targetSqlType) throws SQLException {
3783 throw new SQLFeatureNotSupportedException(
3784 "Feature not supported");
3785 }
3786
3787 /**
3788 * Sets the value of the designated parameter with the given object.
3789 * The second parameter must be of type <code>Object</code>; therefore, the
3790 * <code>java.lang</code> equivalent objects should be used for built-in types.
3791 *
3792 * <p>The JDBC specification specifies a standard mapping from
3793 * Java <code>Object</code> types to SQL types. The given argument
3794 * will be converted to the corresponding SQL type before being
3795 * sent to the database.
3796 *
3797 * <p>Note that this method may be used to pass datatabase-
3798 * specific abstract data types, by using a driver-specific Java
3799 * type.
3800 *
3801 * If the object is of a class implementing the interface <code>SQLData</code>,
3802 * the JDBC driver should call the method <code>SQLData.writeSQL</code>
3803 * to write it to the SQL data stream.
3804 * If, on the other hand, the object is of a class implementing
3805 * <code>Ref</code>, <code>Blob</code>, <code>Clob</code>, <code>NClob</code>,
3806 * <code>Struct</code>, <code>java.net.URL</code>,
3807 * or <code>Array</code>, the driver should pass it to the database as a
3808 * value of the corresponding SQL type.
3809 * <P>
3810 * This method throws an exception if there is an ambiguity, for example, if the
3811 * object is of a class implementing more than one of the interfaces named above.
3812 *
3813 * @param parameterName the name of the parameter
3814 * @param x the object containing the input parameter value
3815 * @exception SQLException if a database access error occurs,
3816 * this method is called on a closed <code>CallableStatement</code> or if the given
3817 * <code>Object</code> parameter is ambiguous
3818 * @exception SQLFeatureNotSupportedException if the JDBC driver does not support
3819 * this method
3820 * @see #getObject
3821 * @since 1.4
3822 */
3823 public void setObject(String parameterName, Object x)
3824 throws SQLException {
3825 throw new SQLFeatureNotSupportedException(
3826 "Feature not supported");
3827 }
3828
3829 /**
3830 * Sets the designated parameter to a <code>InputStream</code> object. The inputstream must contain the number
3831 * of characters specified by length otherwise a <code>SQLException</code> will be
3832 * generated when the <code>PreparedStatement</code> is executed.
3833 * This method differs from the <code>setBinaryStream (int, InputStream, int)</code>
3834 * method because it informs the driver that the parameter value should be
3835 * sent to the server as a <code>BLOB</code>. When the <code>setBinaryStream</code> method is used,
3836 * the driver may have to do extra work to determine whether the parameter
3837 * data should be sent to the server as a <code>LONGVARBINARY</code> or a <code>BLOB</code>
3838 * @param parameterIndex index of the first parameter is 1,
3839 * the second is 2, ...
3840 * @param inputStream An object that contains the data to set the parameter
3841 * value to.
3842 * @param length the number of bytes in the parameter data.
3843 * @throws SQLException if a database access error occurs,
3844 * this method is called on a closed <code>PreparedStatement</code>,
3845 * if parameterIndex does not correspond
3846 * to a parameter marker in the SQL statement, if the length specified
3847 * is less than zero or if the number of bytes in the inputstream does not match
3848 * the specfied length.
3849 * @throws SQLFeatureNotSupportedException if the JDBC driver does not support this method
3850 *
3851 * @since 1.6
3852 */
3853 public void setBlob(int parameterIndex, InputStream inputStream,
3854 long length) throws SQLException {
3855 throw new SQLFeatureNotSupportedException(
3856 "Feature not supported");
3857 }
3858
3859 /**
3860 * Sets the designated parameter to a <code>InputStream</code> object.
3861 * This method differs from the <code>setBinaryStream (int, InputStream)</code>
3862 * method because it informs the driver that the parameter value should be
3863 * sent to the server as a <code>BLOB</code>. When the <code>setBinaryStream</code> method is used,
3864 * the driver may have to do extra work to determine whether the parameter
3865 * data should be sent to the server as a <code>LONGVARBINARY</code> or a <code>BLOB</code>
3866 *
3867 * <P><B>Note:</B> Consult your JDBC driver documentation to determine if
3868 * it might be more efficient to use a version of
3869 * <code>setBlob</code> which takes a length parameter.
3870 *
3871 * @param parameterIndex index of the first parameter is 1,
3872 * the second is 2, ...
3873 * @param inputStream An object that contains the data to set the parameter
3874 * value to.
3875 * @throws SQLException if a database access error occurs,
3876 * this method is called on a closed <code>PreparedStatement</code> or
3877 * if parameterIndex does not correspond
3878 * to a parameter marker in the SQL statement,
3879 * @throws SQLFeatureNotSupportedException if the JDBC driver does not support this method
3880 *
3881 * @since 1.6
3882 */
3883 public void setBlob(int parameterIndex, InputStream inputStream)
3884 throws SQLException {
3885 throw new SQLFeatureNotSupportedException(
3886 "Feature not supported");
3887 }
3888
3889 /**
3890 * Sets the designated parameter to a <code>InputStream</code> object. The <code>inputstream</code> must contain the number
3891 * of characters specified by length, otherwise a <code>SQLException</code> will be
3892 * generated when the <code>CallableStatement</code> is executed.
3893 * This method differs from the <code>setBinaryStream (int, InputStream, int)</code>
3894 * method because it informs the driver that the parameter value should be
3895 * sent to the server as a <code>BLOB</code>. When the <code>setBinaryStream</code> method is used,
3896 * the driver may have to do extra work to determine whether the parameter
3897 * data should be sent to the server as a <code>LONGVARBINARY</code> or a <code>BLOB</code>
3898 *
3899 * @param parameterName the name of the parameter to be set
3900 * the second is 2, ...
3901 *
3902 * @param inputStream An object that contains the data to set the parameter
3903 * value to.
3904 * @param length the number of bytes in the parameter data.
3905 * @throws SQLException if parameterIndex does not correspond
3906 * to a parameter marker in the SQL statement, or if the length specified
3907 * is less than zero; if the number of bytes in the inputstream does not match
3908 * the specfied length; if a database access error occurs or
3909 * this method is called on a closed <code>CallableStatement</code>
3910 * @exception SQLFeatureNotSupportedException if the JDBC driver does not support
3911 * this method
3912 *
3913 * @since 1.6
3914 */
3915 public void setBlob(String parameterName, InputStream inputStream,
3916 long length) throws SQLException {
3917 throw new SQLFeatureNotSupportedException(
3918 "Feature not supported");
3919 }
3920
3921 /**
3922 * Sets the designated parameter to the given <code>java.sql.Blob</code> object.
3923 * The driver converts this to an SQL <code>BLOB</code> value when it
3924 * sends it to the database.
3925 *
3926 * @param parameterName the name of the parameter
3927 * @param x a <code>Blob</code> object that maps an SQL <code>BLOB</code> value
3928 * @exception SQLException if a database access error occurs or
3929 * this method is called on a closed <code>CallableStatement</code>
3930 * @exception SQLFeatureNotSupportedException if the JDBC driver does not support
3931 * this method
3932 * @since 1.6
3933 */
3934 public void setBlob(String parameterName, Blob x)
3935 throws SQLException {
3936 throw new SQLFeatureNotSupportedException(
3937 "Feature not supported");
3938 }
3939
3940 /**
3941 * Sets the designated parameter to a <code>InputStream</code> object.
3942 * This method differs from the <code>setBinaryStream (int, InputStream)</code>
3943 * method because it informs the driver that the parameter value should be
3944 * sent to the server as a <code>BLOB</code>. When the <code>setBinaryStream</code> method is used,
3945 * the driver may have to do extra work to determine whether the parameter
3946 * data should be send to the server as a <code>LONGVARBINARY</code> or a <code>BLOB</code>
3947 *
3948 * <P><B>Note:</B> Consult your JDBC driver documentation to determine if
3949 * it might be more efficient to use a version of
3950 * <code>setBlob</code> which takes a length parameter.
3951 *
3952 * @param parameterName the name of the parameter
3953 * @param inputStream An object that contains the data to set the parameter
3954 * value to.
3955 * @throws SQLException if a database access error occurs or
3956 * this method is called on a closed <code>CallableStatement</code>
3957 * @throws SQLFeatureNotSupportedException if the JDBC driver does not support this method
3958 *
3959 * @since 1.6
3960 */
3961 public void setBlob(String parameterName, InputStream inputStream)
3962 throws SQLException {
3963 throw new SQLFeatureNotSupportedException(
3964 "Feature not supported");
3965 }
3966
3967 /**
3968 * Sets the designated parameter to a <code>Reader</code> object. The reader must contain the number
3969 * of characters specified by length otherwise a <code>SQLException</code> will be
3970 * generated when the <code>PreparedStatement</code> is executed.
3971 *This method differs from the <code>setCharacterStream (int, Reader, int)</code> method
3972 * because it informs the driver that the parameter value should be sent to
3973 * the server as a <code>CLOB</code>. When the <code>setCharacterStream</code> method is used, the
3974 * driver may have to do extra work to determine whether the parameter
3975 * data should be sent to the server as a <code>LONGVARCHAR</code> or a <code>CLOB</code>
3976 * @param parameterIndex index of the first parameter is 1, the second is 2, ...
3977 * @param reader An object that contains the data to set the parameter value to.
3978 * @param length the number of characters in the parameter data.
3979 * @throws SQLException if a database access error occurs, this method is called on
3980 * a closed <code>PreparedStatement</code>, if parameterIndex does not correspond to a parameter
3981 * marker in the SQL statement, or if the length specified is less than zero.
3982 *
3983 * @throws SQLFeatureNotSupportedException if the JDBC driver does not support this method
3984 * @since 1.6
3985 */
3986 public void setClob(int parameterIndex, Reader reader, long length)
3987 throws SQLException {
3988 throw new SQLFeatureNotSupportedException(
3989 "Feature not supported");
3990 }
3991
3992 /**
3993 * Sets the designated parameter to a <code>Reader</code> object.
3994 * This method differs from the <code>setCharacterStream (int, Reader)</code> method
3995 * because it informs the driver that the parameter value should be sent to
3996 * the server as a <code>CLOB</code>. When the <code>setCharacterStream</code> method is used, the
3997 * driver may have to do extra work to determine whether the parameter
3998 * data should be sent to the server as a <code>LONGVARCHAR</code> or a <code>CLOB</code>
3999 *
4000 * <P><B>Note:</B> Consult your JDBC driver documentation to determine if
4001 * it might be more efficient to use a version of
4002 * <code>setClob</code> which takes a length parameter.
4003 *
4004 * @param parameterIndex index of the first parameter is 1, the second is 2, ...
4005 * @param reader An object that contains the data to set the parameter value to.
4006 * @throws SQLException if a database access error occurs, this method is called on
4007 * a closed <code>PreparedStatement</code>or if parameterIndex does not correspond to a parameter
4008 * marker in the SQL statement
4009 *
4010 * @throws SQLFeatureNotSupportedException if the JDBC driver does not support this method
4011 * @since 1.6
4012 */
4013 public void setClob(int parameterIndex, Reader reader)
4014 throws SQLException {
4015 throw new SQLFeatureNotSupportedException(
4016 "Feature not supported");
4017 }
4018
4019 /**
4020 * Sets the designated parameter to a <code>Reader</code> object. The <code>reader</code> must contain the number
4021 * of characters specified by length otherwise a <code>SQLException</code> will be
4022 * generated when the <code>CallableStatement</code> is executed.
4023 * This method differs from the <code>setCharacterStream (int, Reader, int)</code> method
4024 * because it informs the driver that the parameter value should be sent to
4025 * the server as a <code>CLOB</code>. When the <code>setCharacterStream</code> method is used, the
4026 * driver may have to do extra work to determine whether the parameter
4027 * data should be send to the server as a <code>LONGVARCHAR</code> or a <code>CLOB</code>
4028 * @param parameterName the name of the parameter to be set
4029 * @param reader An object that contains the data to set the parameter value to.
4030 * @param length the number of characters in the parameter data.
4031 * @throws SQLException if parameterIndex does not correspond to a parameter
4032 * marker in the SQL statement; if the length specified is less than zero;
4033 * a database access error occurs or
4034 * this method is called on a closed <code>CallableStatement</code>
4035 * @exception SQLFeatureNotSupportedException if the JDBC driver does not support
4036 * this method
4037 *
4038 * @since 1.6
4039 */
4040 public void setClob(String parameterName, Reader reader, long length)
4041 throws SQLException {
4042 throw new SQLFeatureNotSupportedException(
4043 "Feature not supported");
4044 }
4045
4046 /**
4047 * Sets the designated parameter to the given <code>java.sql.Clob</code> object.
4048 * The driver converts this to an SQL <code>CLOB</code> value when it
4049 * sends it to the database.
4050 *
4051 * @param parameterName the name of the parameter
4052 * @param x a <code>Clob</code> object that maps an SQL <code>CLOB</code> value
4053 * @exception SQLException if a database access error occurs or
4054 * this method is called on a closed <code>CallableStatement</code>
4055 * @exception SQLFeatureNotSupportedException if the JDBC driver does not support
4056 * this method
4057 * @since 1.6
4058 */
4059 public void setClob(String parameterName, Clob x)
4060 throws SQLException {
4061 throw new SQLFeatureNotSupportedException(
4062 "Feature not supported");
4063 }
4064
4065 /**
4066 * Sets the designated parameter to a <code>Reader</code> object.
4067 * This method differs from the <code>setCharacterStream (int, Reader)</code> method
4068 * because it informs the driver that the parameter value should be sent to
4069 * the server as a <code>CLOB</code>. When the <code>setCharacterStream</code> method is used, the
4070 * driver may have to do extra work to determine whether the parameter
4071 * data should be send to the server as a <code>LONGVARCHAR</code> or a <code>CLOB</code>
4072 *
4073 * <P><B>Note:</B> Consult your JDBC driver documentation to determine if
4074 * it might be more efficient to use a version of
4075 * <code>setClob</code> which takes a length parameter.
4076 *
4077 * @param parameterName the name of the parameter
4078 * @param reader An object that contains the data to set the parameter value to.
4079 * @throws SQLException if a database access error occurs or this method is called on
4080 * a closed <code>CallableStatement</code>
4081 *
4082 * @throws SQLFeatureNotSupportedException if the JDBC driver does not support this method
4083 * @since 1.6
4084 */
4085 public void setClob(String parameterName, Reader reader)
4086 throws SQLException {
4087 throw new SQLFeatureNotSupportedException(
4088 "Feature not supported");
4089 }
4090
4091 /**
4092 * Sets the designated parameter to the given <code>java.sql.Date</code> value
4093 * using the default time zone of the virtual machine that is running
4094 * the application.
4095 * The driver converts this
4096 * to an SQL <code>DATE</code> value when it sends it to the database.
4097 *
4098 * @param parameterName the name of the parameter
4099 * @param x the parameter value
4100 * @exception SQLException if a database access error occurs or
4101 * this method is called on a closed <code>CallableStatement</code>
4102 * @exception SQLFeatureNotSupportedException if the JDBC driver does not support
4103 * this method
4104 * @see #getDate
4105 * @since 1.4
4106 */
4107 public void setDate(String parameterName, java.sql.Date x)
4108 throws SQLException {
4109 throw new SQLFeatureNotSupportedException(
4110 "Feature not supported");
4111 }
4112
4113 /**
4114 * Sets the designated parameter to the given <code>java.sql.Date</code> value,
4115 * using the given <code>Calendar</code> object. The driver uses
4116 * the <code>Calendar</code> object to construct an SQL <code>DATE</code> value,
4117 * which the driver then sends to the database. With a
4118 * a <code>Calendar</code> object, the driver can calculate the date
4119 * taking into account a custom timezone. If no
4120 * <code>Calendar</code> object is specified, the driver uses the default
4121 * timezone, which is that of the virtual machine running the application.
4122 *
4123 * @param parameterName the name of the parameter
4124 * @param x the parameter value
4125 * @param cal the <code>Calendar</code> object the driver will use
4126 * to construct the date
4127 * @exception SQLException if a database access error occurs or
4128 * this method is called on a closed <code>CallableStatement</code>
4129 * @exception SQLFeatureNotSupportedException if the JDBC driver does not support
4130 * this method
4131 * @see #getDate
4132 * @since 1.4
4133 */
4134 public void setDate(String parameterName, java.sql.Date x,
4135 Calendar cal) throws SQLException {
4136 throw new SQLFeatureNotSupportedException(
4137 "Feature not supported");
4138 }
4139
4140 /**
4141 * Sets the designated parameter to the given <code>java.sql.Time</code> value.
4142 * The driver converts this
4143 * to an SQL <code>TIME</code> value when it sends it to the database.
4144 *
4145 * @param parameterName the name of the parameter
4146 * @param x the parameter value
4147 * @exception SQLException if a database access error occurs or
4148 * this method is called on a closed <code>CallableStatement</code>
4149 * @exception SQLFeatureNotSupportedException if the JDBC driver does not support
4150 * this method
4151 * @see #getTime
4152 * @since 1.4
4153 */
4154 public void setTime(String parameterName, java.sql.Time x)
4155 throws SQLException {
4156 throw new SQLFeatureNotSupportedException(
4157 "Feature not supported");
4158 }
4159
4160 /**
4161 * Sets the designated parameter to the given <code>java.sql.Time</code> value,
4162 * using the given <code>Calendar</code> object. The driver uses
4163 * the <code>Calendar</code> object to construct an SQL <code>TIME</code> value,
4164 * which the driver then sends to the database. With a
4165 * a <code>Calendar</code> object, the driver can calculate the time
4166 * taking into account a custom timezone. If no
4167 * <code>Calendar</code> object is specified, the driver uses the default
4168 * timezone, which is that of the virtual machine running the application.
4169 *
4170 * @param parameterName the name of the parameter
4171 * @param x the parameter value
4172 * @param cal the <code>Calendar</code> object the driver will use
4173 * to construct the time
4174 * @exception SQLException if a database access error occurs or
4175 * this method is called on a closed <code>CallableStatement</code>
4176 * @exception SQLFeatureNotSupportedException if the JDBC driver does not support
4177 * this method
4178 * @see #getTime
4179 * @since 1.4
4180 */
4181 public void setTime(String parameterName, java.sql.Time x,
4182 Calendar cal) throws SQLException {
4183 throw new SQLFeatureNotSupportedException(
4184 "Feature not supported");
4185 }
4186
4187 /**
4188 * Sets the designated parameter to the given <code>java.sql.Timestamp</code> value,
4189 * using the given <code>Calendar</code> object. The driver uses
4190 * the <code>Calendar</code> object to construct an SQL <code>TIMESTAMP</code> value,
4191 * which the driver then sends to the database. With a
4192 * a <code>Calendar</code> object, the driver can calculate the timestamp
4193 * taking into account a custom timezone. If no
4194 * <code>Calendar</code> object is specified, the driver uses the default
4195 * timezone, which is that of the virtual machine running the application.
4196 *
4197 * @param parameterName the name of the parameter
4198 * @param x the parameter value
4199 * @param cal the <code>Calendar</code> object the driver will use
4200 * to construct the timestamp
4201 * @exception SQLException if a database access error occurs or
4202 * this method is called on a closed <code>CallableStatement</code>
4203 * @exception SQLFeatureNotSupportedException if the JDBC driver does not support
4204 * this method
4205 * @see #getTimestamp
4206 * @since 1.4
4207 */
4208 public void setTimestamp(String parameterName,
4209 java.sql.Timestamp x, Calendar cal) throws SQLException {
4210 throw new SQLFeatureNotSupportedException(
4211 "Feature not supported");
4212 }
4213
4214 /**
4215 * Sets the designated parameter to the given <code>java.sql.SQLXML</code> object. The driver converts this to an
4216 * SQL <code>XML</code> value when it sends it to the database.
4217 * @param parameterIndex index of the first parameter is 1, the second is 2, ...
4218 * @param xmlObject a <code>SQLXML</code> object that maps an SQL <code>XML</code> value
4219 * @throws SQLException if a database access error occurs, this method
4220 * is called on a closed result set,
4221 * the <code>java.xml.transform.Result</code>,
4222 * <code>Writer</code> or <code>OutputStream</code> has not been closed
4223 * for the <code>SQLXML</code> object or
4224 * if there is an error processing the XML value. The <code>getCause</code> method
4225 * of the exception may provide a more detailed exception, for example, if the
4226 * stream does not contain valid XML.
4227 * @since 1.6
4228 */
4229 public void setSQLXML(int parameterIndex, SQLXML xmlObject)
4230 throws SQLException {
4231 throw new SQLFeatureNotSupportedException(
4232 "Feature not supported");
4233 }
4234
4235 /**
4236 * Sets the designated parameter to the given <code>java.sql.SQLXML</code> object. The driver converts this to an
4237 * <code>SQL XML</code> value when it sends it to the database.
4238 * @param parameterName the name of the parameter
4239 * @param xmlObject a <code>SQLXML</code> object that maps an <code>SQL XML</code> value
4240 * @throws SQLException if a database access error occurs, this method
4241 * is called on a closed result set,
4242 * the <code>java.xml.transform.Result</code>,
4243 * <code>Writer</code> or <code>OutputStream</code> has not been closed
4244 * for the <code>SQLXML</code> object or
4245 * if there is an error processing the XML value. The <code>getCause</code> method
4246 * of the exception may provide a more detailed exception, for example, if the
4247 * stream does not contain valid XML.
4248 * @since 1.6
4249 */
4250 public void setSQLXML(String parameterName, SQLXML xmlObject)
4251 throws SQLException {
4252 throw new SQLFeatureNotSupportedException(
4253 "Feature not supported");
4254 }
4255
4256 /**
4257 * Sets the designated parameter to the given <code>java.sql.RowId</code> object. The
4258 * driver converts this to a SQL <code>ROWID</code> value when it sends it
4259 * to the database
4260 *
4261 * @param parameterIndex the first parameter is 1, the second is 2, ...
4262 * @param x the parameter value
4263 * @throws SQLException if a database access error occurs
4264 *
4265 * @since 1.6
4266 */
4267 public void setRowId(int parameterIndex, RowId x)
4268 throws SQLException {
4269 throw new SQLFeatureNotSupportedException(
4270 "Feature not supported");
4271 }
4272
4273 /**
4274 * Sets the designated parameter to the given <code>java.sql.RowId</code> object. The
4275 * driver converts this to a SQL <code>ROWID</code> when it sends it to the
4276 * database.
4277 *
4278 * @param parameterName the name of the parameter
4279 * @param x the parameter value
4280 * @throws SQLException if a database access error occurs
4281 * @since 1.6
4282 */
4283 public void setRowId(String parameterName, RowId x)
4284 throws SQLException {
4285 throw new SQLFeatureNotSupportedException(
4286 "Feature not supported");
4287 }
4288
4289 /**
4290 * Sets the designated paramter to the given <code>String</code> object.
4291 * The driver converts this to a SQL <code>NCHAR</code> or
4292 * <code>NVARCHAR</code> or <code>LONGNVARCHAR</code> value
4293 * (depending on the argument's
4294 * size relative to the driver's limits on <code>NVARCHAR</code> values)
4295 * when it sends it to the database.
4296 *
4297 * @param parameterIndex of the first parameter is 1, the second is 2, ...
4298 * @param value the parameter value
4299 * @throws SQLException if the driver does not support national
4300 * character sets; if the driver can detect that a data conversion
4301 * error could occur ; or if a database access error occurs
4302 * @since 1.6
4303 */
4304 public void setNString(int parameterIndex, String value)
4305 throws SQLException {
4306 throw new SQLFeatureNotSupportedException(
4307 "Feature not supported");
4308 }
4309
4310 /**
4311 * Sets the designated paramter to the given <code>String</code> object.
4312 * The driver converts this to a SQL <code>NCHAR</code> or
4313 * <code>NVARCHAR</code> or <code>LONGNVARCHAR</code>
4314 * @param parameterName the name of the column to be set
4315 * @param value the parameter value
4316 * @throws SQLException if the driver does not support national
4317 * character sets; if the driver can detect that a data conversion
4318 * error could occur; or if a database access error occurs
4319 * @since 1.6
4320 */
4321 public void setNString(String parameterName, String value)
4322 throws SQLException {
4323 throw new SQLFeatureNotSupportedException(
4324 "Feature not supported");
4325 }
4326
4327 /**
4328 * Sets the designated parameter to a <code>Reader</code> object. The
4329 * <code>Reader</code> reads the data till end-of-file is reached. The
4330 * driver does the necessary conversion from Java character format to
4331 * the national character set in the database.
4332 * @param parameterIndex of the first parameter is 1, the second is 2, ...
4333 * @param value the parameter value
4334 * @param length the number of characters in the parameter data.
4335 * @throws SQLException if the driver does not support national
4336 * character sets; if the driver can detect that a data conversion
4337 * error could occur ; or if a database access error occurs
4338 * @since 1.6
4339 */
4340 public void setNCharacterStream(int parameterIndex, Reader value,
4341 long length) throws SQLException {
4342 throw new SQLFeatureNotSupportedException(
4343 "Feature not supported");
4344 }
4345
4346 /**
4347 * Sets the designated parameter to a <code>Reader</code> object. The
4348 * <code>Reader</code> reads the data till end-of-file is reached. The
4349 * driver does the necessary conversion from Java character format to
4350 * the national character set in the database.
4351 * @param parameterName the name of the column to be set
4352 * @param value the parameter value
4353 * @param length the number of characters in the parameter data.
4354 * @throws SQLException if the driver does not support national
4355 * character sets; if the driver can detect that a data conversion
4356 * error could occur; or if a database access error occurs
4357 * @since 1.6
4358 */
4359 public void setNCharacterStream(String parameterName, Reader value,
4360 long length) throws SQLException {
4361 throw new SQLFeatureNotSupportedException(
4362 "Feature not supported");
4363 }
4364
4365 /**
4366 * Sets the designated parameter to a <code>Reader</code> object. The
4367 * <code>Reader</code> reads the data till end-of-file is reached. The
4368 * driver does the necessary conversion from Java character format to
4369 * the national character set in the database.
4370
4371 * <P><B>Note:</B> This stream object can either be a standard
4372 * Java stream object or your own subclass that implements the
4373 * standard interface.
4374 * <P><B>Note:</B> Consult your JDBC driver documentation to determine if
4375 * it might be more efficient to use a version of
4376 * <code>setNCharacterStream</code> which takes a length parameter.
4377 *
4378 * @param parameterName the name of the parameter
4379 * @param value the parameter value
4380 * @throws SQLException if the driver does not support national
4381 * character sets; if the driver can detect that a data conversion
4382 * error could occur ; if a database access error occurs; or
4383 * this method is called on a closed <code>CallableStatement</code>
4384 * @throws SQLFeatureNotSupportedException if the JDBC driver does not support this method
4385 * @since 1.6
4386 */
4387 public void setNCharacterStream(String parameterName, Reader value)
4388 throws SQLException {
4389 throw new SQLFeatureNotSupportedException(
4390 "Feature not supported");
4391 }
4392
4393 /**
4394 * Sets the designated parameter to a <code>java.sql.NClob</code> object. The object
4395 * implements the <code>java.sql.NClob</code> interface. This <code>NClob</code>
4396 * object maps to a SQL <code>NCLOB</code>.
4397 * @param parameterName the name of the column to be set
4398 * @param value the parameter value
4399 * @throws SQLException if the driver does not support national
4400 * character sets; if the driver can detect that a data conversion
4401 * error could occur; or if a database access error occurs
4402 * @since 1.6
4403 */
4404 public void setNClob(String parameterName, NClob value)
4405 throws SQLException {
4406 throw new SQLFeatureNotSupportedException(
4407 "Feature not supported");
4408 }
4409
4410 /**
4411 * Sets the designated parameter to a <code>Reader</code> object. The <code>reader</code> must contain * the number
4412 * of characters specified by length otherwise a <code>SQLException</code> will be
4413 * generated when the <code>CallableStatement</code> is executed.
4414 * This method differs from the <code>setCharacterStream (int, Reader, int)</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 *
4420 * @param parameterName the name of the parameter to be set
4421 * @param reader An object that contains the data to set the parameter value to.
4422 * @param length the number of characters in the parameter data.
4423 * @throws SQLException if parameterIndex does not correspond to a parameter
4424 * marker in the SQL statement; if the length specified is less than zero;
4425 * if the driver does not support national
4426 * character sets; 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 * @exception SQLFeatureNotSupportedException if the JDBC driver does not support
4430 * this method
4431 * @since 1.6
4432 */
4433 public void setNClob(String parameterName, Reader reader,
4434 long length) throws SQLException {
4435 throw new SQLFeatureNotSupportedException(
4436 "Feature not supported");
4437 }
4438
4439 /**
4440 * Sets the designated parameter to a <code>Reader</code> object.
4441 * This method differs from the <code>setCharacterStream (int, Reader)</code> method
4442 * because it informs the driver that the parameter value should be sent to
4443 * the server as a <code>NCLOB</code>. When the <code>setCharacterStream</code> method is used, the
4444 * driver may have to do extra work to determine whether the parameter
4445 * data should be send to the server as a <code>LONGNVARCHAR</code> or a <code>NCLOB</code>
4446 * <P><B>Note:</B> Consult your JDBC driver documentation to determine if
4447 * it might be more efficient to use a version of
4448 * <code>setNClob</code> which takes a length parameter.
4449 *
4450 * @param parameterName the name of the parameter
4451 * @param reader An object that contains the data to set the parameter value to.
4452 * @throws SQLException if the driver does not support national character sets;
4453 * if the driver can detect that a data conversion
4454 * error could occur; if a database access error occurs or
4455 * this method is called on a closed <code>CallableStatement</code>
4456 * @throws SQLFeatureNotSupportedException if the JDBC driver does not support this method
4457 *
4458 * @since 1.6
4459 */
4460 public void setNClob(String parameterName, Reader reader)
4461 throws SQLException {
4462 throw new SQLFeatureNotSupportedException(
4463 "Feature not supported");
4464 }
4465
4466 /**
4467 * Sets the designated parameter to a <code>Reader</code> object. The reader must contain the number
4468 * of characters specified by length otherwise a <code>SQLException</code> will be
4469 * generated when the <code>PreparedStatement</code> is executed.
4470 * This method differs from the <code>setCharacterStream (int, Reader, int)</code> method
4471 * because it informs the driver that the parameter value should be sent to
4472 * the server as a <code>NCLOB</code>. When the <code>setCharacterStream</code> method is used, the
4473 * driver may have to do extra work to determine whether the parameter
4474 * data should be sent to the server as a <code>LONGNVARCHAR</code> or a <code>NCLOB</code>
4475 * @param parameterIndex index of the first parameter is 1, the second is 2, ...
4476 * @param reader An object that contains the data to set the parameter value to.
4477 * @param length the number of characters in the parameter data.
4478 * @throws SQLException if parameterIndex does not correspond to a parameter
4479 * marker in the SQL statement; if the length specified is less than zero;
4480 * if the driver does not support national character sets;
4481 * if the driver can detect that a data conversion
4482 * error could occur; if a database access error occurs or
4483 * this method is called on a closed <code>PreparedStatement</code>
4484 * @throws SQLFeatureNotSupportedException if the JDBC driver does not support this method
4485 *
4486 * @since 1.6
4487 */
4488 public void setNClob(int parameterIndex, Reader reader, long length)
4489 throws SQLException {
4490 throw new SQLFeatureNotSupportedException(
4491 "Feature not supported");
4492 }
4493
4494 /**
4495 * Sets the designated parameter to a <code>java.sql.NClob</code> object. The driver converts this oa
4496 * SQL <code>NCLOB</code> value when it sends it to the database.
4497 * @param parameterIndex of the first parameter is 1, the second is 2, ...
4498 * @param value the parameter value
4499 * @throws SQLException if the driver does not support national
4500 * character sets; if the driver can detect that a data conversion
4501 * error could occur ; or if a database access error occurs
4502 * @since 1.6
4503 */
4504 public void setNClob(int parameterIndex, NClob value)
4505 throws SQLException {
4506 throw new SQLFeatureNotSupportedException(
4507 "Feature not supported");
4508 }
4509
4510 /**
4511 * Sets the designated parameter to a <code>Reader</code> object.
4512 * This method differs from the <code>setCharacterStream (int, Reader)</code> method
4513 * because it informs the driver that the parameter value should be sent to
4514 * the server as a <code>NCLOB</code>. When the <code>setCharacterStream</code> method is used, the
4515 * driver may have to do extra work to determine whether the parameter
4516 * data should be sent to the server as a <code>LONGNVARCHAR</code> or a <code>NCLOB</code>
4517 * <P><B>Note:</B> Consult your JDBC driver documentation to determine if
4518 * it might be more efficient to use a version of
4519 * <code>setNClob</code> which takes a length parameter.
4520 *
4521 * @param parameterIndex index of the first parameter is 1, the second is 2, ...
4522 * @param reader An object that contains the data to set the parameter value to.
4523 * @throws SQLException if parameterIndex does not correspond to a parameter
4524 * marker in the SQL statement;
4525 * if the driver does not support national character sets;
4526 * if the driver can detect that a data conversion
4527 * error could occur; if a database access error occurs or
4528 * this method is called on a closed <code>PreparedStatement</code>
4529 * @throws SQLFeatureNotSupportedException if the JDBC driver does not support this method
4530 *
4531 * @since 1.6
4532 */
4533 public void setNClob(int parameterIndex, Reader reader)
4534 throws SQLException {
4535 throw new SQLFeatureNotSupportedException(
4536 "Feature not supported");
4537 }
4538
4539 /**
4540 * Sets the designated parameter to the given <code>java.net.URL</code> value.
4541 * The driver converts this to an SQL <code>DATALINK</code> value
4542 * when it sends it to the database.
4543 *
4544 * @param parameterIndex the first parameter is 1, the second is 2, ...
4545 * @param x the <code>java.net.URL</code> object to be set
4546 * @exception SQLException if a database access error occurs or
4547 * this method is called on a closed <code>PreparedStatement</code>
4548 * @throws SQLFeatureNotSupportedException if the JDBC driver does not support this method
4549 * @since 1.4
4550 */
4551 public void setURL(int parameterIndex, java.net.URL x)
4552 throws SQLException {
4553 throw new SQLFeatureNotSupportedException(
4554 "Feature not supported");
4555 }
4556
4557 static final long serialVersionUID = 4886719666485113312L;
4558
4559 } //end class
|