1. /*
  2. * @(#)RowSet.java 1.13 03/01/23
  3. *
  4. * Copyright 2003 Sun Microsystems, Inc. All rights reserved.
  5. * SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
  6. */
  7. package javax.sql;
  8. import java.sql.*;
  9. import java.io.*;
  10. import java.math.*;
  11. import java.util.*;
  12. /**
  13. * The interface that adds support to the JDBC API for the
  14. * JavaBeans<sup><font size=-2>TM</font></sup> component model.
  15. * A rowset, which can be used as a JavaBeans component in
  16. * a visual Bean development environment, can be created and
  17. * configured at design time and executed at run time.
  18. * <P>
  19. * The <code>RowSet</code>
  20. * interface provides a set of JavaBeans properties that allow a <code>RowSet</code>
  21. * instance to be configured to connect to a JDBC data source and read
  22. * some data from the data source. A group of setter methods (<code>setInt</code>,
  23. * <code>setBytes</code>, <code>setString</code>, and so on)
  24. * provide a way to pass input parameters to a rowset's command property.
  25. * This command is the SQL query the rowset uses when it gets its data from
  26. * a relational database, which is generally the case.
  27. * <P>
  28. * The <code>RowSet</code>
  29. * interface supports JavaBeans events, allowing other components in an
  30. * application to be notified when an event occurs on a rowset,
  31. * such as a change in its value.
  32. *
  33. * <P>The <code>RowSet</code> interface is unique in that it is intended to be
  34. * implemented using the rest of the JDBC API. In other words, a
  35. * <code>RowSet</code> implementation is a layer of software that executes "on top"
  36. * of a JDBC driver. Implementations of the <code>RowSet</code> interface can
  37. * be provided by anyone, including JDBC driver vendors who want to
  38. * provide a <code>RowSet</code> implementation as part of their JDBC products.
  39. * <P>
  40. * A <code>RowSet</code> object may make a connection with a data source and
  41. * maintain that connection throughout its life cycle, in which case it is
  42. * called a <i>connected</i> rowset. A rowset may also make a connection with
  43. * a data source, get data from it, and then close the connection. Such a rowset
  44. * is called a <i>disconnected</i> rowset. A disconnected rowset may make
  45. * changes to its data while it is disconnected and then send the changes back
  46. * to the original source of the data, but it must reestablish a connection to do so.
  47. * <P>
  48. * A disconnected rowset may have a reader (a <code>RowSetReader</code> object)
  49. * and a writer (a <code>RowSetWriter</code> object) associated with it.
  50. * The reader may be implemented in many different ways to populate a rowset
  51. * with data, including getting data from a non-relational data source. The
  52. * writer can also be implemented in many different ways to propagate changes
  53. * made to the rowset's data back to the underlying data source.
  54. * <P>
  55. * Rowsets are easy to use. The <code>RowSet</code> interface extends the standard
  56. * <code>java.sql.ResultSet</code> interface. The <code>RowSetMetaData</code>
  57. * interface extends the <code>java.sql.ResultSetMetaData</code> interface.
  58. * Thus, developers familiar
  59. * with the JDBC API will have to learn a minimal number of new APIs to
  60. * use rowsets. In addition, third-party software tools that work with
  61. * JDBC <code>ResultSet</code> objects will also easily be made to work with rowsets.
  62. *
  63. * @since 1.4
  64. */
  65. public interface RowSet extends ResultSet {
  66. //-----------------------------------------------------------------------
  67. // Properties
  68. //-----------------------------------------------------------------------
  69. //-----------------------------------------------------------------------
  70. // The following properties may be used to create a Connection.
  71. //-----------------------------------------------------------------------
  72. /**
  73. * Retrieves the url property this <code>RowSet</code> object will use to
  74. * create a connection if it uses the <code>DriverManager</code>
  75. * instead of a <code>DataSource</code> object to establish the connection.
  76. * The default value is <code>null</code>.
  77. *
  78. * @return a string url
  79. * @exception SQLException if a database access error occurs
  80. * @see #setUrl
  81. */
  82. String getUrl() throws SQLException;
  83. /**
  84. * Sets the URL this <code>RowSet</code> object will use when it uses the
  85. * <code>DriverManager</code> to create a connection.
  86. *
  87. * Setting this property is optional. If a URL is used, a JDBC driver
  88. * that accepts the URL must be loaded by the application before the
  89. * rowset is used to connect to a database. The rowset will use the URL
  90. * internally to create a database connection when reading or writing
  91. * data. Either a URL or a data source name is used to create a
  92. * connection, whichever was specified most recently.
  93. *
  94. * @param url a string value; may be <code>null</code>
  95. * @exception SQLException if a database access error occurs
  96. * @see #getUrl
  97. */
  98. void setUrl(String url) throws SQLException;
  99. /**
  100. * Retrieves the logical name that identifies the data source for this
  101. * <code>RowSet</code> object. Users should set
  102. * either the url property or the data source name property. The rowset will use
  103. * the property that was set more recently to get a connection.
  104. *
  105. * @return a data source name
  106. * @see #setDataSourceName
  107. * @see #setUrl
  108. */
  109. String getDataSourceName();
  110. /**
  111. * Sets the data source name property for this <code>RowSet</code> object to the
  112. * given <code>String</code>.
  113. * <P>
  114. * The value of the data source name property can be used to do a lookup of
  115. * a <code>DataSource</code> object that has been registered with a naming
  116. * service. After being retrieved, the <code>DataSource</code> object can be
  117. * used to create a connection to the data source that it represents.
  118. *
  119. * @param name the logical name of the data source for this <code>RowSet</code>
  120. * object
  121. * @exception SQLException if a database access error occurs
  122. * @see #getDataSourceName
  123. */
  124. void setDataSourceName(String name) throws SQLException;
  125. /**
  126. * Retrieves the username used to create a database connection for this
  127. * <code>RowSet</code> object.
  128. * The username property is set at run time before calling the method
  129. * <code>execute</code>. It is
  130. * not usually part of the serialized state of a <code>RowSet</code> object.
  131. *
  132. * @return the username property
  133. * @see #setUsername
  134. */
  135. String getUsername();
  136. /**
  137. * Sets the username property for this <code>RowSet</code> object to the
  138. * given <code>String</code>.
  139. *
  140. * @param name a user name
  141. * @exception SQLException if a database access error occurs
  142. * @see #getUsername
  143. */
  144. void setUsername(String name) throws SQLException;
  145. /**
  146. * Retrieves the password used to create a database connection.
  147. * The password property is set at run time before calling the method
  148. * <code>execute</code>. It is not usually part of the serialized state
  149. * of a <code>RowSet</code> object.
  150. *
  151. * @return the password for making a database connection
  152. * @see #setPassword
  153. */
  154. String getPassword();
  155. /**
  156. * Sets the database password for this <code>RowSet</code> object to
  157. * the given <code>String</code>.
  158. *
  159. * @param password the password string
  160. * @exception SQLException if a database access error occurs
  161. * @see #getPassword
  162. */
  163. void setPassword(String password) throws SQLException;
  164. /**
  165. * Retrieves the transaction isolation level set for this
  166. * <code>RowSet</code> object.
  167. *
  168. * @return the transaction isolation level; one of
  169. * <code>Connection.TRANSACTION_READ_UNCOMMITTED</code>,
  170. * <code>Connection.TRANSACTION_READ_COMMITTED</code>,
  171. * <code>Connection.TRANSACTION_REPEATABLE_READ</code>, or
  172. * <code>Connection.TRANSACTION_SERIALIZABLE</code>
  173. * @see #setTransactionIsolation
  174. */
  175. int getTransactionIsolation();
  176. /**
  177. * Sets the transaction isolation level for this <code>RowSet</code> obejct.
  178. *
  179. * @param level the transaction isolation level; one of
  180. * <code>Connection.TRANSACTION_READ_UNCOMMITTED</code>,
  181. * <code>Connection.TRANSACTION_READ_COMMITTED</code>,
  182. * <code>Connection.TRANSACTION_REPEATABLE_READ</code>, or
  183. * <code>Connection.TRANSACTION_SERIALIZABLE</code>
  184. * @exception SQLException if a database access error occurs
  185. * @see #getTransactionIsolation
  186. */
  187. void setTransactionIsolation(int level) throws SQLException;
  188. /**
  189. * Retrieves the <code>Map</code> object associated with this
  190. * <code>RowSet</code> object, which specifies the custom mapping
  191. * of SQL user-defined types, if any. The default is for the
  192. * type map to be empty.
  193. *
  194. * @return a <code>java.util.Map</code> object containing the names of
  195. * SQL user-defined types and the Java classes to which they are
  196. * to be mapped
  197. *
  198. * @exception SQLException if a database access error occurs
  199. * @see #setTypeMap
  200. */
  201. java.util.Map getTypeMap() throws SQLException;
  202. /**
  203. * Installs the given <code>java.util.Map</code> object as the default
  204. * type map for this <code>RowSet</code> object. This type map will be
  205. * used unless another type map is supplied as a method parameter.
  206. *
  207. * @param map a <code>java.util.Map</code> object containing the names of
  208. * SQL user-defined types and the Java classes to which they are
  209. * to be mapped
  210. * @exception SQLException if a database access error occurs
  211. * @see #getTypeMap
  212. */
  213. void setTypeMap(java.util.Map map) throws SQLException;
  214. //-----------------------------------------------------------------------
  215. // The following properties may be used to create a Statement.
  216. //-----------------------------------------------------------------------
  217. /**
  218. * Retrieves this <code>RowSet</code> object's command property.
  219. *
  220. * The command property contains a command string, which must be an SQL
  221. * query, that can be executed to fill the rowset with data.
  222. * The default value is <code>null</code>.
  223. *
  224. * @return the command string; may be <code>null</code>
  225. * @see #setCommand
  226. */
  227. String getCommand();
  228. /**
  229. * Sets this <code>RowSet</code> object's command property to the given
  230. * SQL query.
  231. *
  232. * This property is optional
  233. * when a rowset gets its data from a data source that does not support
  234. * commands, such as a spreadsheet.
  235. *
  236. * @param cmd the SQL query that will be used to get the data for this
  237. * <code>RowSet</code> object; may be <code>null</code>
  238. * @exception SQLException if a database access error occurs
  239. * @see #getCommand
  240. */
  241. void setCommand(String cmd) throws SQLException;
  242. /**
  243. * Retrieves whether this <code>RowSet</code> object is read-only.
  244. * If updates are possible, the default is for a rowset to be
  245. * updatable.
  246. * <P>
  247. * Attempts to update a read-only rowset will result in an
  248. * <code>SQLException</code> being thrown.
  249. *
  250. * @return <code>true</code> if this <code>RowSet</code> object is
  251. * read-only; <code>false</code> if it is updatable
  252. * @see #setReadOnly
  253. */
  254. boolean isReadOnly();
  255. /**
  256. * Sets whether this <code>RowSet</code> object is read-only to the
  257. * given <code>boolean</code>.
  258. *
  259. * @param value <code>true</code> if read-only; <code>false</code> if
  260. * updatable
  261. * @exception SQLException if a database access error occurs
  262. * @see #isReadOnly
  263. */
  264. void setReadOnly(boolean value) throws SQLException;
  265. /**
  266. * Retrieves the maximum number of bytes that may be returned
  267. * for certain column values.
  268. * This limit applies only to <code>BINARY</code>,
  269. * <code>VARBINARY</code>, <code>LONGVARBINARYBINARY</code>, <code>CHAR</code>,
  270. * <code>VARCHAR</code>, and <code>LONGVARCHAR</code> columns.
  271. * If the limit is exceeded, the excess data is silently discarded.
  272. *
  273. * @return the current maximum column size limit; zero means that there
  274. * is no limit
  275. * @exception SQLException if a database access error occurs
  276. * @see #setMaxFieldSize
  277. */
  278. int getMaxFieldSize() throws SQLException;
  279. /**
  280. * Sets the maximum number of bytes that can be returned for a column
  281. * value to the given number of bytes.
  282. * This limit applies only to <code>BINARY</code>,
  283. * <code>VARBINARY</code>, <code>LONGVARBINARYBINARY</code>, <code>CHAR</code>,
  284. * <code>VARCHAR</code>, and <code>LONGVARCHAR</code> columns.
  285. * If the limit is exceeded, the excess data is silently discarded.
  286. * For maximum portability, use values greater than 256.
  287. *
  288. * @param max the new max column size limit in bytes; zero means unlimited
  289. * @exception SQLException if a database access error occurs
  290. * @see #getMaxFieldSize
  291. */
  292. void setMaxFieldSize(int max) throws SQLException;
  293. /**
  294. * Retrieves the maximum number of rows that this <code>RowSet</code>
  295. * object can contain.
  296. * If the limit is exceeded, the excess rows are silently dropped.
  297. *
  298. * @return the current maximum number of rows that this <code>RowSet</code>
  299. * object can contain; zero means unlimited
  300. * @exception SQLException if a database access error occurs
  301. * @see #setMaxRows
  302. */
  303. int getMaxRows() throws SQLException;
  304. /**
  305. * Sets the maximum number of rows that this <code>RowSet</code>
  306. * object can contain to the specified number.
  307. * If the limit is exceeded, the excess rows are silently dropped.
  308. *
  309. * @param max the new maximum number of rows; zero means unlimited
  310. * @exception SQLException if a database access error occurs
  311. * @see #getMaxRows
  312. */
  313. void setMaxRows(int max) throws SQLException;
  314. /**
  315. * Retrieves whether escape processing is enabled for this
  316. * <code>RowSet</code> object.
  317. * If escape scanning is enabled, which is the default, the driver will do
  318. * escape substitution before sending an SQL statement to the database.
  319. *
  320. * @return <code>true</code> if escape processing is enabled;
  321. * <code>false</code> if it is disabled
  322. * @exception SQLException if a database access error occurs
  323. * @see #setEscapeProcessing
  324. */
  325. boolean getEscapeProcessing() throws SQLException;
  326. /**
  327. * Sets escape processing for this <code>RowSet</code> object on or
  328. * off. If escape scanning is on (the default), the driver will do
  329. * escape substitution before sending an SQL statement to the database.
  330. *
  331. * @param enable <code>true</code> to enable escape processing;
  332. * <code>false</code> to disable it
  333. * @exception SQLException if a database access error occurs
  334. * @see #getEscapeProcessing
  335. */
  336. void setEscapeProcessing(boolean enable) throws SQLException;
  337. /**
  338. * Retrieves the maximum number of seconds the driver will wait for
  339. * a statement to execute.
  340. * If this limit is exceeded, an <code>SQLException</code> is thrown.
  341. *
  342. * @return the current query timeout limit in seconds; zero means
  343. * unlimited
  344. * @exception SQLException if a database access error occurs
  345. * @see #setQueryTimeout
  346. */
  347. int getQueryTimeout() throws SQLException;
  348. /**
  349. * Sets the maximum time the driver will wait for
  350. * a statement to execute to the given number of seconds.
  351. * If this limit is exceeded, an <code>SQLException</code> is thrown.
  352. *
  353. * @param seconds the new query timeout limit in seconds; zero means
  354. * that there is no limit
  355. * @exception SQLException if a database access error occurs
  356. * @see #getQueryTimeout
  357. */
  358. void setQueryTimeout(int seconds) throws SQLException;
  359. /**
  360. * Sets the type of this <code>RowSet</code> object to the given type.
  361. * This method is used to change the type of a rowset, which is by
  362. * default read-only and non-scrollable.
  363. *
  364. * @param type one of the <code>ResultSet</code> constants specifying a type:
  365. * <code>ResultSet.TYPE_FORWARD_ONLY</code>,
  366. * <code>ResultSet.TYPE_SCROLL_INSENSITIVE</code>, or
  367. * <code>ResultSet.TYPE_SCROLL_SENSITIVE</code>
  368. * @exception SQLException if a database access error occurs
  369. * @see java.sql.ResultSet#getType
  370. */
  371. void setType(int type) throws SQLException;
  372. /**
  373. * Sets the concurrency of this <code>RowSet</code> object to the given
  374. * concurrency level. This method is used to change the concurrency level
  375. * of a rowset, which is by default <code>ResultSet.CONCUR_READ_ONLY</code>
  376. *
  377. * @param concurrency one of the <code>ResultSet</code> constants specifying a
  378. * concurrency level: <code>ResultSet.CONCUR_READ_ONLY</code> or
  379. * <code>ResultSet.CONCUR_UPDATABLE</code>
  380. * @exception SQLException if a database access error occurs
  381. * @see ResultSet#getConcurrency
  382. */
  383. void setConcurrency(int concurrency) throws SQLException;
  384. //-----------------------------------------------------------------------
  385. // Parameters
  386. //-----------------------------------------------------------------------
  387. /**
  388. * The <code>RowSet</code> setter methods are used to set any input parameters
  389. * needed by the <code>RowSet</code> object's command.
  390. * Parameters are set at run time, as opposed to design time.
  391. */
  392. /**
  393. * Sets the designated parameter in this <code>RowSet</code> object's SQL
  394. * command to SQL <code>NULL</code>.
  395. *
  396. * <P><B>Note:</B> You must specify the parameter's SQL type.
  397. *
  398. * @param parameterIndex the first parameter is 1, the second is 2, ...
  399. * @param sqlType a SQL type code defined by <code>java.sql.Types</code>
  400. * @exception SQLException if a database access error occurs
  401. */
  402. void setNull(int parameterIndex, int sqlType) throws SQLException;
  403. /**
  404. * Sets the designated parameter in this <code>RowSet</code> object's SQL
  405. * command to SQL <code>NULL</code>. This version of the method <code>setNull</code>
  406. * should be used for SQL user-defined types (UDTs) and <code>REF</code> type
  407. * parameters. Examples of UDTs include: <code>STRUCT</code>, <code>DISTINCT</code>,
  408. * <code>JAVA_OBJECT</code>, and named array types.
  409. *
  410. * <P><B>Note:</B> To be portable, applications must give the
  411. * SQL type code and the fully qualified SQL type name when specifying
  412. * a NULL UDT or <code>REF</code> parameter. In the case of a UDT,
  413. * the name is the type name of the parameter itself. For a <code>REF</code>
  414. * parameter, the name is the type name of the referenced type. If
  415. * a JDBC driver does not need the type code or type name information,
  416. * it may ignore it.
  417. *
  418. * Although it is intended for UDT and <code>REF</code> parameters,
  419. * this method may be used to set a null parameter of any JDBC type.
  420. * If the parameter does not have a user-defined or <code>REF</code> type,
  421. * the typeName parameter is ignored.
  422. *
  423. *
  424. * @param paramIndex the first parameter is 1, the second is 2, ...
  425. * @param sqlType a value from <code>java.sql.Types</code>
  426. * @param typeName the fully qualified name of an SQL UDT or the type
  427. * name of the SQL structured type being referenced by a <code>REF</code>
  428. * type; ignored if the parameter is not a UDT or <code>REF</code> type
  429. * @exception SQLException if a database access error occurs
  430. */
  431. void setNull (int paramIndex, int sqlType, String typeName)
  432. throws SQLException;
  433. /**
  434. * Sets the designated parameter in this <code>RowSet</code> object's command
  435. * to the given Java <code>boolean</code> value. The driver converts this to
  436. * an SQL <code>BIT</code> value before sending it to the database.
  437. *
  438. * @param parameterIndex the first parameter is 1, the second is 2, ...
  439. * @param x the parameter value
  440. * @exception SQLException if a database access error occurs
  441. */
  442. void setBoolean(int parameterIndex, boolean x) throws SQLException;
  443. /**
  444. * Sets the designated parameter in this <code>RowSet</code> object's command
  445. * to the given Java <code>byte</code> value. The driver converts this to
  446. * an SQL <code>TINYINT</code> value before sending it to the database.
  447. *
  448. * @param parameterIndex the first parameter is 1, the second is 2, ...
  449. * @param x the parameter value
  450. * @exception SQLException if a database access error occurs
  451. */
  452. void setByte(int parameterIndex, byte x) throws SQLException;
  453. /**
  454. * Sets the designated parameter in this <code>RowSet</code> object's command
  455. * to the given Java <code>short</code> value. The driver converts this to
  456. * an SQL <code>SMALLINT</code> value before sending it to the database.
  457. *
  458. * @param parameterIndex the first parameter is 1, the second is 2, ...
  459. * @param x the parameter value
  460. * @exception SQLException if a database access error occurs
  461. */
  462. void setShort(int parameterIndex, short x) throws SQLException;
  463. /**
  464. * Sets the designated parameter in this <code>RowSet</code> object's command
  465. * to the given Java <code>int</code> value. The driver converts this to
  466. * an SQL <code>INTEGER</code> value before sending it to the database.
  467. *
  468. * @param parameterIndex the first parameter is 1, the second is 2, ...
  469. * @param x the parameter value
  470. * @exception SQLException if a database access error occurs
  471. */
  472. void setInt(int parameterIndex, int x) throws SQLException;
  473. /**
  474. * Sets the designated parameter in this <code>RowSet</code> object's command
  475. * to the given Java <code>long</code> value. The driver converts this to
  476. * an SQL <code>BIGINT</code> value before sending it to the database.
  477. *
  478. * @param parameterIndex the first parameter is 1, the second is 2, ...
  479. * @param x the parameter value
  480. * @exception SQLException if a database access error occurs
  481. */
  482. void setLong(int parameterIndex, long x) throws SQLException;
  483. /**
  484. * Sets the designated parameter in this <code>RowSet</code> object's command
  485. * to the given Java <code>float</code> value. The driver converts this to
  486. * an SQL <code>REAL</code> value before sending it to the database.
  487. *
  488. * @param parameterIndex the first parameter is 1, the second is 2, ...
  489. * @param x the parameter value
  490. * @exception SQLException if a database access error occurs
  491. */
  492. void setFloat(int parameterIndex, float x) throws SQLException;
  493. /**
  494. * Sets the designated parameter in this <code>RowSet</code> object's command
  495. * to the given Java <code>double</code> value. The driver converts this to
  496. * an SQL <code>DOUBLE</code> value before sending it to the database.
  497. *
  498. * @param parameterIndex the first parameter is 1, the second is 2, ...
  499. * @param x the parameter value
  500. * @exception SQLException if a database access error occurs
  501. */
  502. void setDouble(int parameterIndex, double x) throws SQLException;
  503. /**
  504. * Sets the designated parameter in this <code>RowSet</code> object's command
  505. * to the given <code>java.math.BigDeciaml</code> value.
  506. * The driver converts this to
  507. * an SQL <code>NUMERIC</code> value before sending it to the database.
  508. *
  509. * @param parameterIndex the first parameter is 1, the second is 2, ...
  510. * @param x the parameter value
  511. * @exception SQLException if a database access error occurs
  512. */
  513. void setBigDecimal(int parameterIndex, BigDecimal x) throws SQLException;
  514. /**
  515. * Sets the designated parameter in this <code>RowSet</code> object's command
  516. * to the given Java <code>String</code> value. Before sending it to the
  517. * database, the driver converts this to an SQL <code>VARCHAR</code> or
  518. * <code>LONGVARCHAR</code> value, depending on the argument's size relative
  519. * to the driver's limits on <code>VARCHAR</code> values.
  520. *
  521. * @param parameterIndex the first parameter is 1, the second is 2, ...
  522. * @param x the parameter value
  523. * @exception SQLException if a database access error occurs
  524. */
  525. void setString(int parameterIndex, String x) throws SQLException;
  526. /**
  527. * Sets the designated parameter in this <code>RowSet</code> object's command
  528. * to the given Java array of <code>byte</code> values. Before sending it to the
  529. * database, the driver converts this to an SQL <code>VARBINARY</code> or
  530. * <code>LONGVARBINARY</code> value, depending on the argument's size relative
  531. * to the driver's limits on <code>VARBINARY</code> values.
  532. *
  533. * @param parameterIndex the first parameter is 1, the second is 2, ...
  534. * @param x the parameter value
  535. * @exception SQLException if a database access error occurs
  536. */
  537. void setBytes(int parameterIndex, byte x[]) throws SQLException;
  538. /**
  539. * Sets the designated parameter in this <code>RowSet</code> object's command
  540. * to the given <code>java.sql.Date</code> value. The driver converts this to
  541. * an SQL <code>DATE</code> value before sending it to the database, using the
  542. * default <code>java.util.Calendar</code> to calculate the date.
  543. *
  544. * @param parameterIndex the first parameter is 1, the second is 2, ...
  545. * @param x the parameter value
  546. * @exception SQLException if a database access error occurs
  547. */
  548. void setDate(int parameterIndex, java.sql.Date x) throws SQLException;
  549. /**
  550. * Sets the designated parameter in this <code>RowSet</code> object's command
  551. * to the given <code>java.sql.Time</code> value. The driver converts this to
  552. * an SQL <code>TIME</code> value before sending it to the database, using the
  553. * default <code>java.util.Calendar</code> to calculate it.
  554. *
  555. * @param parameterIndex the first parameter is 1, the second is 2, ...
  556. * @param x the parameter value
  557. * @exception SQLException if a database access error occurs
  558. */
  559. void setTime(int parameterIndex, java.sql.Time x) throws SQLException;
  560. /**
  561. * Sets the designated parameter in this <code>RowSet</code> object's command
  562. * to the given <code>java.sql.Timestamp</code> value. The driver converts this to
  563. * an SQL <code>TIMESTAMP</code> value before sending it to the database, using the
  564. * default <code>java.util.Calendar</code> to calculate it.
  565. *
  566. * @param parameterIndex the first parameter is 1, the second is 2, ...
  567. * @param x the parameter value
  568. * @exception SQLException if a database access error occurs
  569. */
  570. void setTimestamp(int parameterIndex, java.sql.Timestamp x)
  571. throws SQLException;
  572. /**
  573. * Sets the designated parameter in this <code>RowSet</code> object's command
  574. * to the given <code>java.io.InputStream</code> value.
  575. * It may be more practical to send a very large ASCII value via a
  576. * <code>java.io.InputStream</code> rather than as a <code>LONGVARCHAR</code>
  577. * parameter. The driver will read the data from the stream
  578. * as needed until it reaches end-of-file.
  579. *
  580. * <P><B>Note:</B> This stream object can either be a standard
  581. * Java stream object or your own subclass that implements the
  582. * standard interface.
  583. *
  584. * @param parameterIndex the first parameter is 1, the second is 2, ...
  585. * @param x the Java input stream that contains the ASCII parameter value
  586. * @param length the number of bytes in the stream
  587. * @exception SQLException if a database access error occurs
  588. */
  589. void setAsciiStream(int parameterIndex, java.io.InputStream x, int length)
  590. throws SQLException;
  591. /**
  592. * Sets the designated parameter in this <code>RowSet</code> object's command
  593. * to the given <code>java.io.InputStream</code> value.
  594. * It may be more practical to send a very large binary value via a
  595. * <code>java.io.InputStream</code> rather than as a <code>LONGVARBINARY</code>
  596. * parameter. The driver will read the data from the stream
  597. * as needed until it reaches end-of-file.
  598. *
  599. * <P><B>Note:</B> This stream object can either be a standard
  600. * Java stream object or your own subclass that implements the
  601. * standard interface.
  602. *
  603. * @param parameterIndex the first parameter is 1, the second is 2, ...
  604. * @param x the java input stream which contains the binary parameter value
  605. * @param length the number of bytes in the stream
  606. * @exception SQLException if a database access error occurs
  607. */
  608. void setBinaryStream(int parameterIndex, java.io.InputStream x,
  609. int length) throws SQLException;
  610. /**
  611. * Sets the designated parameter in this <code>RowSet</code> object's command
  612. * to the given <code>java.io.Reader</code> value.
  613. * It may be more practical to send a very large UNICODE value via a
  614. * <code>java.io.Reader</code> rather than as a <code>LONGVARCHAR</code>
  615. * parameter. The driver will read the data from the stream
  616. * as needed until it reaches end-of-file.
  617. *
  618. * <P><B>Note:</B> This stream object can either be a standard
  619. * Java stream object or your own subclass that implements the
  620. * standard interface.
  621. *
  622. * @param parameterIndex the first parameter is 1, the second is 2, ...
  623. * @param reader the <code>Reader</code> object that contains the UNICODE data
  624. * to be set
  625. * @param length the number of characters in the stream
  626. * @exception SQLException if a database access error occurs
  627. */
  628. void setCharacterStream(int parameterIndex,
  629. Reader reader,
  630. int length) throws SQLException;
  631. /**
  632. * Sets the designated parameter in this <code>RowSet</code> object's command
  633. * with the given Java <code>Object</code>. For integral values, the
  634. * <code>java.lang</code> equivalent objects should be used (for example,
  635. * an instance of the class <code>Integer</code> for an <code>int</code>).
  636. *
  637. * <p>The given Java object will be converted to the targetSqlType
  638. * before being sent to the database.
  639. * <P>
  640. * If the object is of a class implementing <code>SQLData</code>,
  641. * the rowset should call the method <code>SQLData.writeSQL</code>
  642. * to write the object to an <code>SQLOutput</code> data stream.
  643. * If the object is an instance of a class implementing the <code>Ref</code>,
  644. * <code>Struct</code>, <code>Array</code>, <code>Blob</code>,
  645. * or <code>Clob</code> interfaces,
  646. * the driver uses the default mapping to the corresponding SQL type.
  647. *
  648. * <p>Note that this method may be used to pass datatabase-specific
  649. * abstract data types.
  650. *
  651. * @param parameterIndex the first parameter is 1, the second is 2, ...
  652. * @param x the object containing the input parameter value
  653. * @param targetSqlType the SQL type (as defined in <code>java.sql.Types</code>)
  654. * to be sent to the database. The scale argument may further qualify this
  655. * type.
  656. * @param scale for <code>java.sql.Types.DECIMAL</code> or
  657. * <code>java.sql.Types.NUMERIC</code> types, this is the number of
  658. * digits after the decimal point. For all other types, this value
  659. * will be ignored.
  660. * @exception SQLException if a database access error occurs
  661. * @see java.sql.Types
  662. */
  663. void setObject(int parameterIndex, Object x, int targetSqlType, int scale)
  664. throws SQLException;
  665. /**
  666. * Sets the designated parameter in this <code>RowSet</code> object's command
  667. * with a Java <code>Object</code>. For integral values, the
  668. * <code>java.lang</code> equivalent objects should be used.
  669. * This method is like <code>setObject</code> above, but the scale used is the scale
  670. * of the second parameter. Scalar values have a scale of zero. Literal
  671. * values have the scale present in the literal.
  672. * <P>
  673. * Even though it is supported, it is not recommended that this method
  674. * be called with floating point input values.
  675. *
  676. * @param parameterIndex the first parameter is 1, the second is 2, ...
  677. * @param x the object containing the input parameter value
  678. * @param targetSqlType the SQL type (as defined in <code>java.sql.Types</code>)
  679. * to be sent to the database
  680. * @exception SQLException if a database access error occurs
  681. */
  682. void setObject(int parameterIndex, Object x,
  683. int targetSqlType) throws SQLException;
  684. /**
  685. * Sets the designated parameter in this <code>RowSet</code> object's command
  686. * with a Java <code>Object</code>. For integral values, the
  687. * <code>java.lang</code> equivalent objects should be used.
  688. *
  689. * <p>The JDBC specification provides a standard mapping from
  690. * Java Object types to SQL types. The driver will convert the
  691. * given Java object to its standard SQL mapping before sending it
  692. * to the database.
  693. *
  694. * <p>Note that this method may be used to pass datatabase-specific
  695. * abstract data types by using a driver-specific Java type.
  696. *
  697. * If the object is of a class implementing <code>SQLData</code>,
  698. * the rowset should call the method <code>SQLData.writeSQL</code>
  699. * to write the object to an <code>SQLOutput</code> data stream.
  700. * If the object is an instance of a class implementing the <code>Ref</code>,
  701. * <code>Struct</code>, <code>Array</code>, <code>Blob</code>,
  702. * or <code>Clob</code> interfaces,
  703. * the driver uses the default mapping to the corresponding SQL type.
  704. * <P>
  705. * An exception is thrown if there is an ambiguity, for example, if the
  706. * object is of a class implementing more than one of these interfaces.
  707. *
  708. * @param parameterIndex The first parameter is 1, the second is 2, ...
  709. * @param x The object containing the input parameter value
  710. * @exception SQLException if a database access error occurs
  711. */
  712. void setObject(int parameterIndex, Object x) throws SQLException;
  713. /**
  714. * Sets the designated parameter in this <code>RowSet</code> object's command
  715. * with the given <code>Ref</code> value. The driver will convert this
  716. * to the appropriate <code>REF(<structured-type>)</code> value.
  717. *
  718. * @param i the first parameter is 1, the second is 2, ...
  719. * @param x an object representing data of an SQL <code>REF</code> type
  720. * @exception SQLException if a database access error occurs
  721. */
  722. void setRef (int i, Ref x) throws SQLException;
  723. /**
  724. * Sets the designated parameter in this <code>RowSet</code> object's command
  725. * with the given <code>Blob</code> value. The driver will convert this
  726. * to the <code>BLOB</code> value that the <code>Blob</code> object
  727. * represents before sending it to the database.
  728. *
  729. * @param i the first parameter is 1, the second is 2, ...
  730. * @param x an object representing a BLOB
  731. * @exception SQLException if a database access error occurs
  732. */
  733. void setBlob (int i, Blob x) throws SQLException;
  734. /**
  735. * Sets the designated parameter in this <code>RowSet</code> object's command
  736. * with the given <code>Clob</code> value. The driver will convert this
  737. * to the <code>CLOB</code> value that the <code>Clob</code> object
  738. * represents before sending it to the database.
  739. *
  740. * @param i the first parameter is 1, the second is 2, ...
  741. * @param x an object representing a CLOB
  742. * @exception SQLException if a database access error occurs
  743. */
  744. void setClob (int i, Clob x) throws SQLException;
  745. /**
  746. * Sets the designated parameter in this <code>RowSet</code> object's command
  747. * with the given <code>Array</code> value. The driver will convert this
  748. * to the <code>ARRAY</code> value that the <code>Array</code> object
  749. * represents before sending it to the database.
  750. *
  751. * @param i the first parameter is 1, the second is 2, ...
  752. * @param x an object representing an SQL array
  753. * @exception SQLException if a database access error occurs
  754. */
  755. void setArray (int i, Array x) throws SQLException;
  756. /**
  757. * Sets the designated parameter in this <code>RowSet</code> object's command
  758. * with the given <code>java.sql.Date</code> value. The driver will convert this
  759. * to an SQL <code>DATE</code> value, using the given <code>java.util.Calendar</code>
  760. * object to calculate the date.
  761. *
  762. * @param parameterIndex the first parameter is 1, the second is 2, ...
  763. * @param x the parameter value
  764. * @param cal the <code>java.util.Calendar</code> object to use for calculating the date
  765. * @exception SQLException if a database access error occurs
  766. */
  767. void setDate(int parameterIndex, java.sql.Date x, Calendar cal)
  768. throws SQLException;
  769. /**
  770. * Sets the designated parameter in this <code>RowSet</code> object's command
  771. * with the given <code>java.sql.Time</code> value. The driver will convert this
  772. * to an SQL <code>TIME</code> value, using the given <code>java.util.Calendar</code>
  773. * object to calculate it, before sending it to the database.
  774. *
  775. * @param parameterIndex the first parameter is 1, the second is 2, ...
  776. * @param x the parameter value
  777. * @param cal the <code>java.util.Calendar</code> object to use for calculating the time
  778. * @exception SQLException if a database access error occurs
  779. */
  780. void setTime(int parameterIndex, java.sql.Time x, Calendar cal)
  781. throws SQLException;
  782. /**
  783. * Sets the designated parameter in this <code>RowSet</code> object's command
  784. * with the given <code>java.sql.Timestamp</code> value. The driver will
  785. * convert this to an SQL <code>TIMESTAMP</code> value, using the given
  786. * <code>java.util.Calendar</code> object to calculate it, before sending it to the
  787. * database.
  788. *
  789. * @param parameterIndex the first parameter is 1, the second is 2, ...
  790. * @param x the parameter value
  791. * @param cal the <code>java.util.Calendar</code> object to use for calculating the
  792. * timestamp
  793. * @exception SQLException if a database access error occurs
  794. */
  795. void setTimestamp(int parameterIndex, java.sql.Timestamp x, Calendar cal)
  796. throws SQLException;
  797. /**
  798. * Clears the parameters set for this <code>RowSet</code> object's command.
  799. * <P>In general, parameter values remain in force for repeated use of a
  800. * <code>RowSet</code> object. Setting a parameter value automatically clears its
  801. * previous value. However, in some cases it is useful to immediately
  802. * release the resources used by the current parameter values, which can
  803. * be done by calling the method <code>clearParameters</code>.
  804. *
  805. * @exception SQLException if a database access error occurs
  806. */
  807. void clearParameters() throws SQLException;
  808. //---------------------------------------------------------------------
  809. // Reading and writing data
  810. //---------------------------------------------------------------------
  811. /**
  812. * Fills this <code>RowSet</code> object with data.
  813. * <P>
  814. * The <code>execute</code> method may use the following properties
  815. * to create a connection for reading data: url, data source name,
  816. * user name, password, transaction isolation, and type map.
  817. *
  818. * The <code>execute</code> method may use the following properties
  819. * to create a statement to execute a command:
  820. * command, read only, maximum field size,
  821. * maximum rows, escape processing, and query timeout.
  822. * <P>
  823. * If the required properties have not been set, an exception is
  824. * thrown. If this method is successful, the current contents of the rowset are
  825. * discarded and the rowset's metadata is also (re)set. If there are
  826. * outstanding updates, they are ignored.
  827. * <P>
  828. * If this <code>RowSet</code> object does not maintain a continuous connection
  829. * with its source of data, it may use a reader (a <code>RowSetReader</code>
  830. * object) to fill itself with data. In this case, a reader will have been
  831. * registered with this <code>RowSet</code> object, and the method
  832. * <code>execute</code> will call on the reader's <code>readData</code>
  833. * method as part of its implementation.
  834. *
  835. * @exception SQLException if a database access error occurs or any of the
  836. * properties necessary for making a connection and creating
  837. * a statement have not been set
  838. */
  839. void execute() throws SQLException;
  840. //--------------------------------------------------------------------
  841. // Events
  842. //--------------------------------------------------------------------
  843. /**
  844. * Registers the given listener so that it will be notified of events
  845. * that occur on this <code>RowSet</code> object.
  846. *
  847. * @param listener a component that has implemented the <code>RowSetListener</code>
  848. * interface and wants to be notified when events occur on this
  849. * <code>RowSet</code> object
  850. * @see #removeRowSetListener
  851. */
  852. void addRowSetListener(RowSetListener listener);
  853. /**
  854. * Removes the specified listener from the list of components that will be
  855. * notified when an event occurs on this <code>RowSet</code> object.
  856. *
  857. * @param listener a component that has been registered as a listener for this
  858. * <code>RowSet</code> object
  859. * @see #addRowSetListener
  860. */
  861. void removeRowSetListener(RowSetListener listener);
  862. }