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