1. /*
  2. * @(#)ResultSet.java 1.20 01/11/29
  3. *
  4. * Copyright 2002 Sun Microsystems, Inc. All rights reserved.
  5. * SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
  6. */
  7. package java.sql;
  8. import java.math.BigDecimal;
  9. import java.util.Calendar;
  10. /**
  11. * <P>A ResultSet provides access to a table of data. A ResultSet
  12. * object is usually generated by executing a Statement.
  13. *
  14. * <P>A ResultSet maintains a cursor pointing to its current row of
  15. * data. Initially the cursor is positioned before the first row.
  16. * The 'next' method moves the cursor to the next row.
  17. *
  18. * <P>The getXXX methods retrieve column values for the current
  19. * row. You can retrieve values using either the index number of the
  20. * column or the name of the column. In general, using the
  21. * column index will be more efficient. Columns are numbered from 1.
  22. *
  23. * <P>For maximum portability, ResultSet columns within each row should be
  24. * read in left-to-right order and each column should be read only once.
  25. *
  26. * <P>For the getXXX methods, the JDBC driver attempts to convert the
  27. * underlying data to the specified Java type and returns a suitable
  28. * Java value. See the JDBC specification for allowable mappings
  29. * from SQL types to Java types with the ResultSet.getXXX methods.
  30. *
  31. * <P>Column names used as input to getXXX methods are case
  32. * insensitive. When performing a getXXX using a column name, if
  33. * several columns have the same name, then the value of the first
  34. * matching column will be returned. The column name option is
  35. * designed to be used when column names are used in the SQL
  36. * query. For columns that are NOT explicitly named in the query, it
  37. * is best to use column numbers. If column names are used, there is
  38. * no way for the programmer to guarantee that they actually refer to
  39. * the intended columns.
  40. *
  41. * <P>A ResultSet is automatically closed by the Statement that
  42. * generated it when that Statement is closed, re-executed, or used
  43. * to retrieve the next result from a sequence of multiple results.
  44. *
  45. * <P>The number, types and properties of a ResultSet's columns are
  46. * provided by the ResulSetMetaData object returned by the getMetaData
  47. * method.
  48. *
  49. * @see Statement#executeQuery
  50. * @see Statement#getResultSet
  51. * @see ResultSetMetaData
  52. */
  53. public interface ResultSet {
  54. /**
  55. * Moves the cursor down one row from its current position.
  56. * A ResultSet cursor is initially positioned before the first row; the
  57. * first call to next makes the first row the current row; the
  58. * second call makes the second row the current row, and so on.
  59. *
  60. * <P>If an input stream is open for the current row, a call
  61. * to the method <code>next</code> will
  62. * implicitly close it. The ResultSet's warning chain is cleared
  63. * when a new row is read.
  64. *
  65. * @return true if the new current row is valid; false if there
  66. * are no more rows
  67. * @exception SQLException if a database access error occurs
  68. */
  69. boolean next() throws SQLException;
  70. /**
  71. * Releases this <code>ResultSet</code> object's database and
  72. * JDBC resources immediately instead of waiting for
  73. * this to happen when it is automatically closed.
  74. *
  75. * <P><B>Note:</B> A ResultSet is automatically closed by the
  76. * Statement that generated it when that Statement is closed,
  77. * re-executed, or is used to retrieve the next result from a
  78. * sequence of multiple results. A ResultSet is also automatically
  79. * closed when it is garbage collected.
  80. *
  81. * @exception SQLException if a database access error occurs
  82. */
  83. void close() throws SQLException;
  84. /**
  85. * Reports whether
  86. * the last column read had a value of SQL NULL.
  87. * Note that you must first call getXXX on a column to try to read
  88. * its value and then call wasNull() to see if the value read was
  89. * SQL NULL.
  90. *
  91. * @return true if last column read was SQL NULL and false otherwise
  92. * @exception SQLException if a database access error occurs
  93. */
  94. boolean wasNull() throws SQLException;
  95. //======================================================================
  96. // Methods for accessing results by column index
  97. //======================================================================
  98. /**
  99. * Gets the value of a column in the current row as a Java String.
  100. *
  101. * @param columnIndex the first column is 1, the second is 2, ...
  102. * @return the column value; if the value is SQL NULL, the result is null
  103. * @exception SQLException if a database access error occurs
  104. */
  105. String getString(int columnIndex) throws SQLException;
  106. /**
  107. * Gets the value of a column in the current row as a Java boolean.
  108. *
  109. * @param columnIndex the first column is 1, the second is 2, ...
  110. * @return the column value; if the value is SQL NULL, the result is false
  111. * @exception SQLException if a database access error occurs
  112. */
  113. boolean getBoolean(int columnIndex) throws SQLException;
  114. /**
  115. * Gets the value of a column in the current row as a Java byte.
  116. *
  117. * @param columnIndex the first column is 1, the second is 2, ...
  118. * @return the column value; if the value is SQL NULL, the result is 0
  119. * @exception SQLException if a database access error occurs
  120. */
  121. byte getByte(int columnIndex) throws SQLException;
  122. /**
  123. * Gets the value of a column in the current row as a Java short.
  124. *
  125. * @param columnIndex the first column is 1, the second is 2, ...
  126. * @return the column value; if the value is SQL NULL, the result is 0
  127. * @exception SQLException if a database access error occurs
  128. */
  129. short getShort(int columnIndex) throws SQLException;
  130. /**
  131. * Gets the value of a column in the current row as a Java int.
  132. *
  133. * @param columnIndex the first column is 1, the second is 2, ...
  134. * @return the column value; if the value is SQL NULL, the result is 0
  135. * @exception SQLException if a database access error occurs
  136. */
  137. int getInt(int columnIndex) throws SQLException;
  138. /**
  139. * Gets the value of a column in the current row as a Java long.
  140. *
  141. * @param columnIndex the first column is 1, the second is 2, ...
  142. * @return the column value; if the value is SQL NULL, the result is 0
  143. * @exception SQLException if a database access error occurs
  144. */
  145. long getLong(int columnIndex) throws SQLException;
  146. /**
  147. * Gets the value of a column in the current row as a Java float.
  148. *
  149. * @param columnIndex the first column is 1, the second is 2, ...
  150. * @return the column value; if the value is SQL NULL, the result is 0
  151. * @exception SQLException if a database access error occurs
  152. */
  153. float getFloat(int columnIndex) throws SQLException;
  154. /**
  155. * Gets the value of a column in the current row as a Java double.
  156. *
  157. * @param columnIndex the first column is 1, the second is 2, ...
  158. * @return the column value; if the value is SQL NULL, the result is 0
  159. * @exception SQLException if a database access error occurs
  160. */
  161. double getDouble(int columnIndex) throws SQLException;
  162. /**
  163. * Gets the value of a column in the current row as a java.math.BigDecimal object.
  164. *
  165. * @param columnIndex the first column is 1, the second is 2, ...
  166. * @param scale the number of digits to the right of the decimal
  167. * @return the column value; if the value is SQL NULL, the result is null
  168. * @exception SQLException if a database access error occurs
  169. * @deprecated
  170. */
  171. BigDecimal getBigDecimal(int columnIndex, int scale) throws SQLException;
  172. /**
  173. * Gets the value of a column in the current row as a Java byte array.
  174. * The bytes represent the raw values returned by the driver.
  175. *
  176. * @param columnIndex the first column is 1, the second is 2, ...
  177. * @return the column value; if the value is SQL NULL, the result is null
  178. * @exception SQLException if a database access error occurs
  179. */
  180. byte[] getBytes(int columnIndex) throws SQLException;
  181. /**
  182. * Gets the value of a column in the current row as a java.sql.Date object.
  183. *
  184. * @param columnIndex the first column is 1, the second is 2, ...
  185. * @return the column value; if the value is SQL NULL, the result is null
  186. * @exception SQLException if a database access error occurs
  187. */
  188. java.sql.Date getDate(int columnIndex) throws SQLException;
  189. /**
  190. * Gets the value of a column in the current row as a java.sql.Time object.
  191. *
  192. * @param columnIndex the first column is 1, the second is 2, ...
  193. * @return the column value; if the value is SQL NULL, the result is null
  194. * @exception SQLException if a database access error occurs
  195. */
  196. java.sql.Time getTime(int columnIndex) throws SQLException;
  197. /**
  198. * Gets the value of a column in the current row as a java.sql.Timestamp object.
  199. *
  200. * @param columnIndex the first column is 1, the second is 2, ...
  201. * @return the column value; if the value is SQL NULL, the result is null
  202. * @exception SQLException if a database access error occurs
  203. */
  204. java.sql.Timestamp getTimestamp(int columnIndex) throws SQLException;
  205. /**
  206. * Gets the value of a column in the current row as a stream of
  207. * ASCII characters. The value can then be read in chunks from the
  208. * stream. This method is particularly
  209. * suitable for retrieving large LONGVARCHAR values. The JDBC driver will
  210. * do any necessary conversion from the database format into ASCII.
  211. *
  212. * <P><B>Note:</B> All the data in the returned stream must be
  213. * read prior to getting the value of any other column. The next
  214. * call to a get method implicitly closes the stream. Also, a
  215. * stream may return 0 when the method <code>available</code>
  216. * is called whether there is data
  217. * available or not.
  218. *
  219. * @param columnIndex the first column is 1, the second is 2, ...
  220. * @return a Java input stream that delivers the database column value
  221. * as a stream of one byte ASCII characters. If the value is SQL NULL
  222. * then the result is null.
  223. * @exception SQLException if a database access error occurs
  224. */
  225. java.io.InputStream getAsciiStream(int columnIndex) throws SQLException;
  226. /**
  227. * Gets the value of a column in the current row as a stream of
  228. * Unicode characters. The value can then be read in chunks from the
  229. * stream. This method is particularly
  230. * suitable for retrieving large LONGVARCHAR values. The JDBC driver will
  231. * do any necessary conversion from the database format into Unicode.
  232. * The byte format of the Unicode stream must Java UTF-8,
  233. * as specified in the Java Virtual Machine Specification.
  234. *
  235. * <P><B>Note:</B> All the data in the returned stream must be
  236. * read prior to getting the value of any other column. The next
  237. * call to a get method implicitly closes the stream. Also, a
  238. * stream may return 0 when the method <code>available</code>
  239. * is called whether there is data
  240. * available or not.
  241. *
  242. * @param columnIndex the first column is 1, the second is 2, ...
  243. * @return a Java input stream that delivers the database column value
  244. * as a stream of two-byte Unicode characters. If the value is SQL NULL
  245. * then the result is null.
  246. * @exception SQLException if a database access error occurs
  247. * @deprecated
  248. */
  249. java.io.InputStream getUnicodeStream(int columnIndex) throws SQLException;
  250. /**
  251. * Gets the value of a column in the current row as a stream of
  252. * uninterpreted bytes. The value can then be read in chunks from the
  253. * stream. This method is particularly
  254. * suitable for retrieving large LONGVARBINARY values.
  255. *
  256. * <P><B>Note:</B> All the data in the returned stream must be
  257. * read prior to getting the value of any other column. The next
  258. * call to a get method implicitly closes the stream. Also, a
  259. * stream may return 0 when the method <code>available</code>
  260. * is called whether there is data
  261. * available or not.
  262. *
  263. * @param columnIndex the first column is 1, the second is 2, ...
  264. * @return a Java input stream that delivers the database column value
  265. * as a stream of uninterpreted bytes. If the value is SQL NULL
  266. * then the result is null.
  267. * @exception SQLException if a database access error occurs
  268. */
  269. java.io.InputStream getBinaryStream(int columnIndex)
  270. throws SQLException;
  271. //======================================================================
  272. // Methods for accessing results by column name
  273. //======================================================================
  274. /**
  275. * Gets the value of a column in the current row as a Java String.
  276. *
  277. * @param columnName the SQL name of the column
  278. * @return the column value; if the value is SQL NULL, the result is null
  279. * @exception SQLException if a database access error occurs
  280. */
  281. String getString(String columnName) throws SQLException;
  282. /**
  283. * Gets the value of a column in the current row as a Java boolean.
  284. *
  285. * @param columnName the SQL name of the column
  286. * @return the column value; if the value is SQL NULL, the result is false
  287. * @exception SQLException if a database access error occurs
  288. */
  289. boolean getBoolean(String columnName) throws SQLException;
  290. /**
  291. * Gets the value of a column in the current row as a Java byte.
  292. *
  293. * @param columnName the SQL name of the column
  294. * @return the column value; if the value is SQL NULL, the result is 0
  295. * @exception SQLException if a database access error occurs
  296. */
  297. byte getByte(String columnName) throws SQLException;
  298. /**
  299. * Gets the value of a column in the current row as a Java short.
  300. *
  301. * @param columnName the SQL name of the column
  302. * @return the column value; if the value is SQL NULL, the result is 0
  303. * @exception SQLException if a database access error occurs
  304. */
  305. short getShort(String columnName) throws SQLException;
  306. /**
  307. * Gets the value of a column in the current row as a Java int.
  308. *
  309. * @param columnName the SQL name of the column
  310. * @return the column value; if the value is SQL NULL, the result is 0
  311. * @exception SQLException if a database access error occurs
  312. */
  313. int getInt(String columnName) throws SQLException;
  314. /**
  315. * Gets the value of a column in the current row as a Java long.
  316. *
  317. * @param columnName the SQL name of the column
  318. * @return the column value; if the value is SQL NULL, the result is 0
  319. * @exception SQLException if a database access error occurs
  320. */
  321. long getLong(String columnName) throws SQLException;
  322. /**
  323. * Gets the value of a column in the current row as a Java float.
  324. *
  325. * @param columnName the SQL name of the column
  326. * @return the column value; if the value is SQL NULL, the result is 0
  327. * @exception SQLException if a database access error occurs
  328. */
  329. float getFloat(String columnName) throws SQLException;
  330. /**
  331. * Gets the value of a column in the current row as a Java double.
  332. *
  333. * @param columnName the SQL name of the column
  334. * @return the column value; if the value is SQL NULL, the result is 0
  335. * @exception SQLException if a database access error occurs
  336. */
  337. double getDouble(String columnName) throws SQLException;
  338. /**
  339. * Gets the value of a column in the current row as a java.math.BigDecimal
  340. * object.
  341. *
  342. * @param columnName the SQL name of the column
  343. * @param scale the number of digits to the right of the decimal
  344. * @return the column value; if the value is SQL NULL, the result is null
  345. * @exception SQLException if a database access error occurs
  346. * @deprecated
  347. */
  348. BigDecimal getBigDecimal(String columnName, int scale) throws SQLException;
  349. /**
  350. * Gets the value of a column in the current row as a Java byte array.
  351. * The bytes represent the raw values returned by the driver.
  352. *
  353. * @param columnName the SQL name of the column
  354. * @return the column value; if the value is SQL NULL, the result is null
  355. * @exception SQLException if a database access error occurs
  356. */
  357. byte[] getBytes(String columnName) throws SQLException;
  358. /**
  359. * Gets the value of a column in the current row as a java.sql.Date object.
  360. *
  361. * @param columnName the SQL name of the column
  362. * @return the column value; if the value is SQL NULL, the result is null
  363. * @exception SQLException if a database access error occurs
  364. */
  365. java.sql.Date getDate(String columnName) throws SQLException;
  366. /**
  367. * Gets the value of a column in the current row as a java.sql.Time object.
  368. *
  369. * @param columnName the SQL name of the column
  370. * @return the column value; if the value is SQL NULL, the result is null
  371. * @exception SQLException if a database access error occurs
  372. */
  373. java.sql.Time getTime(String columnName) throws SQLException;
  374. /**
  375. * Gets the value of a column in the current row as a java.sql.Timestamp object.
  376. *
  377. * @param columnName the SQL name of the column
  378. * @return the column value; if the value is SQL NULL, the result is null
  379. * @exception SQLException if a database access error occurs
  380. */
  381. java.sql.Timestamp getTimestamp(String columnName) throws SQLException;
  382. /**
  383. * Gets the value of a column in the current row as a stream of
  384. * ASCII characters. The value can then be read in chunks from the
  385. * stream. This method is particularly
  386. * suitable for retrieving large LONGVARCHAR values. The JDBC driver will
  387. * do any necessary conversion from the database format into ASCII.
  388. *
  389. * <P><B>Note:</B> All the data in the returned stream must be
  390. * read prior to getting the value of any other column. The next
  391. * call to a get method implicitly closes the stream. Also, a
  392. * stream may return 0 when the method <code>available</code>
  393. * is called whether there is data
  394. * available or not.
  395. *
  396. * @param columnName the SQL name of the column
  397. * @return a Java input stream that delivers the database column value
  398. * as a stream of one byte ASCII characters. If the value is SQL NULL
  399. * then the result is null.
  400. * @exception SQLException if a database access error occurs
  401. */
  402. java.io.InputStream getAsciiStream(String columnName) throws SQLException;
  403. /**
  404. * Gets the value of a column in the current row as a stream of
  405. * Unicode characters. The value can then be read in chunks from the
  406. * stream. This method is particularly
  407. * suitable for retrieving large LONGVARCHAR values. The JDBC driver will
  408. * do any necessary conversion from the database format into Unicode.
  409. * The byte format of the Unicode stream must be Java UTF-8,
  410. * as defined in the Java Virtual Machine Specification.
  411. *
  412. * <P><B>Note:</B> All the data in the returned stream must be
  413. * read prior to getting the value of any other column. The next
  414. * call to a get method implicitly closes the stream. Also, a
  415. * stream may return 0 when the method <code>available</code>
  416. * is called whether there is data
  417. * available or not.
  418. *
  419. * @param columnName the SQL name of the column
  420. * @return a Java input stream that delivers the database column value
  421. * as a stream of two-byte Unicode characters. If the value is SQL NULL
  422. * then the result is null.
  423. * @exception SQLException if a database access error occurs
  424. * @deprecated
  425. */
  426. java.io.InputStream getUnicodeStream(String columnName) throws SQLException;
  427. /**
  428. * Gets the value of a column in the current row as a stream of
  429. * uninterpreted bytes. The value can then be read in chunks from the
  430. * stream. This method is particularly
  431. * suitable for retrieving large LONGVARBINARY values. The JDBC driver will
  432. * do any necessary conversion from the database format into uninterpreted
  433. * bytes.
  434. *
  435. * <P><B>Note:</B> All the data in the returned stream must be
  436. * read prior to getting the value of any other column. The next
  437. * call to a get method implicitly closes the stream. Also, a
  438. * stream may return 0 when the method <code>available</code>
  439. * is called whether there is data
  440. * available or not.
  441. *
  442. * @param columnName the SQL name of the column
  443. * @return a Java input stream that delivers the database column value
  444. * as a stream of uninterpreted bytes. If the value is SQL NULL
  445. * then the result is null.
  446. * @exception SQLException if a database access error occurs
  447. */
  448. java.io.InputStream getBinaryStream(String columnName)
  449. throws SQLException;
  450. //=====================================================================
  451. // Advanced features:
  452. //=====================================================================
  453. /**
  454. * <p>The first warning reported by calls on this ResultSet is
  455. * returned. Subsequent ResultSet warnings will be chained to this
  456. * SQLWarning.
  457. *
  458. * <P>The warning chain is automatically cleared each time a new
  459. * row is read.
  460. *
  461. * <P><B>Note:</B> This warning chain only covers warnings caused
  462. * by ResultSet methods. Any warning caused by statement methods
  463. * (such as reading OUT parameters) will be chained on the
  464. * Statement object.
  465. *
  466. * @return the first SQLWarning or null
  467. * @exception SQLException if a database access error occurs
  468. */
  469. SQLWarning getWarnings() throws SQLException;
  470. /**
  471. * After this call getWarnings returns null until a new warning is
  472. * reported for this ResultSet.
  473. *
  474. * @exception SQLException if a database access error occurs
  475. */
  476. void clearWarnings() throws SQLException;
  477. /**
  478. * Gets the name of the SQL cursor used by this ResultSet.
  479. *
  480. * <P>In SQL, a result table is retrieved through a cursor that is
  481. * named. The current row of a result can be updated or deleted
  482. * using a positioned update/delete statement that references the
  483. * cursor name. To insure that the cursor has the proper isolation
  484. * level to support update, the cursor's select statement should be
  485. * of the form 'select for update'. If the 'for update' clause is
  486. * omitted the positioned updates may fail.
  487. *
  488. * <P>JDBC supports this SQL feature by providing the name of the
  489. * SQL cursor used by a ResultSet. The current row of a ResultSet
  490. * is also the current row of this SQL cursor.
  491. *
  492. * <P><B>Note:</B> If positioned update is not supported a
  493. * SQLException is thrown
  494. *
  495. * @return the ResultSet's SQL cursor name
  496. * @exception SQLException if a database access error occurs
  497. */
  498. String getCursorName() throws SQLException;
  499. /**
  500. * Retrieves the number, types and properties of a ResultSet's columns.
  501. *
  502. * @return the description of a ResultSet's columns
  503. * @exception SQLException if a database access error occurs
  504. */
  505. ResultSetMetaData getMetaData() throws SQLException;
  506. /**
  507. * <p>Gets the value of a column in the current row as a Java object.
  508. *
  509. * <p>This method will return the value of the given column as a
  510. * Java object. The type of the Java object will be the default
  511. * Java object type corresponding to the column's SQL type,
  512. * following the mapping for built-in types specified in the JDBC
  513. * spec.
  514. *
  515. * <p>This method may also be used to read datatabase-specific
  516. * abstract data types.
  517. *
  518. * JDBC 2.0
  519. *
  520. *
  521. * In the JDBC 2.0 API, the behavior of method
  522. * <code>getObject</code> is extended to materialize
  523. * data of SQL user-defined types. When the a column contains
  524. * a structured or distinct value, the behavior of this method is as
  525. * if it were a call to: getObject(columnIndex,
  526. * this.getStatement().getConnection().getTypeMap()).
  527. *
  528. * @param columnIndex the first column is 1, the second is 2, ...
  529. * @return a java.lang.Object holding the column value
  530. * @exception SQLException if a database access error occurs
  531. */
  532. Object getObject(int columnIndex) throws SQLException;
  533. /**
  534. * <p>Gets the value of a column in the current row as a Java object.
  535. *
  536. * <p>This method will return the value of the given column as a
  537. * Java object. The type of the Java object will be the default
  538. * Java object type corresponding to the column's SQL type,
  539. * following the mapping for built-in types specified in the JDBC
  540. * spec.
  541. *
  542. * <p>This method may also be used to read datatabase-specific
  543. * abstract data types.
  544. *
  545. * JDBC 2.0
  546. *
  547. * In the JDBC 2.0 API, the behavior of method
  548. * <code>getObject</code> is extended to materialize
  549. * data of SQL user-defined types. When the a column contains
  550. * a structured or distinct value, the behavior of this method is as
  551. * if it were a call to: getObject(columnIndex,
  552. * this.getStatement().getConnection().getTypeMap()).
  553. *
  554. * @param columnName the SQL name of the column
  555. * @return a java.lang.Object holding the column value.
  556. * @exception SQLException if a database access error occurs
  557. */
  558. Object getObject(String columnName) throws SQLException;
  559. //----------------------------------------------------------------
  560. /**
  561. * Maps the given Resultset column name to its ResultSet column index.
  562. *
  563. * @param columnName the name of the column
  564. * @return the column index
  565. * @exception SQLException if a database access error occurs
  566. */
  567. int findColumn(String columnName) throws SQLException;
  568. //--------------------------JDBC 2.0-----------------------------------
  569. //---------------------------------------------------------------------
  570. // Getter's and Setter's
  571. //---------------------------------------------------------------------
  572. /**
  573. * JDBC 2.0
  574. *
  575. * <p>Gets the value of a column in the current row as a java.io.Reader.
  576. * @param columnIndex the first column is 1, the second is 2, ...
  577. */
  578. java.io.Reader getCharacterStream(int columnIndex) throws SQLException;
  579. /**
  580. * JDBC 2.0
  581. *
  582. * <p>Gets the value of a column in the current row as a java.io.Reader.
  583. * @param columnName the name of the column
  584. * @return the value in the specified column as a <code>java.io.Reader</code>
  585. */
  586. java.io.Reader getCharacterStream(String columnName) throws SQLException;
  587. /**
  588. * JDBC 2.0
  589. *
  590. * Gets the value of a column in the current row as a java.math.BigDecimal
  591. * object with full precision.
  592. *
  593. * @param columnIndex the first column is 1, the second is 2, ...
  594. * @return the column value (full precision); if the value is SQL NULL,
  595. * the result is null
  596. * @exception SQLException if a database access error occurs
  597. */
  598. BigDecimal getBigDecimal(int columnIndex) throws SQLException;
  599. /**
  600. * JDBC 2.0
  601. *
  602. * Gets the value of a column in the current row as a java.math.BigDecimal
  603. * object with full precision.
  604. * @param columnName the column name
  605. * @return the column value (full precision); if the value is SQL NULL,
  606. * the result is null
  607. * @exception SQLException if a database access error occurs
  608. *
  609. */
  610. BigDecimal getBigDecimal(String columnName) throws SQLException;
  611. //---------------------------------------------------------------------
  612. // Traversal/Positioning
  613. //---------------------------------------------------------------------
  614. /**
  615. * JDBC 2.0
  616. *
  617. * <p>Indicates whether the cursor is before the first row in the result
  618. * set.
  619. *
  620. * @return true if the cursor is before the first row, false otherwise. Returns
  621. * false when the result set contains no rows.
  622. * @exception SQLException if a database access error occurs
  623. */
  624. boolean isBeforeFirst() throws SQLException;
  625. /**
  626. * JDBC 2.0
  627. *
  628. * <p>Indicates whether the cursor is after the last row in the result
  629. * set.
  630. *
  631. * @return true if the cursor is after the last row, false otherwise. Returns
  632. * false when the result set contains no rows.
  633. * @exception SQLException if a database access error occurs
  634. */
  635. boolean isAfterLast() throws SQLException;
  636. /**
  637. * JDBC 2.0
  638. *
  639. * <p>Indicates whether the cursor is on the first row of the result set.
  640. *
  641. * @return true if the cursor is on the first row, false otherwise.
  642. * @exception SQLException if a database access error occurs
  643. */
  644. boolean isFirst() throws SQLException;
  645. /**
  646. * JDBC 2.0
  647. *
  648. * <p>Indicates whether the cursor is on the last row of the result set.
  649. * Note: Calling the method <code>isLast</code> may be expensive
  650. * because the JDBC driver
  651. * might need to fetch ahead one row in order to determine
  652. * whether the current row is the last row in the result set.
  653. *
  654. * @return true if the cursor is on the last row, false otherwise.
  655. * @exception SQLException if a database access error occurs
  656. */
  657. boolean isLast() throws SQLException;
  658. /**
  659. * JDBC 2.0
  660. *
  661. * <p>Moves the cursor to the front of the result set, just before the
  662. * first row. Has no effect if the result set contains no rows.
  663. *
  664. * @exception SQLException if a database access error occurs or the
  665. * result set type is TYPE_FORWARD_ONLY
  666. */
  667. void beforeFirst() throws SQLException;
  668. /**
  669. * JDBC 2.0
  670. *
  671. * <p>Moves the cursor to the end of the result set, just after the last
  672. * row. Has no effect if the result set contains no rows.
  673. *
  674. * @exception SQLException if a database access error occurs or the
  675. * result set type is TYPE_FORWARD_ONLY
  676. */
  677. void afterLast() throws SQLException;
  678. /**
  679. * JDBC 2.0
  680. *
  681. * <p>Moves the cursor to the first row in the result set.
  682. *
  683. * @return true if the cursor is on a valid row; false if
  684. * there are no rows in the result set
  685. * @exception SQLException if a database access error occurs or the
  686. * result set type is TYPE_FORWARD_ONLY
  687. */
  688. boolean first() throws SQLException;
  689. /**
  690. * JDBC 2.0
  691. *
  692. * <p>Moves the cursor to the last row in the result set.
  693. *
  694. * @return true if the cursor is on a valid row;
  695. * false if there are no rows in the result set
  696. * @exception SQLException if a database access error occurs or the
  697. * result set type is TYPE_FORWARD_ONLY.
  698. */
  699. boolean last() throws SQLException;
  700. /**
  701. * JDBC 2.0
  702. *
  703. * <p>Retrieves the current row number. The first row is number 1, the
  704. * second number 2, and so on.
  705. *
  706. * @return the current row number; 0 if there is no current row
  707. * @exception SQLException if a database access error occurs
  708. */
  709. int getRow() throws SQLException;
  710. /**
  711. * JDBC 2.0
  712. *
  713. * <p>Moves the cursor to the given row number in the result set.
  714. *
  715. * <p>If the row number is positive, the cursor moves to
  716. * the given row number with respect to the
  717. * beginning of the result set. The first row is row 1, the second
  718. * is row 2, and so on.
  719. *
  720. * <p>If the given row number is negative, the cursor moves to
  721. * an absolute row position with respect to
  722. * the end of the result set. For example, calling
  723. * <code>absolute(-1)</code> positions the
  724. * cursor on the last row, <code>absolute(-2)</code> indicates the next-to-last
  725. * row, and so on.
  726. *
  727. * <p>An attempt to position the cursor beyond the first/last row in
  728. * the result set leaves the cursor before/after the first/last
  729. * row, respectively.
  730. *
  731. * <p>Note: Calling <code>absolute(1)</code> is the same
  732. * as calling <code>first()</code>.
  733. * Calling <code>absolute(-1)</code> is the same as calling <code>last()</code>.
  734. *
  735. * @return true if the cursor is on the result set; false otherwise
  736. * @exception SQLException if a database access error occurs or
  737. * row is 0, or result set type is TYPE_FORWARD_ONLY.
  738. */
  739. boolean absolute( int row ) throws SQLException;
  740. /**
  741. * JDBC 2.0
  742. *
  743. * <p>Moves the cursor a relative number of rows, either positive or negative.
  744. * Attempting to move beyond the first/last row in the
  745. * result set positions the cursor before/after the
  746. * the first/last row. Calling <code>relative(0)</code> is valid, but does
  747. * not change the cursor position.
  748. *
  749. * <p>Note: Calling <code>relative(1)</code>
  750. * is different from calling <code>next()</code>
  751. * because is makes sense to call <code>next()</code> when there is no current row,
  752. * for example, when the cursor is positioned before the first row
  753. * or after the last row of the result set.
  754. *
  755. * @return true if the cursor is on a row; false otherwise
  756. * @exception SQLException if a database access error occurs, there
  757. * is no current row, or the result set type is TYPE_FORWARD_ONLY
  758. */
  759. boolean relative( int rows ) throws SQLException;
  760. /**
  761. * JDBC 2.0
  762. *
  763. * <p>Moves the cursor to the previous row in the result set.
  764. *
  765. * <p>Note: <code>previous()</code> is not the same as
  766. * <code>relative(-1)</code> because it
  767. * makes sense to call</code>previous()</code> when there is no current row.
  768. *
  769. * @return true if the cursor is on a valid row; false if it is off the result set
  770. * @exception SQLException if a database access error occurs or the
  771. * result set type is TYPE_FORWARD_ONLY
  772. */
  773. boolean previous() throws SQLException;
  774. //---------------------------------------------------------------------
  775. // Properties
  776. //---------------------------------------------------------------------
  777. /**
  778. * JDBC 2.0
  779. *
  780. * The rows in a result set will be processed in a forward direction;
  781. * first-to-last.
  782. */
  783. int FETCH_FORWARD = 1000;
  784. /**
  785. * JDBC 2.0
  786. *
  787. * The rows in a result set will be processed in a reverse direction;
  788. * last-to-first.
  789. */
  790. int FETCH_REVERSE = 1001;
  791. /**
  792. * JDBC 2.0
  793. *
  794. * The order in which rows in a result set will be processed is unknown.
  795. */
  796. int FETCH_UNKNOWN = 1002;
  797. /**
  798. * JDBC 2.0
  799. *
  800. * Gives a hint as to the direction in which the rows in this result set
  801. * will be processed. The initial value is determined by the statement
  802. * that produced the result set. The fetch direction may be changed
  803. * at any time.
  804. *
  805. * @exception SQLException if a database access error occurs or
  806. * the result set type is TYPE_FORWARD_ONLY and the fetch direction is not
  807. * FETCH_FORWARD.
  808. */
  809. void setFetchDirection(int direction) throws SQLException;
  810. /**
  811. * JDBC 2.0
  812. *
  813. * Returns the fetch direction for this result set.
  814. *
  815. * @return the current fetch direction for this result set
  816. * @exception SQLException if a database access error occurs
  817. */
  818. int getFetchDirection() throws SQLException;
  819. /**
  820. * JDBC 2.0
  821. *
  822. * Gives the JDBC driver a hint as to the number of rows that should
  823. * be fetched from the database when more rows are needed for this result
  824. * set. If the fetch size specified is zero, the JDBC driver
  825. * ignores the value and is free to make its own best guess as to what
  826. * the fetch size should be. The default value is set by the statement
  827. * that created the result set. The fetch size may be changed at any
  828. * time.
  829. *
  830. * @param rows the number of rows to fetch
  831. * @exception SQLException if a database access error occurs or the
  832. * condition 0 <= rows <= this.getMaxRows() is not satisfied.
  833. */
  834. void setFetchSize(int rows) throws SQLException;
  835. /**
  836. * JDBC 2.0
  837. *
  838. * Returns the fetch size for this result set.
  839. *
  840. * @return the current fetch size for this result set
  841. * @exception SQLException if a database access error occurs
  842. */
  843. int getFetchSize() throws SQLException;
  844. /**
  845. * JDBC 2.0
  846. * The type for a <code>ResultSet</code> object whose cursor may
  847. * move only forward.
  848. */
  849. int TYPE_FORWARD_ONLY = 1003;
  850. /**
  851. * JDBC 2.0
  852. * The type for a <code>ResultSet</code> object that is scrollable
  853. * but generally not sensitive to changes made by others.
  854. *
  855. */
  856. int TYPE_SCROLL_INSENSITIVE = 1004;
  857. /**
  858. * JDBC 2.0
  859. * The type for a <code>ResultSet</code> object that is scrollable
  860. * and generally sensitive to changes made by others.
  861. */
  862. int TYPE_SCROLL_SENSITIVE = 1005;
  863. /**
  864. * JDBC 2.0
  865. *
  866. * Returns the type of this result set. The type is determined by
  867. * the statement that created the result set.
  868. *
  869. * @return TYPE_FORWARD_ONLY, TYPE_SCROLL_INSENSITIVE, or
  870. * TYPE_SCROLL_SENSITIVE
  871. * @exception SQLException if a database access error occurs
  872. */
  873. int getType() throws SQLException;
  874. /**
  875. * JDBC 2.0
  876. * The concurrency mode for a <code>ResultSet</code> object
  877. * that may NOT be updated.
  878. *
  879. */
  880. int CONCUR_READ_ONLY = 1007;
  881. /**
  882. * JDBC 2.0
  883. * The concurrency mode for a <code>ResultSet</code> object
  884. * that may be updated.
  885. *
  886. */
  887. int CONCUR_UPDATABLE = 1008;
  888. /**
  889. * JDBC 2.0
  890. *
  891. * Returns the concurrency mode of this result set. The concurrency
  892. * used is determined by the statement that created the result set.
  893. *
  894. * @return the concurrency type, CONCUR_READ_ONLY or CONCUR_UPDATABLE
  895. * @exception SQLException if a database access error occurs
  896. */
  897. int getConcurrency() throws SQLException;
  898. //---------------------------------------------------------------------
  899. // Updates
  900. //---------------------------------------------------------------------
  901. /**
  902. * JDBC 2.0
  903. *
  904. * Indicates whether the current row has been updated. The value returned
  905. * depends on whether or not the result set can detect updates.
  906. *
  907. * @return true if the row has been visibly updated by the owner or
  908. * another, and updates are detected
  909. * @exception SQLException if a database access error occurs
  910. *
  911. * @see DatabaseMetaData#updatesAreDetected
  912. */
  913. boolean rowUpdated() throws SQLException;
  914. /**
  915. * JDBC 2.0
  916. *
  917. * Indicates whether the current row has had an insertion. The value returned
  918. * depends on whether or not the result set can detect visible inserts.
  919. *
  920. * @return true if a row has had an insertion and insertions are detected
  921. * @exception SQLException if a database access error occurs
  922. *
  923. * @see DatabaseMetaData#insertsAreDetected
  924. */
  925. boolean rowInserted() throws SQLException;
  926. /**
  927. * JDBC 2.0
  928. *
  929. * Indicates whether a row has been deleted. A deleted row may leave
  930. * a visible "hole" in a result set. This method can be used to
  931. * detect holes in a result set. The value returned depends on whether
  932. * or not the result set can detect deletions.
  933. *
  934. * @return true if a row was deleted and deletions are detected
  935. * @exception SQLException if a database access error occurs
  936. *
  937. * @see DatabaseMetaData#deletesAreDetected
  938. */
  939. boolean rowDeleted() throws SQLException;
  940. /**
  941. * JDBC 2.0
  942. *
  943. * Give a nullable column a null value.
  944. *
  945. * The <code>updateXXX</code> methods are used to update column values in the
  946. * current row, or the insert row. The <code>updateXXX</code> methods do not
  947. * update the underlying database; instead the <code>updateRow</code> or <code>insertRow</code>
  948. * methods are called to update the database.
  949. *
  950. * @param columnIndex the first column is 1, the second is 2, ...
  951. * @exception SQLException if a database access error occurs
  952. */
  953. void updateNull(int columnIndex) throws SQLException;
  954. /**
  955. * JDBC 2.0
  956. *
  957. * Updates a column with a boolean value.
  958. *
  959. * The <code>updateXXX</code> methods are used to update column values in the
  960. * current row, or the insert row. The <code>updateXXX</code> methods do not
  961. * update the underlying database; instead the <code>updateRow</code> or <code>insertRow</code>
  962. * methods are called to update the database.
  963. *
  964. * @param columnIndex the first column is 1, the second is 2, ...
  965. * @param x the new column value
  966. * @exception SQLException if a database access error occurs
  967. */
  968. void updateBoolean(int columnIndex, boolean x) throws SQLException;
  969. /**
  970. * JDBC 2.0
  971. *
  972. * Updates a column with a byte value.
  973. *
  974. * The <code>updateXXX</code> methods are used to update column values in the
  975. * current row, or the insert row. The <code>updateXXX</code> methods do not
  976. * update the underlying database; instead the <code>updateRow</code> or <code>insertRow</code>
  977. * methods are called to update the database.
  978. *
  979. * @param columnIndex the first column is 1, the second is 2, ...
  980. * @param x the new column value
  981. * @exception SQLException if a database access error occurs
  982. */
  983. void updateByte(int columnIndex, byte x) throws SQLException;
  984. /**
  985. * JDBC 2.0
  986. *
  987. * Updates a column with a short value.
  988. *
  989. * The <code>updateXXX</code> methods are used to update column values in the
  990. * current row, or the insert row. The <code>updateXXX</code> methods do not
  991. * update the underlying database; instead the <code>updateRow</code> or <code>insertRow</code>
  992. * methods are called to update the database.
  993. *
  994. * @param columnIndex the first column is 1, the second is 2, ...
  995. * @param x the new column value
  996. * @exception SQLException if a database access error occurs
  997. */
  998. void updateShort(int columnIndex, short x) throws SQLException;
  999. /**
  1000. * JDBC 2.0
  1001. *
  1002. * Updates a column with an integer value.
  1003. *
  1004. * The <code>updateXXX</code> methods are used to update column values in the
  1005. * current row, or the insert row. The <code>updateXXX</code> methods do not
  1006. * update the underlying database; instead the <code>updateRow</code> or <code>insertRow</code>
  1007. * methods are called to update the database.
  1008. *
  1009. * @param columnIndex the first column is 1, the second is 2, ...
  1010. * @param x the new column value
  1011. * @exception SQLException if a database access error occurs
  1012. */
  1013. void updateInt(int columnIndex, int x) throws SQLException;
  1014. /**
  1015. * JDBC 2.0
  1016. *
  1017. * Updates a column with a long value.
  1018. *
  1019. * The <code>updateXXX</code> methods are used to update column values in the
  1020. * current row, or the insert row. The <code>updateXXX</code> methods do not
  1021. * update the underlying database; instead the <code>updateRow</code> or <code>insertRow</code>
  1022. * methods are called to update the database.
  1023. *
  1024. * @param columnIndex the first column is 1, the second is 2, ...
  1025. * @param x the new column value
  1026. * @exception SQLException if a database access error occurs
  1027. */
  1028. void updateLong(int columnIndex, long x) throws SQLException;
  1029. /**
  1030. * JDBC 2.0
  1031. *
  1032. * Updates a column with a float value.
  1033. *
  1034. * The <code>updateXXX</code> methods are used to update column values in the
  1035. * current row, or the insert row. The <code>updateXXX</code> methods do not
  1036. * update the underlying database; instead the <code>updateRow</code> or <code>insertRow</code>
  1037. * methods are called to update the database.
  1038. *
  1039. * @param columnIndex the first column is 1, the second is 2, ...
  1040. * @param x the new column value
  1041. * @exception SQLException if a database access error occurs
  1042. */
  1043. void updateFloat(int columnIndex, float x) throws SQLException;
  1044. /**
  1045. * JDBC 2.0
  1046. *
  1047. * Updates a column with a Double value.
  1048. *
  1049. * The <code>updateXXX</code> methods are used to update column values in the
  1050. * current row, or the insert row. The <code>updateXXX</code> methods do not
  1051. * update the underlying database; instead the <code>updateRow</code> or <code>insertRow</code>
  1052. * methods are called to update the database.
  1053. *
  1054. * @param columnIndex the first column is 1, the second is 2, ...
  1055. * @param x the new column value
  1056. * @exception SQLException if a database access error occurs
  1057. */
  1058. void updateDouble(int columnIndex, double x) throws SQLException;
  1059. /**
  1060. * JDBC 2.0
  1061. *
  1062. * Updates a column with a BigDecimal value.
  1063. *
  1064. * The <code>updateXXX</code> methods are used to update column values in the
  1065. * current row, or the insert row. The <code>updateXXX</code> methods do not
  1066. * update the underlying database; instead the <code>updateRow</code> or <code>insertRow</code>
  1067. * methods are called to update the database.
  1068. *
  1069. * @param columnIndex the first column is 1, the second is 2, ...
  1070. * @param x the new column value
  1071. * @exception SQLException if a database access error occurs
  1072. */
  1073. void updateBigDecimal(int columnIndex, BigDecimal x) throws SQLException;
  1074. /**
  1075. * JDBC 2.0
  1076. *
  1077. * Updates a column with a String value.
  1078. *
  1079. * The <code>updateXXX</code> methods are used to update column values in the
  1080. * current row, or the insert row. The <code>updateXXX</code> methods do not
  1081. * update the underlying database; instead the <code>updateRow</code> or <code>insertRow</code>
  1082. * methods are called to update the database.
  1083. *
  1084. * @param columnIndex the first column is 1, the second is 2, ...
  1085. * @param x the new column value
  1086. * @exception SQLException if a database access error occurs
  1087. */
  1088. void updateString(int columnIndex, String x) throws SQLException;
  1089. /**
  1090. * JDBC 2.0
  1091. *
  1092. * Updates a column with a byte array value.
  1093. *
  1094. * The <code>updateXXX</code> methods are used to update column values in the
  1095. * current row, or the insert row. The <code>updateXXX</code> methods do not
  1096. * update the underlying database; instead the <code>updateRow</code> or <code>insertRow</code>
  1097. * methods are called to update the database.
  1098. *
  1099. * @param columnIndex the first column is 1, the second is 2, ...
  1100. * @param x the new column value
  1101. * @exception SQLException if a database access error occurs
  1102. */
  1103. void updateBytes(int columnIndex, byte x[]) throws SQLException;
  1104. /**
  1105. * JDBC 2.0
  1106. *
  1107. * Updates a column with a Date value.
  1108. *
  1109. * The <code>updateXXX</code> methods are used to update column values in the
  1110. * current row, or the insert row. The <code>updateXXX</code> methods do not
  1111. * update the underlying database; instead the <code>updateRow</code> or <code>insertRow</code>
  1112. * methods are called to update the database.
  1113. *
  1114. * @param columnIndex the first column is 1, the second is 2, ...
  1115. * @param x the new column value
  1116. * @exception SQLException if a database access error occurs
  1117. */
  1118. void updateDate(int columnIndex, java.sql.Date x) throws SQLException;
  1119. /**
  1120. * JDBC 2.0
  1121. *
  1122. * Updates a column with a Time value.
  1123. *
  1124. * The <code>updateXXX</code> methods are used to update column values in the
  1125. * current row, or the insert row. The <code>updateXXX</code> methods do not
  1126. * update the underlying database; instead the <code>updateRow</code> or <code>insertRow</code>
  1127. * methods are called to update the database.
  1128. *
  1129. * @param columnIndex the first column is 1, the second is 2, ...
  1130. * @param x the new column value
  1131. * @exception SQLException if a database access error occurs
  1132. */
  1133. void updateTime(int columnIndex, java.sql.Time x) throws SQLException;
  1134. /**
  1135. * JDBC 2.0
  1136. *
  1137. * Updates a column with a Timestamp value.
  1138. *
  1139. * The <code>updateXXX</code> methods are used to update column values in the
  1140. * current row, or the insert row. The <code>updateXXX</code> methods do not
  1141. * update the underlying database; instead the <code>updateRow</code> or <code>insertRow</code>
  1142. * methods are called to update the database.
  1143. *
  1144. * @param columnIndex the first column is 1, the second is 2, ...
  1145. * @param x the new column value
  1146. * @exception SQLException if a database access error occurs
  1147. */
  1148. void updateTimestamp(int columnIndex, java.sql.Timestamp x)
  1149. throws SQLException;
  1150. /**
  1151. * JDBC 2.0
  1152. *
  1153. * Updates a column with an ascii stream value.
  1154. *
  1155. * The <code>updateXXX</code> methods are used to update column values in the
  1156. * current row, or the insert row. The <code>updateXXX</code> methods do not
  1157. * update the underlying database; instead the <code>updateRow</code> or <code>insertRow</code>
  1158. * methods are called to update the database.
  1159. *
  1160. * @param columnIndex the first column is 1, the second is 2, ...
  1161. * @param x the new column value
  1162. * @param length the length of the stream
  1163. * @exception SQLException if a database access error occurs
  1164. */
  1165. void updateAsciiStream(int columnIndex,
  1166. java.io.InputStream x,
  1167. int length) throws SQLException;
  1168. /**
  1169. * JDBC 2.0
  1170. *
  1171. * Updates a column with a binary stream value.
  1172. *
  1173. * The <code>updateXXX</code> methods are used to update column values in the
  1174. * current row, or the insert row. The <code>updateXXX</code> methods do not
  1175. * update the underlying database; instead the <code>updateRow</code> or <code>insertRow</code>
  1176. * methods are called to update the database.
  1177. *
  1178. * @param columnIndex the first column is 1, the second is 2, ...
  1179. * @param x the new column value
  1180. * @param length the length of the stream
  1181. * @exception SQLException if a database access error occurs
  1182. */
  1183. void updateBinaryStream(int columnIndex,
  1184. java.io.InputStream x,
  1185. int length) throws SQLException;
  1186. /**
  1187. * JDBC 2.0
  1188. *
  1189. * Updates a column with a character stream value.
  1190. *
  1191. * The <code>updateXXX</code> methods are used to update column values in the
  1192. * current row, or the insert row. The <code>updateXXX</code> methods do not
  1193. * update the underlying database; instead the <code>updateRow</code> or <code>insertRow</code>
  1194. * methods are called to update the database.
  1195. *
  1196. * @param columnIndex the first column is 1, the second is 2, ...
  1197. * @param x the new column value
  1198. * @param length the length of the stream
  1199. * @exception SQLException if a database access error occurs
  1200. */
  1201. void updateCharacterStream(int columnIndex,
  1202. java.io.Reader x,
  1203. int length) throws SQLException;
  1204. /**
  1205. * JDBC 2.0
  1206. *
  1207. * Updates a column with an Object value.
  1208. *
  1209. * The <code>updateXXX</code> methods are used to update column values in the
  1210. * current row, or the insert row. The <code>updateXXX</code> methods do not
  1211. * update the underlying database; instead the <code>updateRow</code> or <code>insertRow</code>
  1212. * methods are called to update the database.
  1213. *
  1214. * @param columnIndex the first column is 1, the second is 2, ...
  1215. * @param x the new column value
  1216. * @param scale For java.sql.Types.DECIMAL or java.sql.Types.NUMERIC types
  1217. * this is the number of digits after the decimal. For all other
  1218. * types this value will be ignored.
  1219. * @exception SQLException if a database access error occurs
  1220. */
  1221. void updateObject(int columnIndex, Object x, int scale)
  1222. throws SQLException;
  1223. /**
  1224. * JDBC 2.0
  1225. *
  1226. * Updates a column with an Object value.
  1227. *
  1228. * The <code>updateXXX</code> methods are used to update column values in the
  1229. * current row, or the insert row. The <code>updateXXX</code> methods do not
  1230. * update the underlying database; instead the <code>updateRow</code> or <code>insertRow</code>
  1231. * methods are called to update the database.
  1232. *
  1233. * @param columnIndex the first column is 1, the second is 2, ...
  1234. * @param x the new column value
  1235. * @exception SQLException if a database access error occurs
  1236. */
  1237. void updateObject(int columnIndex, Object x) throws SQLException;
  1238. /**
  1239. * JDBC 2.0
  1240. *
  1241. * Updates a column with a null value.
  1242. *
  1243. * The <code>updateXXX</code> methods are used to update column values in the
  1244. * current row, or the insert row. The <code>updateXXX</code> methods do not
  1245. * update the underlying database; instead the <code>updateRow</code> or <code>insertRow</code>
  1246. * methods are called to update the database.
  1247. *
  1248. * @param columnName the name of the column
  1249. * @exception SQLException if a database access error occurs
  1250. */
  1251. void updateNull(String columnName) throws SQLException;
  1252. /**
  1253. * JDBC 2.0
  1254. *
  1255. * Updates a column with a boolean value.
  1256. *
  1257. * The <code>updateXXX</code> methods are used to update column values in the
  1258. * current row, or the insert row. The <code>updateXXX</code> methods do not
  1259. * update the underlying database; instead the <code>updateRow</code> or <code>insertRow</code>
  1260. * methods are called to update the database.
  1261. *
  1262. * @param columnName the name of the column
  1263. * @param x the new column value
  1264. * @exception SQLException if a database access error occurs
  1265. */
  1266. void updateBoolean(String columnName, boolean x) throws SQLException;
  1267. /**
  1268. * JDBC 2.0
  1269. *
  1270. * Updates a column with a byte value.
  1271. *
  1272. * The <code>updateXXX</code> methods are used to update column values in the
  1273. * current row, or the insert row. The <code>updateXXX</code> methods do not
  1274. * update the underlying database; instead the <code>updateRow</code> or <code>insertRow</code>
  1275. * methods are called to update the database.
  1276. *
  1277. * @param columnName the name of the column
  1278. * @param x the new column value
  1279. * @exception SQLException if a database access error occurs
  1280. */
  1281. void updateByte(String columnName, byte x) throws SQLException;
  1282. /**
  1283. * JDBC 2.0
  1284. *
  1285. * Updates a column with a short value.
  1286. *
  1287. * The <code>updateXXX</code> methods are used to update column values in the
  1288. * current row, or the insert row. The <code>updateXXX</code> methods do not
  1289. * update the underlying database; instead the <code>updateRow</code> or <code>insertRow</code>
  1290. * methods are called to update the database.
  1291. *
  1292. * @param columnName the name of the column
  1293. * @param x the new column value
  1294. * @exception SQLException if a database access error occurs
  1295. */
  1296. void updateShort(String columnName, short x) throws SQLException;
  1297. /**
  1298. * JDBC 2.0
  1299. *
  1300. * Updates a column with an integer value.
  1301. *
  1302. * The <code>updateXXX</code> methods are used to update column values in the
  1303. * current row, or the insert row. The <code>updateXXX</code> methods do not
  1304. * update the underlying database; instead the <code>updateRow</code> or <code>insertRow</code>
  1305. * methods are called to update the database.
  1306. *
  1307. * @param columnName the name of the column
  1308. * @param x the new column value
  1309. * @exception SQLException if a database access error occurs
  1310. */
  1311. void updateInt(String columnName, int x) throws SQLException;
  1312. /**
  1313. * JDBC 2.0
  1314. *
  1315. * Updates a column with a long value.
  1316. *
  1317. * The <code>updateXXX</code> methods are used to update column values in the
  1318. * current row, or the insert row. The <code>updateXXX</code> methods do not
  1319. * update the underlying database; instead the <code>updateRow</code> or <code>insertRow</code>
  1320. * methods are called to update the database.
  1321. *
  1322. * @param columnName the name of the column
  1323. * @param x the new column value
  1324. * @exception SQLException if a database access error occurs
  1325. */
  1326. void updateLong(String columnName, long x) throws SQLException;
  1327. /**
  1328. * JDBC 2.0
  1329. *
  1330. * Updates a column with a float value.
  1331. *
  1332. * The <code>updateXXX</code> methods are used to update column values in the
  1333. * current row, or the insert row. The <code>updateXXX</code> methods do not
  1334. * update the underlying database; instead the <code>updateRow</code> or <code>insertRow</code>
  1335. * methods are called to update the database.
  1336. *
  1337. * @param columnName the name of the column
  1338. * @param x the new column value
  1339. * @exception SQLException if a database access error occurs
  1340. */
  1341. void updateFloat(String columnName, float x) throws SQLException;
  1342. /**
  1343. * JDBC 2.0
  1344. *
  1345. * Updates a column with a double value.
  1346. *
  1347. * The <code>updateXXX</code> methods are used to update column values in the
  1348. * current row, or the insert row. The <code>updateXXX</code> methods do not
  1349. * update the underlying database; instead the <code>updateRow</code> or <code>insertRow</code>
  1350. * methods are called to update the database.
  1351. *
  1352. * @param columnName the name of the column
  1353. * @param x the new column value
  1354. * @exception SQLException if a database access error occurs
  1355. */
  1356. void updateDouble(String columnName, double x) throws SQLException;
  1357. /**
  1358. * JDBC 2.0
  1359. *
  1360. * Updates a column with a BigDecimal value.
  1361. *
  1362. * The <code>updateXXX</code> methods are used to update column values in the
  1363. * current row, or the insert row. The <code>updateXXX</code> methods do not
  1364. * update the underlying database; instead the <code>updateRow</code> or <code>insertRow</code>
  1365. * methods are called to update the database.
  1366. *
  1367. * @param columnName the name of the column
  1368. * @param x the new column value
  1369. * @exception SQLException if a database access error occurs
  1370. */
  1371. void updateBigDecimal(String columnName, BigDecimal x) throws SQLException;
  1372. /**
  1373. * JDBC 2.0
  1374. *
  1375. * Updates a column with a String value.
  1376. *
  1377. * The <code>updateXXX</code> methods are used to update column values in the
  1378. * current row, or the insert row. The <code>updateXXX</code> methods do not
  1379. * update the underlying database; instead the <code>updateRow</code> or <code>insertRow</code>
  1380. * methods are called to update the database.
  1381. *
  1382. * @param columnName the name of the column
  1383. * @param x the new column value
  1384. * @exception SQLException if a database access error occurs
  1385. */
  1386. void updateString(String columnName, String x) throws SQLException;
  1387. /**
  1388. * JDBC 2.0
  1389. *
  1390. * Updates a column with a byte array value.
  1391. *
  1392. * The <code>updateXXX</code> methods are used to update column values in the
  1393. * current row, or the insert row. The <code>updateXXX</code> methods do not
  1394. * update the underlying database; instead the <code>updateRow</code> or <code>insertRow</code>
  1395. * methods are called to update the database.
  1396. *
  1397. * @param columnName the name of the column
  1398. * @param x the new column value
  1399. * @exception SQLException if a database access error occurs
  1400. */
  1401. void updateBytes(String columnName, byte x[]) throws SQLException;
  1402. /**
  1403. * JDBC 2.0
  1404. *
  1405. * Updates a column with a Date value.
  1406. *
  1407. * The <code>updateXXX</code> methods are used to update column values in the
  1408. * current row, or the insert row. The <code>updateXXX</code> methods do not
  1409. * update the underlying database; instead the <code>updateRow</code> or <code>insertRow</code>
  1410. * methods are called to update the database.
  1411. *
  1412. * @param columnName the name of the column
  1413. * @param x the new column value
  1414. * @exception SQLException if a database access error occurs
  1415. */
  1416. void updateDate(String columnName, java.sql.Date x) throws SQLException;
  1417. /**
  1418. * JDBC 2.0
  1419. *
  1420. * Updates a column with a Time value.
  1421. *
  1422. * The <code>updateXXX</code> methods are used to update column values in the
  1423. * current row, or the insert row. The <code>updateXXX</code> methods do not
  1424. * update the underlying database; instead the <code>updateRow</code> or <code>insertRow</code>
  1425. * methods are called to update the database.
  1426. *
  1427. * @param columnName the name of the column
  1428. * @param x the new column value
  1429. * @exception SQLException if a database access error occurs
  1430. */
  1431. void updateTime(String columnName, java.sql.Time x) throws SQLException;
  1432. /**
  1433. * JDBC 2.0
  1434. *
  1435. * Updates a column with a Timestamp value.
  1436. *
  1437. * The <code>updateXXX</code> methods are used to update column values in the
  1438. * current row, or the insert row. The <code>updateXXX</code> methods do not
  1439. * update the underlying database; instead the <code>updateRow</code> or <code>insertRow</code>
  1440. * methods are called to update the database.
  1441. *
  1442. * @param columnName the name of the column
  1443. * @param x the new column value
  1444. * @exception SQLException if a database access error occurs
  1445. */
  1446. void updateTimestamp(String columnName, java.sql.Timestamp x)
  1447. throws SQLException;
  1448. /**
  1449. * JDBC 2.0
  1450. *
  1451. * Updates a column with an ascii stream value.
  1452. *
  1453. * The <code>updateXXX</code> methods are used to update column values in the
  1454. * current row, or the insert row. The <code>updateXXX</code> methods do not
  1455. * update the underlying database; instead the <code>updateRow</code> or <code>insertRow</code>
  1456. * methods are called to update the database.
  1457. *
  1458. * @param columnName the name of the column
  1459. * @param x the new column value
  1460. * @param length of the stream
  1461. * @exception SQLException if a database access error occurs
  1462. */
  1463. void updateAsciiStream(String columnName,
  1464. java.io.InputStream x,
  1465. int length) throws SQLException;
  1466. /**
  1467. * JDBC 2.0
  1468. *
  1469. * Updates a column with a binary stream value.
  1470. *
  1471. * The <code>updateXXX</code> methods are used to update column values in the
  1472. * current row, or the insert row. The <code>updateXXX</code> methods do not
  1473. * update the underlying database; instead the <code>updateRow</code> or <code>insertRow</code>
  1474. * methods are called to update the database.
  1475. *
  1476. * @param columnName the name of the column
  1477. * @param x the new column value
  1478. * @param length of the stream
  1479. * @exception SQLException if a database access error occurs
  1480. */
  1481. void updateBinaryStream(String columnName,
  1482. java.io.InputStream x,
  1483. int length) throws SQLException;
  1484. /**
  1485. * JDBC 2.0
  1486. *
  1487. * Updates a column with a character stream value.
  1488. *
  1489. * The <code>updateXXX</code> methods are used to update column values in the
  1490. * current row, or the insert row. The <code>updateXXX</code> methods do not
  1491. * update the underlying database; instead the <code>updateRow</code> or <code>insertRow</code>
  1492. * methods are called to update the database.
  1493. *
  1494. * @param columnName the name of the column
  1495. * @param x the new column value
  1496. * @param length of the stream
  1497. * @exception SQLException if a database access error occurs
  1498. */
  1499. void updateCharacterStream(String columnName,
  1500. java.io.Reader reader,
  1501. int length) throws SQLException;
  1502. /**
  1503. * JDBC 2.0
  1504. *
  1505. * Updates a column with an Object value.
  1506. *
  1507. * The <code>updateXXX</code> methods are used to update column values in the
  1508. * current row, or the insert row. The <code>updateXXX</code> methods do not
  1509. * update the underlying database; instead the <code>updateRow</code> or <code>insertRow</code>
  1510. * methods are called to update the database.
  1511. *
  1512. * @param columnName the name of the column
  1513. * @param x the new column value
  1514. * @param scale For java.sql.Types.DECIMAL or java.sql.Types.NUMERIC types
  1515. * this is the number of digits after the decimal. For all other
  1516. * types this value will be ignored.
  1517. * @exception SQLException if a database access error occurs
  1518. */
  1519. void updateObject(String columnName, Object x, int scale)
  1520. throws SQLException;
  1521. /**
  1522. * JDBC 2.0
  1523. *
  1524. * Updates a column with an Object value.
  1525. *
  1526. * The <code>updateXXX</code> methods are used to update column values in the
  1527. * current row, or the insert row. The <code>updateXXX</code> methods do not
  1528. * update the underlying database; instead the <code>updateRow</code> or <code>insertRow</code>
  1529. * methods are called to update the database.
  1530. *
  1531. * @param columnName the name of the column
  1532. * @param x the new column value
  1533. * @exception SQLException if a database access error occurs
  1534. */
  1535. void updateObject(String columnName, Object x) throws SQLException;
  1536. /**
  1537. * JDBC 2.0
  1538. *
  1539. * Inserts the contents of the insert row into the result set and
  1540. * the database. Must be on the insert row when this method is called.
  1541. *
  1542. * @exception SQLException if a database access error occurs,
  1543. * if called when not on the insert row, or if not all of non-nullable columns in
  1544. * the insert row have been given a value
  1545. */
  1546. void insertRow() throws SQLException;
  1547. /**
  1548. * JDBC 2.0
  1549. *
  1550. * Updates the underlying database with the new contents of the
  1551. * current row. Cannot be called when on the insert row.
  1552. *
  1553. * @exception SQLException if a database access error occurs or
  1554. * if called when on the insert row
  1555. */
  1556. void updateRow() throws SQLException;
  1557. /**
  1558. * JDBC 2.0
  1559. *
  1560. * Deletes the current row from the result set and the underlying
  1561. * database. Cannot be called when on the insert row.
  1562. *
  1563. * @exception SQLException if a database access error occurs or if
  1564. * called when on the insert row.
  1565. */
  1566. void deleteRow() throws SQLException;
  1567. /**
  1568. * JDBC 2.0
  1569. *
  1570. * Refreshes the current row with its most recent value in
  1571. * the database. Cannot be called when on the insert row.
  1572. *
  1573. * The <code>refreshRow</code> method provides a way for an application to
  1574. * explicitly tell the JDBC driver to refetch a row(s) from the
  1575. * database. An application may want to call <code>refreshRow</code> when
  1576. * caching or prefetching is being done by the JDBC driver to
  1577. * fetch the latest value of a row from the database. The JDBC driver
  1578. * may actually refresh multiple rows at once if the fetch size is
  1579. * greater than one.
  1580. *
  1581. * All values are refetched subject to the transaction isolation
  1582. * level and cursor sensitivity. If <code>refreshRow</code> is called after
  1583. * calling <code>updateXXX</code>, but before calling <code>updateRow</code>, then the
  1584. * updates made to the row are lost. Calling the method <code>refreshRow</code> frequently
  1585. * will likely slow performance.
  1586. *
  1587. * @exception SQLException if a database access error occurs or if
  1588. * called when on the insert row
  1589. */
  1590. void refreshRow() throws SQLException;
  1591. /**
  1592. * JDBC 2.0
  1593. *
  1594. * Cancels the updates made to a row.
  1595. * This method may be called after calling an
  1596. * <code>updateXXX</code> method(s) and before calling <code>updateRow</code> to rollback
  1597. * the updates made to a row. If no updates have been made or
  1598. * <code>updateRow</code> has already been called, then this method has no
  1599. * effect.
  1600. *
  1601. * @exception SQLException if a database access error occurs or if
  1602. * called when on the insert row
  1603. *
  1604. */
  1605. void cancelRowUpdates() throws SQLException;
  1606. /**
  1607. * JDBC 2.0
  1608. *
  1609. * Moves the cursor to the insert row. The current cursor position is
  1610. * remembered while the cursor is positioned on the insert row.
  1611. *
  1612. * The insert row is a special row associated with an updatable
  1613. * result set. It is essentially a buffer where a new row may
  1614. * be constructed by calling the <code>updateXXX</code> methods prior to
  1615. * inserting the row into the result set.
  1616. *
  1617. * Only the <code>updateXXX</code>, <code>getXXX</code>,
  1618. * and <code>insertRow</code> methods may be
  1619. * called when the cursor is on the insert row. All of the columns in
  1620. * a result set must be given a value each time this method is
  1621. * called before calling <code>insertRow</code>.
  1622. * The method <code>updateXXX</code> must be called before a
  1623. * <code>getXXX</code> method can be called on a column value.
  1624. *
  1625. * @exception SQLException if a database access error occurs
  1626. * or the result set is not updatable
  1627. */
  1628. void moveToInsertRow() throws SQLException;
  1629. /**
  1630. * JDBC 2.0
  1631. *
  1632. * Moves the cursor to the remembered cursor position, usually the
  1633. * current row. This method has no effect if the cursor is not on the insert
  1634. * row.
  1635. *
  1636. * @exception SQLException if a database access error occurs
  1637. * or the result set is not updatable
  1638. */
  1639. void moveToCurrentRow() throws SQLException;
  1640. /**
  1641. * JDBC 2.0
  1642. *
  1643. * Returns the Statement that produced this <code>ResultSet</code> object.
  1644. * If the result set was generated some other way, such as by a
  1645. * <code>DatabaseMetaData</code> method, this method returns <code>null</code>.
  1646. *
  1647. * @return the Statment that produced the result set or
  1648. * null if the result set was produced some other way
  1649. * @exception SQLException if a database access error occurs
  1650. */
  1651. Statement getStatement() throws SQLException;
  1652. /**
  1653. * JDBC 2.0
  1654. *
  1655. * Returns the value of a column in the current row as a Java object.
  1656. * This method uses the given <code>Map</code> object
  1657. * for the custom mapping of the
  1658. * SQL structured or distinct type that is being retrieved.
  1659. *
  1660. * @param i the first column is 1, the second is 2, ...
  1661. * @param map the mapping from SQL type names to Java classes
  1662. * @return an object representing the SQL value
  1663. */
  1664. Object getObject(int i, java.util.Map map) throws SQLException;
  1665. /**
  1666. * JDBC 2.0
  1667. *
  1668. * Gets a REF(<structured-type>) column value from the current row.
  1669. *
  1670. * @param i the first column is 1, the second is 2, ...
  1671. * @return a <code>Ref</code> object representing an SQL REF value
  1672. */
  1673. Ref getRef(int i) throws SQLException;
  1674. /**
  1675. * JDBC 2.0
  1676. *
  1677. * Gets a BLOB value in the current row of this <code>ResultSet</code> object.
  1678. *
  1679. * @param i the first column is 1, the second is 2, ...
  1680. * @return a <code>Blob</code> object representing the SQL BLOB value in
  1681. * the specified column
  1682. */
  1683. Blob getBlob(int i) throws SQLException;
  1684. /**
  1685. * JDBC 2.0
  1686. *
  1687. * Gets a CLOB value in the current row of this <code>ResultSet</code> object.
  1688. *
  1689. * @param i the first column is 1, the second is 2, ...
  1690. * @return a <code>Clob</code> object representing the SQL CLOB value in
  1691. * the specified column
  1692. */
  1693. Clob getClob(int i) throws SQLException;
  1694. /**
  1695. * JDBC 2.0
  1696. *
  1697. * Gets an SQL ARRAY value from the current row of this <code>ResultSet</code> object.
  1698. *
  1699. * @param i the first column is 1, the second is 2, ...
  1700. * @return an <code>Array</code> object representing the SQL ARRAY value in
  1701. * the specified column
  1702. */
  1703. Array getArray(int i) throws SQLException;
  1704. /**
  1705. * JDBC 2.0
  1706. *
  1707. * Returns the value in the specified column as a Java object.
  1708. * This method uses the specified <code>Map</code> object for
  1709. * custom mapping if appropriate.
  1710. *
  1711. * @param colName the name of the column from which to retrieve the value
  1712. * @param map the mapping from SQL type names to Java classes
  1713. * @return an object representing the SQL value in the specified column
  1714. */
  1715. Object getObject(String colName, java.util.Map map) throws SQLException;
  1716. /**
  1717. * JDBC 2.0
  1718. *
  1719. * Gets a REF(<structured-type>) column value from the current row.
  1720. *
  1721. * @param colName the column name
  1722. * @return a <code>Ref</code> object representing the SQL REF value in
  1723. * the specified column
  1724. */
  1725. Ref getRef(String colName) throws SQLException;
  1726. /**
  1727. * JDBC 2.0
  1728. *
  1729. * Gets a BLOB value in the current row of this <code>ResultSet</code> object.
  1730. *
  1731. * @param colName the name of the column from which to retrieve the value
  1732. * @return a <code>Blob</code> object representing the SQL BLOB value in
  1733. * the specified column
  1734. */
  1735. Blob getBlob(String colName) throws SQLException;
  1736. /**
  1737. * JDBC 2.0
  1738. *
  1739. * Gets a CLOB value in the current row of this <code>ResultSet</code> object.
  1740. *
  1741. * @param colName the name of the column from which to retrieve the value
  1742. * @return a <code>Clob</code> object representing the SQL CLOB value in
  1743. * the specified column
  1744. */
  1745. Clob getClob(String colName) throws SQLException;
  1746. /**
  1747. * JDBC 2.0
  1748. *
  1749. * Gets an SQL ARRAY value in the current row of this <code>ResultSet</code> object.
  1750. *
  1751. * @param colName the name of the column from which to retrieve the value
  1752. * @return an <code>Array</code> object representing the SQL ARRAY value in
  1753. * the specified column
  1754. */
  1755. Array getArray(String colName) throws SQLException;
  1756. /**
  1757. * JDBC 2.0
  1758. *
  1759. * Gets the value of a column in the current row as a java.sql.Date
  1760. * object. This method uses the given calendar to construct an appropriate millisecond
  1761. * value for the Date if the underlying database does not store
  1762. * timezone information.
  1763. *
  1764. * @param columnIndex the first column is 1, the second is 2, ...
  1765. * @param cal the calendar to use in constructing the date
  1766. * @return the column value; if the value is SQL NULL, the result is null
  1767. * @exception SQLException if a database access error occurs
  1768. */
  1769. java.sql.Date getDate(int columnIndex, Calendar cal) throws SQLException;
  1770. /**
  1771. * Gets the value of a column in the current row as a java.sql.Date
  1772. * object. This method uses the given calendar to construct an appropriate millisecond
  1773. * value for the Date, if the underlying database does not store
  1774. * timezone information.
  1775. *
  1776. * @param columnName the SQL name of the column from which to retrieve the value
  1777. * @param cal the calendar to use in constructing the date
  1778. * @return the column value; if the value is SQL NULL, the result is null
  1779. * @exception SQLException if a database access error occurs
  1780. */
  1781. java.sql.Date getDate(String columnName, Calendar cal) throws SQLException;
  1782. /**
  1783. * Gets the value of a column in the current row as a java.sql.Time
  1784. * object. This method uses the given calendar to construct an appropriate millisecond
  1785. * value for the Time if the underlying database does not store
  1786. * timezone information.
  1787. *
  1788. * @param columnIndex the first column is 1, the second is 2, ...
  1789. * @param cal the calendar to use in constructing the time
  1790. * @return the column value; if the value is SQL NULL, the result is null
  1791. * @exception SQLException if a database access error occurs
  1792. */
  1793. java.sql.Time getTime(int columnIndex, Calendar cal) throws SQLException;
  1794. /**
  1795. * Gets the value of a column in the current row as a java.sql.Time
  1796. * object. This method uses the given calendar to construct an appropriate millisecond
  1797. * value for the Time if the underlying database does not store
  1798. * timezone information.
  1799. *
  1800. * @param columnName the SQL name of the column
  1801. * @param cal the calendar to use in constructing the time
  1802. * @return the column value; if the value is SQL NULL, the result is null
  1803. * @exception SQLException if a database access error occurs
  1804. */
  1805. java.sql.Time getTime(String columnName, Calendar cal) throws SQLException;
  1806. /**
  1807. * Gets the value of a column in the current row as a java.sql.Timestamp
  1808. * object. This method uses the given calendar to construct an appropriate millisecond
  1809. * value for the Timestamp if the underlying database does not store
  1810. * timezone information.
  1811. *
  1812. * @param columnIndex the first column is 1, the second is 2, ...
  1813. * @param cal the calendar to use in constructing the timestamp
  1814. * @return the column value; if the value is SQL NULL, the result is null
  1815. * @exception SQLException if a database access error occurs
  1816. */
  1817. java.sql.Timestamp getTimestamp(int columnIndex, Calendar cal)
  1818. throws SQLException;
  1819. /**
  1820. * Gets the value of a column in the current row as a java.sql.Timestamp
  1821. * object. This method uses the given calendar to construct an appropriate millisecond
  1822. * value for the Timestamp if the underlying database does not store
  1823. * timezone information.
  1824. *
  1825. * @param columnName the SQL name of the column
  1826. * @param cal the calendar to use in constructing the timestamp
  1827. * @return the column value; if the value is SQL NULL, the result is null
  1828. * @exception SQLException if a database access error occurs
  1829. */
  1830. java.sql.Timestamp getTimestamp(String columnName, Calendar cal)
  1831. throws SQLException;
  1832. }