PageRenderTime 25ms CodeModel.GetById 22ms RepoModel.GetById 0ms app.codeStats 0ms

/libjava/classpath/java/sql/ResultSet.java

https://bitbucket.org/bluezoo/gcc
Java | 1613 lines | 178 code | 152 blank | 1283 comment | 0 complexity | 5283dcef6717e1f551ce0a18dc2221cb MD5 | raw file
Possible License(s): GPL-2.0, LGPL-2.1, AGPL-1.0, GPL-3.0, BSD-3-Clause, LGPL-2.0

Large files files are truncated, but you can click here to view the full file

  1. /* ResultSet.java -- A SQL statement result set.
  2. Copyright (C) 1999, 2000, 2002, 2006 Free Software Foundation, Inc.
  3. This file is part of GNU Classpath.
  4. GNU Classpath is free software; you can redistribute it and/or modify
  5. it under the terms of the GNU General Public License as published by
  6. the Free Software Foundation; either version 2, or (at your option)
  7. any later version.
  8. GNU Classpath is distributed in the hope that it will be useful, but
  9. WITHOUT ANY WARRANTY; without even the implied warranty of
  10. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  11. General Public License for more details.
  12. You should have received a copy of the GNU General Public License
  13. along with GNU Classpath; see the file COPYING. If not, write to the
  14. Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
  15. 02110-1301 USA.
  16. Linking this library statically or dynamically with other modules is
  17. making a combined work based on this library. Thus, the terms and
  18. conditions of the GNU General Public License cover the whole
  19. combination.
  20. As a special exception, the copyright holders of this library give you
  21. permission to link this library with independent modules to produce an
  22. executable, regardless of the license terms of these independent
  23. modules, and to copy and distribute the resulting executable under
  24. terms of your choice, provided that you also meet, for each linked
  25. independent module, the terms and conditions of the license of that
  26. module. An independent module is a module which is not derived from
  27. or based on this library. If you modify this library, you may extend
  28. this exception to your version of the library, but you are not
  29. obligated to do so. If you do not wish to do so, delete this
  30. exception statement from your version. */
  31. package java.sql;
  32. import java.io.InputStream;
  33. import java.io.Reader;
  34. import java.math.BigDecimal;
  35. import java.net.URL;
  36. import java.util.Calendar;
  37. import java.util.Map;
  38. /**
  39. * This interface provides access to the data set returned by a SQL
  40. * statement. An instance of this interface is returned by the various
  41. * execution methods in the <code>Statement</code>.
  42. *
  43. * <p> This class models a cursor, which can be stepped through one row at a
  44. * time. Methods are provided for accessing columns by column name or by
  45. * index.</p>
  46. *
  47. * <p> Note that a result set is invalidated if the statement that returned
  48. * it is closed.</p>
  49. *
  50. * @author Aaron M. Renn (arenn@urbanophile.com)
  51. */
  52. public interface ResultSet
  53. extends AutoCloseable
  54. {
  55. /**
  56. * The rows will be processed in order from first to last.
  57. */
  58. int FETCH_FORWARD = 1000;
  59. /**
  60. * The rows will be processed in order from last to first.
  61. */
  62. int FETCH_REVERSE = 1001;
  63. /**
  64. * The rows will be processed in an unknown order
  65. */
  66. int FETCH_UNKNOWN = 1002;
  67. /**
  68. * This type of result set may only step forward through the rows returned.
  69. */
  70. int TYPE_FORWARD_ONLY = 1003;
  71. /**
  72. * This type of result set is scrollable and is not sensitive to changes
  73. * made by other statements.
  74. */
  75. int TYPE_SCROLL_INSENSITIVE = 1004;
  76. /**
  77. * This type of result set is scrollable and is also sensitive to changes
  78. * made by other statements.
  79. */
  80. int TYPE_SCROLL_SENSITIVE = 1005;
  81. /**
  82. * The concurrency mode of for the result set may not be modified.
  83. */
  84. int CONCUR_READ_ONLY = 1007;
  85. /**
  86. * The concurrency mode of for the result set may be modified.
  87. */
  88. int CONCUR_UPDATABLE = 1008;
  89. int HOLD_CURSORS_OVER_COMMIT = 1;
  90. int CLOSE_CURSORS_AT_COMMIT = 2;
  91. /**
  92. * This method advances to the next row in the result set. Any streams
  93. * open on the current row are closed automatically.
  94. *
  95. * @return <code>true</code> if the next row exists, <code>false</code>
  96. * otherwise.
  97. * @exception SQLException If an error occurs.
  98. */
  99. boolean next() throws SQLException;
  100. /**
  101. * This method closes the result set and frees any associated resources.
  102. *
  103. * @exception SQLException If an error occurs.
  104. */
  105. void close() throws SQLException;
  106. /**
  107. * This method tests whether the value of the last column that was fetched
  108. * was actually a SQL NULL value.
  109. *
  110. * @return <code>true</code> if the last column fetched was a NULL,
  111. * <code>false</code> otherwise.
  112. * @exception SQLException If an error occurs.
  113. */
  114. boolean wasNull() throws SQLException;
  115. /**
  116. * This method returns the value of the specified column as a Java
  117. * <code>String</code>.
  118. *
  119. * @param columnIndex The index of the column to return.
  120. * @return The column value as a <code>String</code>.
  121. * @exception SQLException If an error occurs.
  122. */
  123. String getString(int columnIndex) throws SQLException;
  124. /**
  125. * This method returns the value of the specified column as a Java
  126. * <code>boolean</code>.
  127. *
  128. * @param columnIndex The index of the column to return.
  129. * @return The column value as a <code>boolean</code>.
  130. * @exception SQLException If an error occurs.
  131. */
  132. boolean getBoolean(int columnIndex) throws SQLException;
  133. /**
  134. * This method returns the value of the specified column as a Java
  135. * <code>byte</code>.
  136. *
  137. * @param columnIndex The index of the column to return.
  138. * @return The column value as a <code>byte</code>.
  139. * @exception SQLException If an error occurs.
  140. */
  141. byte getByte(int columnIndex) throws SQLException;
  142. /**
  143. * This method returns the value of the specified column as a Java
  144. * <code>short</code>.
  145. *
  146. * @param columnIndex The index of the column to return.
  147. * @return The column value as a <code>short</code>.
  148. * @exception SQLException If an error occurs.
  149. */
  150. short getShort(int columnIndex) throws SQLException;
  151. /**
  152. * This method returns the value of the specified column as a Java
  153. * <code>int</code>.
  154. *
  155. * @param columnIndex The index of the column to return.
  156. * @return The column value as a <code>int</code>.
  157. * @exception SQLException If an error occurs.
  158. */
  159. int getInt(int columnIndex) throws SQLException;
  160. /**
  161. * This method returns the value of the specified column as a Java
  162. * <code>long</code>.
  163. *
  164. * @param columnIndex The index of the column to return.
  165. * @return The column value as a <code>long</code>.
  166. * @exception SQLException If an error occurs.
  167. */
  168. long getLong(int columnIndex) throws SQLException;
  169. /**
  170. * This method returns the value of the specified column as a Java
  171. * <code>float</code>.
  172. *
  173. * @param columnIndex The index of the column to return.
  174. * @return The column value as a <code>float</code>.
  175. * @exception SQLException If an error occurs.
  176. */
  177. float getFloat(int columnIndex) throws SQLException;
  178. /**
  179. * This method returns the value of the specified column as a Java
  180. * <code>double</code>.
  181. *
  182. * @param columnIndex The index of the column to return.
  183. * @return The column value as a <code>double</code>.
  184. * @exception SQLException If an error occurs.
  185. */
  186. double getDouble(int columnIndex) throws SQLException;
  187. /**
  188. * This method returns the value of the specified column as a Java
  189. * <code>BigDecimal</code>.
  190. *
  191. * @param columnIndex The index of the column to return.
  192. * @param scale The number of digits to the right of the decimal to return.
  193. * @return The column value as a <code>BigDecimal</code>.
  194. * @exception SQLException If an error occurs.
  195. * @deprecated
  196. */
  197. BigDecimal getBigDecimal(int columnIndex, int scale)
  198. throws SQLException;
  199. /**
  200. * This method returns the value of the specified column as a Java
  201. * byte array.
  202. *
  203. * @param columnIndex The index of the column to return.
  204. * @return The column value as a byte array
  205. * @exception SQLException If an error occurs.
  206. */
  207. byte[] getBytes(int columnIndex) throws SQLException;
  208. /**
  209. * This method returns the value of the specified column as a Java
  210. * <code>java.sql.Date</code>.
  211. *
  212. * @param columnIndex The index of the column to return.
  213. * @return The column value as a <code>java.sql.Date</code>.
  214. * @exception SQLException If an error occurs.
  215. */
  216. Date getDate(int columnIndex) throws SQLException;
  217. /**
  218. * This method returns the value of the specified column as a Java
  219. * <code>java.sql.Time</code>.
  220. *
  221. * @param columnIndex The index of the column to return.
  222. * @return The column value as a <code>java.sql.Time</code>.
  223. * @exception SQLException If an error occurs.
  224. */
  225. Time getTime(int columnIndex) throws SQLException;
  226. /**
  227. * This method returns the value of the specified column as a Java
  228. * <code>java.sql.Timestamp</code>.
  229. *
  230. * @param columnIndex The index of the column to return.
  231. * @return The column value as a <code>java.sql.Timestamp</code>.
  232. * @exception SQLException If an error occurs.
  233. */
  234. Timestamp getTimestamp(int columnIndex) throws SQLException;
  235. /**
  236. * This method returns the value of the specified column as an ASCII
  237. * stream. Note that all the data from this stream must be read before
  238. * fetching the value of any other column. Please also be aware that
  239. * calling <code>next()</code> or <code>close()</code> on this result set
  240. * will close this stream as well.
  241. *
  242. * @param columnIndex The index of the column to return.
  243. * @return The column value as an ASCII <code>InputStream</code>.
  244. * @exception SQLException If an error occurs.
  245. */
  246. InputStream getAsciiStream(int columnIndex) throws SQLException;
  247. /**
  248. * This method returns the value of the specified column as a Unicode UTF-8
  249. * stream. Note that all the data from this stream must be read before
  250. * fetching the value of any other column. Please also be aware that
  251. * calling <code>next()</code> or <code>close()</code> on this result set
  252. * will close this stream as well.
  253. *
  254. * @param columnIndex The index of the column to return.
  255. * @return The column value as a Unicode UTF-8 <code>InputStream</code>.
  256. * @exception SQLException If an error occurs.
  257. * @deprecated Use getCharacterStream instead.
  258. */
  259. InputStream getUnicodeStream(int columnIndex) throws SQLException;
  260. /**
  261. * This method returns the value of the specified column as a raw byte
  262. * stream. Note that all the data from this stream must be read before
  263. * fetching the value of any other column. Please also be aware that
  264. * calling <code>next()</code> or <code>close()</code> on this result set
  265. * will close this stream as well.
  266. *
  267. * @param columnIndex The index of the column to return.
  268. * @return The column value as a raw byte <code>InputStream</code>.
  269. * @exception SQLException If an error occurs.
  270. */
  271. InputStream getBinaryStream(int columnIndex) throws SQLException;
  272. /**
  273. * This method returns the value of the specified column as a Java
  274. * <code>String</code>.
  275. *
  276. * @param columnName The name of the column to return.
  277. * @return The column value as a <code>String</code>.
  278. * @exception SQLException If an error occurs.
  279. */
  280. String getString(String columnName) throws SQLException;
  281. /**
  282. * This method returns the value of the specified column as a Java
  283. * <code>boolean</code>.
  284. *
  285. * @param columnName The name of the column to return.
  286. * @return The column value as a <code>boolean</code>.
  287. * @exception SQLException If an error occurs.
  288. */
  289. boolean getBoolean(String columnName) throws SQLException;
  290. /**
  291. * This method returns the value of the specified column as a Java
  292. * <code>byte</code>.
  293. *
  294. * @param columnName The name of the column to return.
  295. * @return The column value as a <code>byte</code>.
  296. * @exception SQLException If an error occurs.
  297. */
  298. byte getByte(String columnName) throws SQLException;
  299. /**
  300. * This method returns the value of the specified column as a Java
  301. * <code>short</code>.
  302. *
  303. * @param columnName The name of the column to return.
  304. * @return The column value as a <code>short</code>.
  305. * @exception SQLException If an error occurs.
  306. */
  307. short getShort(String columnName) throws SQLException;
  308. /**
  309. * This method returns the value of the specified column as a Java
  310. * <code>int</code>.
  311. *
  312. * @param columnName The name of the column to return.
  313. * @return The column value as a <code>int</code>.
  314. * @exception SQLException If an error occurs.
  315. */
  316. int getInt(String columnName) throws SQLException;
  317. /**
  318. * This method returns the value of the specified column as a Java
  319. * <code>long</code>.
  320. *
  321. * @param columnName The name of the column to return.
  322. * @return The column value as a <code>long</code>.
  323. * @exception SQLException If an error occurs.
  324. */
  325. long getLong(String columnName) throws SQLException;
  326. /**
  327. * This method returns the value of the specified column as a Java
  328. * <code>float</code>.
  329. *
  330. * @param columnName The name of the column to return.
  331. * @return The column value as a <code>float</code>.
  332. * @exception SQLException If an error occurs.
  333. */
  334. float getFloat(String columnName) throws SQLException;
  335. /**
  336. * This method returns the value of the specified column as a Java
  337. * <code>double</code>.
  338. *
  339. * @param columnName The name of the column to return.
  340. * @return The column value as a <code>double</code>.
  341. * @exception SQLException If an error occurs.
  342. */
  343. double getDouble(String columnName) throws SQLException;
  344. /**
  345. * This method returns the value of the specified column as a Java
  346. * <code>BigDecimal</code>.
  347. *
  348. * @param columnName The name of the column to return.
  349. * @return The column value as a <code>BigDecimal</code>.
  350. * @exception SQLException If an error occurs.
  351. * @deprecated
  352. */
  353. BigDecimal getBigDecimal(String columnName, int scale)
  354. throws SQLException;
  355. /**
  356. * This method returns the value of the specified column as a Java
  357. * byte array.
  358. *
  359. * @param columnName The name of the column to return.
  360. * @return The column value as a byte array
  361. * @exception SQLException If an error occurs.
  362. */
  363. byte[] getBytes(String columnName) throws SQLException;
  364. /**
  365. * This method returns the value of the specified column as a Java
  366. * <code>java.sql.Date</code>.
  367. *
  368. * @param columnName The name of the column to return.
  369. * @return The column value as a <code>java.sql.Date</code>.
  370. * @exception SQLException If an error occurs.
  371. */
  372. Date getDate(String columnName) throws SQLException;
  373. /**
  374. * This method returns the value of the specified column as a Java
  375. * <code>java.sql.Time</code>.
  376. *
  377. * @param columnName The name of the column to return.
  378. * @return The column value as a <code>java.sql.Time</code>.
  379. * @exception SQLException If an error occurs.
  380. */
  381. Time getTime(String columnName) throws SQLException;
  382. /**
  383. * This method returns the value of the specified column as a Java
  384. * <code>java.sql.Timestamp</code>.
  385. *
  386. * @param columnName The name of the column to return.
  387. * @return The column value as a <code>java.sql.Timestamp</code>.
  388. * @exception SQLException If an error occurs.
  389. */
  390. Timestamp getTimestamp(String columnName) throws SQLException;
  391. /**
  392. * This method returns the value of the specified column as an ASCII
  393. * stream. Note that all the data from this stream must be read before
  394. * fetching the value of any other column. Please also be aware that
  395. * calling <code>next()</code> or <code>close()</code> on this result set
  396. * will close this stream as well.
  397. *
  398. * @param columnName The name of the column to return.
  399. * @return The column value as an ASCII <code>InputStream</code>.
  400. * @exception SQLException If an error occurs.
  401. */
  402. InputStream getAsciiStream(String columnName) throws SQLException;
  403. /**
  404. * This method returns the value of the specified column as a Unicode UTF-8
  405. * stream. Note that all the data from this stream must be read before
  406. * fetching the value of any other column. Please also be aware that
  407. * calling <code>next()</code> or <code>close()</code> on this result set
  408. * will close this stream as well.
  409. *
  410. * @param columnName The name of the column to return.
  411. * @return The column value as a Unicode UTF-8 <code>InputStream</code>.
  412. * @exception SQLException If an error occurs.
  413. * @deprecated Use getCharacterStream instead.
  414. */
  415. InputStream getUnicodeStream(String columnName) throws SQLException;
  416. /**
  417. * This method returns the value of the specified column as a raw byte
  418. * stream. Note that all the data from this stream must be read before
  419. * fetching the value of any other column. Please also be aware that
  420. * calling <code>next()</code> or <code>close()</code> on this result set
  421. * will close this stream as well.
  422. *
  423. * @param columnName The name of the column to return.
  424. * @return The column value as a raw byte <code>InputStream</code>.
  425. * @exception SQLException If an error occurs.
  426. */
  427. InputStream getBinaryStream(String columnName) throws SQLException;
  428. /**
  429. * This method returns the first SQL warning associated with this result
  430. * set. Any additional warnings will be chained to this one.
  431. *
  432. * @return The first SQLWarning for this result set, or <code>null</code> if
  433. * there are no warnings.
  434. * @exception SQLException If an error occurs.
  435. */
  436. SQLWarning getWarnings() throws SQLException;
  437. /**
  438. * This method clears all warnings associated with this result set.
  439. *
  440. * @exception SQLException If an error occurs.
  441. */
  442. void clearWarnings() throws SQLException;
  443. /**
  444. * This method returns the name of the database cursor used by this
  445. * result set.
  446. *
  447. * @return The name of the database cursor used by this result set.
  448. * @exception SQLException If an error occurs.
  449. */
  450. String getCursorName() throws SQLException;
  451. /**
  452. * This method returns data about the columns returned as part of the
  453. * result set as a <code>ResultSetMetaData</code> instance.
  454. *
  455. * @return The <code>ResultSetMetaData</code> instance for this result set.
  456. * @exception SQLException If an error occurs.
  457. */
  458. ResultSetMetaData getMetaData() throws SQLException;
  459. /**
  460. * This method returns the value of the specified column as a Java
  461. * <code>Object</code>.
  462. *
  463. * @param columnIndex The index of the column to return.
  464. * @return The column value as an <code>Object</code>.
  465. * @exception SQLException If an error occurs.
  466. */
  467. Object getObject(int columnIndex) throws SQLException;
  468. /**
  469. * This method returns the value of the specified column as a Java
  470. * <code>Object</code>.
  471. *
  472. * @param columnName The name of the column to return.
  473. * @return The column value as an <code>Object</code>.
  474. * @exception SQLException If an error occurs.
  475. */
  476. Object getObject(String columnName) throws SQLException;
  477. /**
  478. * This method returns the column index of the specified named column.
  479. *
  480. * @param columnName The name of the column.
  481. * @return The index of the column.
  482. * @exception SQLException If an error occurs.
  483. */
  484. int findColumn(String columnName) throws SQLException;
  485. /**
  486. * This method returns the value of the specified column as a character
  487. * stream. Note that all the data from this stream must be read before
  488. * fetching the value of any other column. Please also be aware that
  489. * calling <code>next()</code> or <code>close()</code> on this result set
  490. * will close this stream as well.
  491. *
  492. * @param columnIndex The index of the column to return.
  493. * @return The column value as an character <code>Reader</code>.
  494. * @exception SQLException If an error occurs.
  495. */
  496. Reader getCharacterStream(int columnIndex) throws SQLException;
  497. /**
  498. * This method returns the value of the specified column as a character
  499. * stream. Note that all the data from this stream must be read before
  500. * fetching the value of any other column. Please also be aware that
  501. * calling <code>next()</code> or <code>close()</code> on this result set
  502. * will close this stream as well.
  503. *
  504. * @param columnName The name of the column to return.
  505. * @return The column value as an character <code>Reader</code>.
  506. * @exception SQLException If an error occurs.
  507. */
  508. Reader getCharacterStream(String columnName) throws SQLException;
  509. /**
  510. * This method returns the value of the specified column as a Java
  511. * <code>BigDecimal</code>.
  512. *
  513. * @param columnIndex The index of the column to return.
  514. * @return The column value as a <code>BigDecimal</code>.
  515. * @exception SQLException If an error occurs.
  516. */
  517. BigDecimal getBigDecimal(int columnIndex) throws SQLException;
  518. /**
  519. * This method returns the value of the specified column as a Java
  520. * <code>BigDecimal</code>.
  521. *
  522. * @param columnName The name of the column to return.
  523. * @return The column value as a <code>BigDecimal</code>.
  524. * @exception SQLException If an error occurs.
  525. */
  526. BigDecimal getBigDecimal(String columnName) throws SQLException;
  527. /**
  528. * This method tests whether or not the cursor is before the first row
  529. * in the result set.
  530. *
  531. * @return <code>true</code> if the cursor is positioned before the first
  532. * row, <code>false</code> otherwise.
  533. * @exception SQLException If an error occurs.
  534. */
  535. boolean isBeforeFirst() throws SQLException;
  536. /**
  537. * This method tests whether or not the cursor is after the last row
  538. * in the result set.
  539. *
  540. * @return <code>true</code> if the cursor is positioned after the last
  541. * row, <code>false</code> otherwise.
  542. * @exception SQLException If an error occurs.
  543. */
  544. boolean isAfterLast() throws SQLException;
  545. /**
  546. * This method tests whether or not the cursor is positioned on the first
  547. * row in the result set.
  548. *
  549. * @return <code>true</code> if the cursor is positioned on the first
  550. * row, <code>false</code> otherwise.
  551. * @exception SQLException If an error occurs.
  552. */
  553. boolean isFirst() throws SQLException;
  554. /**
  555. * This method tests whether or not the cursor is on the last row
  556. * in the result set.
  557. *
  558. * @return <code>true</code> if the cursor is positioned on the last
  559. * row, <code>false</code> otherwise.
  560. * @exception SQLException If an error occurs.
  561. */
  562. boolean isLast() throws SQLException;
  563. /**
  564. * This method repositions the cursor to before the first row in the
  565. * result set.
  566. *
  567. * @exception SQLException If an error occurs.
  568. */
  569. void beforeFirst() throws SQLException;
  570. /**
  571. * This method repositions the cursor to after the last row in the result
  572. * set.
  573. *
  574. * @exception SQLException If an error occurs.
  575. */
  576. void afterLast() throws SQLException;
  577. /**
  578. * This method repositions the cursor on the first row in the
  579. * result set.
  580. *
  581. * @return <code>true</code> if the cursor is on a valid row;
  582. * <code>false</code> if there are no rows in the result set.
  583. * @exception SQLException If an error occurs.
  584. */
  585. boolean first() throws SQLException;
  586. /**
  587. * This method repositions the cursor on the last row in the result
  588. * set.
  589. *
  590. * @return <code>true</code> if the cursor is on a valid row;
  591. * <code>false</code> if there are no rows in the result set.
  592. * @exception SQLException If an error occurs.
  593. */
  594. boolean last() throws SQLException;
  595. /**
  596. * This method returns the current row number in the cursor. Numbering
  597. * begins at index 1.
  598. *
  599. * @return The current row number, or 0 if there is not current row.
  600. * @exception SQLException If an error occurs.
  601. */
  602. int getRow() throws SQLException;
  603. /**
  604. * This method positions the result set to the specified absolute row.
  605. * Positive numbers are row offsets from the beginning of the result
  606. * set (numbering starts from row 1) and negative numbers are row offsets
  607. * from the end of the result set (numbering starts from -1).
  608. *
  609. * @param row The row to position the result set to.
  610. *
  611. * @return <code>true</code> if the current position was changed,
  612. * <code>false</code> otherwise.
  613. * @exception SQLException If an error occurs.
  614. */
  615. boolean absolute(int row) throws SQLException;
  616. /**
  617. * This method moves the result set position relative to the current row.
  618. * The offset can be positive or negative.
  619. *
  620. * @param rows The number of row positions to move.
  621. * @return <code>true</code> if the current position was changed,
  622. * <code>false</code> otherwise.
  623. * @exception SQLException If an error occurs.
  624. */
  625. boolean relative(int rows) throws SQLException;
  626. /**
  627. * This method moves the current position to the previous row in the
  628. * result set.
  629. *
  630. * @return <code>true</code> if the previous row exists, <code>false</code>
  631. * otherwise.
  632. * @exception SQLException If an error occurs.
  633. */
  634. boolean previous() throws SQLException;
  635. /**
  636. * This method provides a hint to the driver about which direction the
  637. * result set will be processed in.
  638. *
  639. * @param direction The direction in which rows will be processed. The
  640. * allowed values are the <code>FETCH_*</code> constants
  641. * defined in this interface.
  642. * @exception SQLException If an error occurs.
  643. */
  644. void setFetchDirection(int direction) throws SQLException;
  645. /**
  646. * This method returns the current fetch direction for this result set.
  647. *
  648. * @return The fetch direction for this result set.
  649. * @exception SQLException If an error occurs.
  650. */
  651. int getFetchDirection() throws SQLException;
  652. /**
  653. * This method provides a hint to the driver about how many rows at a
  654. * time it should fetch from the database.
  655. *
  656. * @param rows The number of rows the driver should fetch per call.
  657. * @exception SQLException If an error occurs.
  658. */
  659. void setFetchSize(int rows) throws SQLException;
  660. /**
  661. * This method returns the current number of rows that will be fetched
  662. * from the database at a time.
  663. *
  664. * @return The current fetch size for this result set.
  665. * @exception SQLException If an error occurs.
  666. */
  667. int getFetchSize() throws SQLException;
  668. /**
  669. * This method returns the result set type of this result set. This will
  670. * be one of the <code>TYPE_*</code> constants defined in this interface.
  671. *
  672. * @return The result set type.
  673. * @exception SQLException If an error occurs.
  674. */
  675. int getType() throws SQLException;
  676. /**
  677. * This method returns the concurrency type of this result set. This will
  678. * be one of the <code>CONCUR_*</code> constants defined in this interface.
  679. *
  680. * @return The result set concurrency type.
  681. * @exception SQLException If an error occurs.
  682. */
  683. int getConcurrency() throws SQLException;
  684. /**
  685. * This method tests whether or not the current row in the result set
  686. * has been updated. Updates must be visible in order of this method to
  687. * detect the update.
  688. *
  689. * @return <code>true</code> if the row has been updated, <code>false</code>
  690. * otherwise.
  691. * @exception SQLException If an error occurs.
  692. */
  693. boolean rowUpdated() throws SQLException;
  694. /**
  695. * This method tests whether or not the current row in the result set
  696. * has been inserted. Inserts must be visible in order of this method to
  697. * detect the insert.
  698. *
  699. * @return <code>true</code> if the row has been inserted, <code>false</code>
  700. * otherwise.
  701. * @exception SQLException If an error occurs.
  702. */
  703. boolean rowInserted() throws SQLException;
  704. /**
  705. * This method tests whether or not the current row in the result set
  706. * has been deleted. Deletes must be visible in order of this method to
  707. * detect the deletion.
  708. *
  709. * @return <code>true</code> if the row has been deleted, <code>false</code>
  710. * otherwise.
  711. * @exception SQLException If an error occurs.
  712. */
  713. boolean rowDeleted() throws SQLException;
  714. /**
  715. * This method updates the specified column to have a NULL value. This
  716. * does not update the actual database. <code>updateRow</code> must be
  717. * called in order to do that.
  718. *
  719. * @param columnIndex The index of the column to update.
  720. * @exception SQLException If an error occurs.
  721. */
  722. void updateNull(int columnIndex) throws SQLException;
  723. /**
  724. * This method updates the specified column to have a boolean value. This
  725. * does not update the actual database. <code>updateRow</code> must be
  726. * called in order to do that.
  727. *
  728. * @param columnIndex The index of the column to update.
  729. * @param value The new value of the column.
  730. * @exception SQLException If an error occurs.
  731. */
  732. void updateBoolean(int columnIndex, boolean value) throws SQLException;
  733. /**
  734. * This method updates the specified column to have a byte value. This
  735. * does not update the actual database. <code>updateRow</code> must be
  736. * called in order to do that.
  737. *
  738. * @param columnIndex The index of the column to update.
  739. * @param value The new value of the column.
  740. * @exception SQLException If an error occurs.
  741. */
  742. void updateByte(int columnIndex, byte value) throws SQLException;
  743. /**
  744. * This method updates the specified column to have a short value. This
  745. * does not update the actual database. <code>updateRow</code> must be
  746. * called in order to do that.
  747. *
  748. * @param columnIndex The index of the column to update.
  749. * @param value The new value of the column.
  750. * @exception SQLException If an error occurs.
  751. */
  752. void updateShort(int columnIndex, short value) throws SQLException;
  753. /**
  754. * This method updates the specified column to have an int value. This
  755. * does not update the actual database. <code>updateRow</code> must be
  756. * called in order to do that.
  757. *
  758. * @param columnIndex The index of the column to update.
  759. * @param value The new value of the column.
  760. * @exception SQLException If an error occurs.
  761. */
  762. void updateInt(int columnIndex, int value) throws SQLException;
  763. /**
  764. * This method updates the specified column to have a long value. This
  765. * does not update the actual database. <code>updateRow</code> must be
  766. * called in order to do that.
  767. *
  768. * @param columnIndex The index of the column to update.
  769. * @param value The new value of the column.
  770. * @exception SQLException If an error occurs.
  771. */
  772. void updateLong(int columnIndex, long value) throws SQLException;
  773. /**
  774. * This method updates the specified column to have a float value. This
  775. * does not update the actual database. <code>updateRow</code> must be
  776. * called in order to do that.
  777. *
  778. * @param columnIndex The index of the column to update.
  779. * @param value The new value of the column.
  780. * @exception SQLException If an error occurs.
  781. */
  782. void updateFloat(int columnIndex, float value) throws SQLException;
  783. /**
  784. * This method updates the specified column to have a double value. This
  785. * does not update the actual database. <code>updateRow</code> must be
  786. * called in order to do that.
  787. *
  788. * @param columnIndex The index of the column to update.
  789. * @param value The new value of the column.
  790. * @exception SQLException If an error occurs.
  791. */
  792. void updateDouble(int columnIndex, double value) throws SQLException;
  793. /**
  794. * This method updates the specified column to have a BigDecimal value. This
  795. * does not update the actual database. <code>updateRow</code> must be
  796. * called in order to do that.
  797. *
  798. * @param columnIndex The index of the column to update.
  799. * @param value The new value of the column.
  800. * @exception SQLException If an error occurs.
  801. */
  802. void updateBigDecimal(int columnIndex, BigDecimal value)
  803. throws SQLException;
  804. /**
  805. * This method updates the specified column to have a String value. This
  806. * does not update the actual database. <code>updateRow</code> must be
  807. * called in order to do that.
  808. *
  809. * @param columnIndex The index of the column to update.
  810. * @param value The new value of the column.
  811. * @exception SQLException If an error occurs.
  812. */
  813. void updateString(int columnIndex, String value) throws SQLException;
  814. /**
  815. * This method updates the specified column to have a byte array value. This
  816. * does not update the actual database. <code>updateRow</code> must be
  817. * called in order to do that.
  818. *
  819. * @param columnIndex The index of the column to update.
  820. * @param value The new value of the column.
  821. * @exception SQLException If an error occurs.
  822. */
  823. void updateBytes(int columnIndex, byte[] value) throws SQLException;
  824. /**
  825. * This method updates the specified column to have a java.sql.Date value. This
  826. * does not update the actual database. <code>updateRow</code> must be
  827. * called in order to do that.
  828. *
  829. * @param columnIndex The index of the column to update.
  830. * @param value The new value of the column.
  831. * @exception SQLException If an error occurs.
  832. */
  833. void updateDate(int columnIndex, Date value) throws SQLException;
  834. /**
  835. * This method updates the specified column to have a java.sql.Time value. This
  836. * does not update the actual database. <code>updateRow</code> must be
  837. * called in order to do that.
  838. *
  839. * @param columnIndex The index of the column to update.
  840. * @param value The new value of the column.
  841. * @exception SQLException If an error occurs.
  842. */
  843. void updateTime(int columnIndex, Time value) throws SQLException;
  844. /**
  845. * This method updates the specified column to have a java.sql.Timestamp value.
  846. * This does not update the actual database. <code>updateRow</code> must be
  847. * called in order to do that.
  848. *
  849. * @param columnIndex The index of the column to update.
  850. * @param value The new value of the column.
  851. * @exception SQLException If an error occurs.
  852. */
  853. void updateTimestamp(int columnIndex, Timestamp value)
  854. throws SQLException;
  855. /**
  856. * This method updates the specified column from an ASCII text stream.
  857. * This does not update the actual database. <code>updateRow</code> must be
  858. * called in order to do that.
  859. *
  860. * @param columnIndex The index of the column to update.
  861. * @param stream The stream from which the column value is updated.
  862. * @param count The length of the stream.
  863. * @exception SQLException If an error occurs.
  864. */
  865. void updateAsciiStream(int columnIndex, InputStream stream, int count)
  866. throws SQLException;
  867. /**
  868. * This method updates the specified column from a binary stream.
  869. * This does not update the actual database. <code>updateRow</code> must be
  870. * called in order to do that.
  871. *
  872. * @param columnIndex The index of the column to update.
  873. * @param stream The stream from which the column value is updated.
  874. * @param count The length of the stream.
  875. * @exception SQLException If an error occurs.
  876. */
  877. void updateBinaryStream(int columnIndex, InputStream stream, int count)
  878. throws SQLException;
  879. /**
  880. * This method updates the specified column from a character stream.
  881. * This does not update the actual database. <code>updateRow</code> must be
  882. * called in order to do that.
  883. *
  884. * @param columnIndex The index of the column to update.
  885. * @param reader The reader from which the column value is updated.
  886. * @param count The length of the stream.
  887. * @exception SQLException If an error occurs.
  888. */
  889. void updateCharacterStream(int columnIndex, Reader reader, int count)
  890. throws SQLException;
  891. /**
  892. * This method updates the specified column to have an Object value.
  893. * This does not update the actual database. <code>updateRow</code> must be
  894. * called in order to do that.
  895. *
  896. * @param columnIndex The index of the column to update.
  897. * @param value The new value of the column.
  898. * @param scale The scale of the object in question, which is used only
  899. * for numeric type objects.
  900. * @exception SQLException If an error occurs.
  901. */
  902. void updateObject(int columnIndex, Object value, int scale)
  903. throws SQLException;
  904. /**
  905. * This method updates the specified column to have an Object value.
  906. * This does not update the actual database. <code>updateRow</code> must be
  907. * called in order to do that.
  908. *
  909. * @param columnIndex The index of the column to update.
  910. * @param value The new value of the column.
  911. * @exception SQLException If an error occurs.
  912. */
  913. void updateObject(int columnIndex, Object value) throws SQLException;
  914. /**
  915. * This method updates the specified column to have a NULL value. This
  916. * does not update the actual database. <code>updateRow</code> must be
  917. * called in order to do that.
  918. *
  919. * @param columnName The name of the column to update.
  920. * @exception SQLException If an error occurs.
  921. */
  922. void updateNull(String columnName) throws SQLException;
  923. /**
  924. * This method updates the specified column to have a boolean value. This
  925. * does not update the actual database. <code>updateRow</code> must be
  926. * called in order to do that.
  927. *
  928. * @param columnName The name of the column to update.
  929. * @param value The new value of the column.
  930. * @exception SQLException If an error occurs.
  931. */
  932. void updateBoolean(String columnName, boolean value) throws SQLException;
  933. /**
  934. * This method updates the specified column to have a byte value. This
  935. * does not update the actual database. <code>updateRow</code> must be
  936. * called in order to do that.
  937. *
  938. * @param columnName The name of the column to update.
  939. * @param value The new value of the column.
  940. * @exception SQLException If an error occurs.
  941. */
  942. void updateByte(String columnName, byte value) throws SQLException;
  943. /**
  944. * This method updates the specified column to have a short value. This
  945. * does not update the actual database. <code>updateRow</code> must be
  946. * called in order to do that.
  947. *
  948. * @param columnName The name of the column to update.
  949. * @param value The new value of the column.
  950. * @exception SQLException If an error occurs.
  951. */
  952. void updateShort(String columnName, short value) throws SQLException;
  953. /**
  954. * This method updates the specified column to have an int value. This
  955. * does not update the actual database. <code>updateRow</code> must be
  956. * called in order to do that.
  957. *
  958. * @param columnName The name of the column to update.
  959. * @param value The new value of the column.
  960. * @exception SQLException If an error occurs.
  961. */
  962. void updateInt(String columnName, int value) throws SQLException;
  963. /**
  964. * This method updates the specified column to have a long value. This
  965. * does not update the actual database. <code>updateRow</code> must be
  966. * called in order to do that.
  967. *
  968. * @param columnName The name of the column to update.
  969. * @param value The new value of the column.
  970. * @exception SQLException If an error occurs.
  971. */
  972. void updateLong(String columnName, long value) throws SQLException;
  973. /**
  974. * This method updates the specified column to have a float value. This
  975. * does not update the actual database. <code>updateRow</code> must be
  976. * called in order to do that.
  977. *
  978. * @param columnName The name of the column to update.
  979. * @param value The new value of the column.
  980. * @exception SQLException If an error occurs.
  981. */
  982. void updateFloat(String columnName, float value) throws SQLException;
  983. /**
  984. * This method updates the specified column to have a double value. This
  985. * does not update the actual database. <code>updateRow</code> must be
  986. * called in order to do that.
  987. *
  988. * @param columnName The name of the column to update.
  989. * @param value The new value of the column.
  990. * @exception SQLException If an error occurs.
  991. */
  992. void updateDouble(String columnName, double value) throws SQLException;
  993. /**
  994. * This method updates the specified column to have a BigDecimal value. This
  995. * does not update the actual database. <code>updateRow</code> must be
  996. * called in order to do that.
  997. *
  998. * @param columnName The name of the column to update.
  999. * @param value The new value of the column.
  1000. * @exception SQLException If an error occurs.
  1001. */
  1002. void updateBigDecimal(String columnName, BigDecimal value)
  1003. throws SQLException;
  1004. /**
  1005. * This method updates the specified column to have a String value. This
  1006. * does not update the actual database. <code>updateRow</code> must be
  1007. * called in order to do that.
  1008. *
  1009. * @param columnName The name of the column to update.
  1010. * @param value The new value of the column.
  1011. * @exception SQLException If an error occurs.
  1012. */
  1013. void updateString(String columnName, String value) throws SQLException;
  1014. /**
  1015. * This method updates the specified column to have a byte array value. This
  1016. * does not update the actual database. <code>updateRow</code> must be
  1017. * called in order to do that.
  1018. *
  1019. * @param columnName The name of the column to update.
  1020. * @param value The new value of the column.
  1021. * @exception SQLException If an error occurs.
  1022. */
  1023. void updateBytes(String columnName, byte[] value) throws SQLException;
  1024. /**
  1025. * This method updates the specified column to have a java.sql.Date value. This
  1026. * does not update the actual database. <code>updateRow</code> must be
  1027. * called in order to do that.
  1028. *
  1029. * @param columnName The name of the column to update.
  1030. * @param value The new value of the column.
  1031. * @exception SQLException If an error occurs.
  1032. */
  1033. void updateDate(String columnName, Date value) throws SQLException;
  1034. /**
  1035. * This method updates the specified column to have a java.sql.Time value. This
  1036. * does not update the actual database. <code>updateRow</code> must be
  1037. * called in order to do that.
  1038. *
  1039. * @param columnName The name of the column to update.
  1040. * @param value The new value of the column.
  1041. * @exception SQLException If an error occurs.
  1042. */
  1043. void updateTime(String columnName, Time value) throws SQLException;
  1044. /**
  1045. * This method updates the specified column to have a java.sql.Timestamp value.
  1046. * This does not update the actual database. <code>updateRow</code> must be
  1047. * called in order to do that.
  1048. *
  1049. * @param columnName The name of the column to update.
  1050. * @param value The new value of the column.
  1051. * @exception SQLException If an error occurs.
  1052. */
  1053. void updateTimestamp(String columnName, Timestamp value)
  1054. throws SQLException;
  1055. /**
  1056. * This method updates the specified column from an ASCII text stream.
  1057. * This does not update the actual database. <code>updateRow</code> must be
  1058. * called in order to do that.
  1059. *
  1060. * @param columnName The name of the column to update.
  1061. * @param stream The stream from which the column value is updated.
  1062. * @param count The length of the stream.
  1063. * @exception SQLException If an error occurs.
  1064. */
  1065. void updateAsciiStream(String columnName, InputStream stream, int count)
  1066. throws SQLException;
  1067. /**
  1068. * This method updates the specified column from a binary stream.
  1069. * This does not update the actual database. <code>updateRow</code> must be
  1070. * called in order to do that.
  1071. *
  1072. * @param columnName The name of the column to update.
  1073. * @param stream The stream from which the column value is updated.
  1074. * @param count The length of the stream.
  1075. * @exception SQLException If an error occurs.
  1076. */
  1077. void updateBinaryStream(String columnName, InputStream stream, int count)
  1078. throws SQLException;
  1079. /**
  1080. * This method updates the specified column from a character stream.
  1081. * This does not update the actual database. <code>updateRow</code> must be
  1082. * called in order to do that.
  1083. *
  1084. * @param columnName The name of the column to update.
  1085. * @param reader The reader from which the column value is updated.
  1086. * @param count The length of the stream.
  1087. * @exception SQLException If an error occurs.
  1088. */
  1089. void updateCharacterStream(String columnName, Reader reader, int count)
  1090. throws SQLException;
  1091. /**
  1092. * This method updates the specified column to have an Object value.
  1093. * This does not update the actual database. <code>updateRow</code> must be
  1094. * called in order to do that.
  1095. *
  1096. * @param columnName The name of the column to update.
  1097. * @param value The new value of the column.
  1098. * @param scale The scale of the object in question, which is used only
  1099. * for numeric type objects.
  1100. * @exception SQLException If an error occurs.
  1101. */
  1102. void updateObject(String columnName, Object value, int scale)
  1103. throws SQLException;
  1104. /**
  1105. * This method updates the specified column to have an Object value.
  1106. * This does not update the actual database. <code>updateRow</code> must be
  1107. * called in order to do that.
  1108. *
  1109. * @param columnName The name of the column to update.
  1110. * @param value The new value of the column.
  1111. * @exception SQLException If an error occurs.
  1112. */
  1113. void updateObject(String columnName, Object value) throws SQLException;
  1114. /**
  1115. * This method inserts the current row into the database. The result set
  1116. * must be positioned on the insert row in order to call this method
  1117. * successfully.
  1118. *
  1119. * @exception SQLException If an error occurs.
  1120. */
  1121. void insertRow() throws SQLException;
  1122. /**
  1123. * This method updates the current row in the database.
  1124. *
  1125. * @exception SQLException If an error occurs.
  1126. */
  1127. void updateRow() throws SQLException;
  1128. /**
  1129. * This method deletes the current row in the database.
  1130. *
  1131. * @exception SQLException If an error occurs.
  1132. */
  1133. void deleteRow() throws SQLException;
  1134. /**
  1135. * This method refreshes the contents of the current row from the database.
  1136. *
  1137. * @exception SQLException If an error occurs.
  1138. */
  1139. void refreshRow() throws SQLException;
  1140. /**
  1141. * This method cancels any changes that have been made to a row. If
  1142. * the <code>rowUpdate</code> method has been called, then the changes
  1143. * cannot be undone.
  1144. *
  1145. * @exception SQLException If an error occurs.
  1146. */
  1147. void cancelRowUpdates() throws SQLException;
  1148. /**
  1149. * This method positions the result set to the "insert row", which allows
  1150. * a new row to be inserted into the database from the result set.
  1151. *
  1152. * @exception SQLException If an error occurs.
  1153. */
  1154. void moveToInsertRow() throws SQLException;
  1155. /**
  1156. * This method moves the result set position from the insert row back to
  1157. * the current row that was selected prior to moving to the insert row.
  1158. *
  1159. * @exception SQLException If an error occurs.
  1160. */
  1161. void moveToCurrentRow() throws SQLException;
  1162. /**
  1163. * This method returns a the <code>Statement</code> that was used to
  1164. * produce this result set.
  1165. *
  1166. * @return The <code>Statement</code> used to produce this result set.
  1167. *
  1168. * @exception SQLException If an error occurs.
  1169. */
  1170. Statement getStatement() throws SQLException;
  1171. /**
  1172. * This method returns the value of the specified column as a Java
  1173. * <code>Object</code> using the specified SQL type to Java type map.
  1174. *
  1175. * @param columnIndex The index of the column to return.
  1176. * @param map The SQL type to Java type map to use.
  1177. * @return The value of the column as an <code>Object</code>.
  1178. * @exception SQLException If an error occurs.
  1179. */
  1180. Object getObject(int columnIndex, Map<String, Class<?>> map)
  1181. throws SQLException;
  1182. /**
  1183. * This method returns a <code>Ref</code> for the specified column which
  1184. * represents the structured type for the column.
  1185. *
  1186. * @param columnIndex The index of the column to return.
  1187. * @return A <code>Ref</code> object for the column
  1188. * @exception SQLException If an error occurs.
  1189. */
  1190. Ref getRef(int columnIndex) throws SQLException;
  1191. /**
  1192. * This method returns the specified column value as a BLOB.
  1193. *
  1194. * @param columnIndex The index of the column value to return.
  1195. * @return The value of the column as a BLOB.
  1196. * @exception SQLException If an error occurs.
  1197. */
  1198. Blob getBlob(int columnIndex) throws SQLException;
  1199. /**
  1200. * This method returns the specified column value as a CLOB.
  1201. *
  1202. * @param columnIndex The index of the column value to return.
  1203. * @return The value of the column as a CLOB.
  1204. * @exception SQLException If an error occurs.
  1205. */
  1206. Clob getClob(int columnIndex) throws SQLException;
  1207. /**
  1208. * This method returns the specified column value as an <code>Array</code>.
  1209. *
  1210. * @param columnIndex The index of the column value to return.
  1211. * @return The value of the column as an <code>Array</code>.
  1212. * @exception SQLException If an error occurs.
  1213. */
  1214. Array getArray(int columnIndex) throws SQLException;
  1215. /**
  1216. * This method returns the value of the specified column as a Java
  1217. * <code>Object</code> using the specified SQL type to Java type map.
  1218. *
  1219. * @param columnName The name of the column to return.
  1220. * @param map The SQL type to Java type map to use.
  1221. * @return The value of the column as an <code>Object</code>.
  1222. * @exception SQLException If an error occurs.
  1223. */
  1224. Object getObject(String columnName, Map<String, Class<?>> map)
  1225. throws SQLException;
  1226. /**
  1227. * This method returns a <code>Ref</code> for the specified column which
  1228. * represents the structured type for the column.
  1229. *
  1230. * @param columnName The name of the column to return.
  1231. * @return A <code>Ref</code> object for the column
  1232. * @exception SQLException If an error occurs.
  1233. */
  1234. Ref getRef(String columnName) throws SQLException;
  1235. /**
  1236. * This method returns the specified column value as a BLOB.
  1237. *
  1238. * @param columnName The name of the column value to return.
  1239. * @return The value of the column as a BLOB.
  1240. * @exception SQLException If an error occurs.
  1241. */
  1242. Blob getBlob(String columnName) throws SQLException;
  1243. /**
  1244. * This method returns the specified column value as a CLOB.
  1245. *
  1246. * @param columnName The name of the column value to return.
  1247. * @return The value of the column as a CLOB.
  1248. * @exception SQLException If an error occurs.
  1249. */
  1250. Clob getClob(String columnName) throws SQLException;
  1251. /**
  1252. * This method returns the specified column value as an <code>Array</code>.
  1253. *
  1254. * @param co…

Large files files are truncated, but you can click here to view the full file