1 /* ResultSet.java -- A SQL statement result set.
2 Copyright (C) 1999, 2000 Free Software Foundation, Inc.
4 This file is part of GNU Classpath.
6 GNU Classpath is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2, or (at your option)
11 GNU Classpath is distributed in the hope that it will be useful, but
12 WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with GNU Classpath; see the file COPYING. If not, write to the
18 Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
21 As a special exception, if you link this library with other files to
22 produce an executable, this library does not by itself cause the
23 resulting executable to be covered by the GNU General Public License.
24 This exception does not however invalidate any other reasons why the
25 executable file might be covered by the GNU General Public License. */
30 import java.io.InputStream;
31 import java.io.Reader;
32 import java.math.BigDecimal;
33 import java.util.Calendar;
37 * This interface provides access to the data set returned by a SQL
38 * statement. An instance of this interface is returned by the various
39 * execution methods in the <code>Statement</code.
41 * This class models a cursor, which can be stepped through one row at a
42 * time. Methods are provided for accessing columns by column name or by
45 * Note that a result set is invalidated if the statement that returned
48 * @author Aaron M. Renn (arenn@urbanophile.com)
50 public interface ResultSet
54 * The rows will be processed in order from first to last.
56 public static final int FETCH_FORWARD = 0;
59 * The rows will be processed in order from last to first.
61 public static final int FETCH_REVERSE = 1;
64 * The rows will be processed in an unknown order
66 public static final int FETCH_UNKNOWN = 2;
69 * This type of result set may only step forward through the rows returned.
71 public static final int TYPE_FORWARD_ONLY = 0;
74 * This type of result set is scrollable and is not sensitive to changes
75 * made by other statements.
77 public static final int TYPE_SCROLL_INSENSITIVE = 1;
80 * This type of result set is scrollable and is also sensitive to changes
81 * made by other statements.
83 public static final int TYPE_SCROLL_SENSITIVE = 1;
86 * The concurrency mode of for the result set may not be modified.
88 public static final int CONCUR_READ_ONLY = 0;
91 * The concurrency mode of for the result set may be modified.
93 public static final int CONCUR_UPDATABLE = 1;
95 /*************************************************************************/
98 * This method advances to the next row in the result set. Any streams
99 * open on the current row are closed automatically.
101 * @return <code>true</code> if the next row exists, <code>false</code>
104 * @exception SQLException If an error occurs.
106 public abstract boolean
107 next() throws SQLException;
109 /*************************************************************************/
112 * This method moves the current position to the previous row in the
115 * @return <code>true</code> if the previous row exists, <code>false</code>
118 * @exception SQLException If an error occurs.
120 public abstract boolean
121 previous() throws SQLException;
123 /*************************************************************************/
126 * This method closes the result set and frees any associated resources.
128 * @exception SQLException If an error occurs.
131 close() throws SQLException;
133 /*************************************************************************/
136 * This method tests whether the value of the last column that was fetched
137 * was actually a SQL NULL value.
139 * @return <code>true</code> if the last column fetched was a NULL,
140 * <code>false</code> otherwise.
142 * @exception SQLException If an error occurs.
144 public abstract boolean
145 wasNull() throws SQLException;
147 /*************************************************************************/
150 * This method returns the value of the specified column as a Java
151 * <code>String</code>.
153 * @param index The index of the column to return.
155 * @return The column value as a <code>String</code>.
157 * @exception SQLException If an error occurs.
159 public abstract String
160 getString(int index) throws SQLException;
162 /*************************************************************************/
165 * This method returns the value of the specified column as a Java
166 * <code>Object</code>.
168 * @param index The index of the column to return.
170 * @return The column value as an <code>Object</code>.
172 * @exception SQLException If an error occurs.
174 public abstract Object
175 getObject(int index) throws SQLException;
177 /*************************************************************************/
180 * This method returns the value of the specified column as a Java
181 * <code>boolean</code>.
183 * @param index The index of the column to return.
185 * @return The column value as a <code>boolean</code>.
187 * @exception SQLException If an error occurs.
189 public abstract boolean
190 getBoolean(int index) throws SQLException;
192 /*************************************************************************/
195 * This method returns the value of the specified column as a Java
198 * @param index The index of the column to return.
200 * @return The column value as a <code>byte</code>.
202 * @exception SQLException If an error occurs.
205 getByte(int index) throws SQLException;
207 /*************************************************************************/
210 * This method returns the value of the specified column as a Java
211 * <code>short</code>.
213 * @param index The index of the column to return.
215 * @return The column value as a <code>short</code>.
217 * @exception SQLException If an error occurs.
219 public abstract short
220 getShort(int index) throws SQLException;
222 /*************************************************************************/
225 * This method returns the value of the specified column as a Java
228 * @param index The index of the column to return.
230 * @return The column value as a <code>int</code>.
232 * @exception SQLException If an error occurs.
235 getInt(int index) throws SQLException;
237 /*************************************************************************/
240 * This method returns the value of the specified column as a Java
243 * @param index The index of the column to return.
245 * @return The column value as a <code>long</code>.
247 * @exception SQLException If an error occurs.
250 getLong(int index) throws SQLException;
252 /*************************************************************************/
255 * This method returns the value of the specified column as a Java
256 * <code>float</code>.
258 * @param index The index of the column to return.
260 * @return The column value as a <code>float</code>.
262 * @exception SQLException If an error occurs.
264 public abstract float
265 getFloat(int index) throws SQLException;
267 /*************************************************************************/
270 * This method returns the value of the specified column as a Java
271 * <code>double</code>.
273 * @param index The index of the column to return.
275 * @return The column value as a <code>double</code>.
277 * @exception SQLException If an error occurs.
279 public abstract double
280 getDouble(int index) throws SQLException;
282 /*************************************************************************/
285 * This method returns the value of the specified column as a Java
286 * <code>BigDecimal</code>.
288 * @param index The index of the column to return.
290 * @return The column value as a <code>BigDecimal</code>.
292 * @exception SQLException If an error occurs.
294 public abstract BigDecimal
295 getBigDecimal(int index) throws SQLException;
297 /*************************************************************************/
300 * This method returns the value of the specified column as a Java
301 * <code>BigDecimal</code>.
303 * @param index The index of the column to return.
304 * @param scale The number of digits to the right of the decimal to return.
306 * @return The column value as a <code>BigDecimal</code>.
308 * @exception SQLException If an error occurs.
310 public abstract BigDecimal
311 getBigDecimal(int index, int scale) throws SQLException;
313 /*************************************************************************/
316 * This method returns the value of the specified column as a Java
319 * @param index The index of the column to return.
321 * @return The column value as a byte array
323 * @exception SQLException If an error occurs.
325 public abstract byte[]
326 getBytes(int index) throws SQLException;
328 /*************************************************************************/
331 * This method returns the value of the specified column as a Java
332 * <code>java.sql.Date</code>.
334 * @param index The index of the column to return.
336 * @return The column value as a <code>java.sql.Date</code>.
338 * @exception SQLException If an error occurs.
340 public abstract java.sql.Date
341 getDate(int index) throws SQLException;
343 /*************************************************************************/
346 * This method returns the value of the specified column as a Java
347 * <code>java.sql.Time</code>.
349 * @param index The index of the column to return.
351 * @return The column value as a <code>java.sql.Time</code>.
353 * @exception SQLException If an error occurs.
355 public abstract java.sql.Time
356 getTime(int index) throws SQLException;
358 /*************************************************************************/
361 * This method returns the value of the specified column as a Java
362 * <code>java.sql.Timestamp</code>.
364 * @param index The index of the column to return.
366 * @return The column value as a <code>java.sql.Timestamp</code>.
368 * @exception SQLException If an error occurs.
370 public abstract java.sql.Timestamp
371 getTimestamp(int index) throws SQLException;
373 /*************************************************************************/
376 * This method returns the value of the specified column as an ASCII
377 * stream. Note that all the data from this stream must be read before
378 * fetching the value of any other column. Please also be aware that
379 * calling <code>next()</code> or <code>close()</code> on this result set
380 * will close this stream as well.
382 * @param index The index of the column to return.
384 * @return The column value as an ASCII <code>InputStream</code>.
386 * @exception SQLException If an error occurs.
388 public abstract InputStream
389 getAsciiStream(int index) throws SQLException;
391 /*************************************************************************/
394 * This method returns the value of the specified column as a Unicode UTF-8
395 * stream. Note that all the data from this stream must be read before
396 * fetching the value of any other column. Please also be aware that
397 * calling <code>next()</code> or <code>close()</code> on this result set
398 * will close this stream as well.
400 * @param index The index of the column to return.
402 * @return The column value as a Unicode UTF-8 <code>InputStream</code>.
404 * @exception SQLException If an error occurs.
406 public abstract InputStream
407 getUnicodeStream(int index) throws SQLException;
409 /*************************************************************************/
412 * This method returns the value of the specified column as a raw byte
413 * stream. Note that all the data from this stream must be read before
414 * fetching the value of any other column. Please also be aware that
415 * calling <code>next()</code> or <code>close()</code> on this result set
416 * will close this stream as well.
418 * @param index The index of the column to return.
420 * @return The column value as a raw byte <code>InputStream</code>.
422 * @exception SQLException If an error occurs.
424 public abstract InputStream
425 getBinaryStream(int index) throws SQLException;
427 /*************************************************************************/
430 * This method returns the value of the specified column as a character
431 * stream. Note that all the data from this stream must be read before
432 * fetching the value of any other column. Please also be aware that
433 * calling <code>next()</code> or <code>close()</code> on this result set
434 * will close this stream as well.
436 * @param index The index of the column to return.
438 * @return The column value as an character <code>Reader</code>.
440 * @exception SQLException If an error occurs.
442 public abstract Reader
443 getCharacterStream(int index) throws SQLException;
445 /*************************************************************************/
448 * This method returns the value of the specified column as a Java
449 * <code>String</code>.
451 * @param column The name of the column to return.
453 * @return The column value as a <code>String</code>.
455 * @exception SQLException If an error occurs.
457 public abstract String
458 getString(String column) throws SQLException;
460 /*************************************************************************/
463 * This method returns the value of the specified column as a Java
464 * <code>Object</code>.
466 * @param column The name of the column to return.
468 * @return The column value as an <code>Object</code>.
470 * @exception SQLException If an error occurs.
472 public abstract Object
473 getObject(String column) throws SQLException;
475 /*************************************************************************/
478 * This method returns the value of the specified column as a Java
479 * <code>boolean</code>.
481 * @param column The name of the column to return.
483 * @return The column value as a <code>boolean</code>.
485 * @exception SQLException If an error occurs.
487 public abstract boolean
488 getBoolean(String column) throws SQLException;
490 /*************************************************************************/
493 * This method returns the value of the specified column as a Java
496 * @param column The name of the column to return.
498 * @return The column value as a <code>byte</code>.
500 * @exception SQLException If an error occurs.
503 getByte(String column) throws SQLException;
505 /*************************************************************************/
508 * This method returns the value of the specified column as a Java
509 * <code>short</code>.
511 * @param column The name of the column to return.
513 * @return The column value as a <code>short</code>.
515 * @exception SQLException If an error occurs.
517 public abstract short
518 getShort(String column) throws SQLException;
520 /*************************************************************************/
523 * This method returns the value of the specified column as a Java
526 * @param column The name of the column to return.
528 * @return The column value as a <code>int</code>.
530 * @exception SQLException If an error occurs.
533 getInt(String column) throws SQLException;
535 /*************************************************************************/
538 * This method returns the value of the specified column as a Java
541 * @param column The name of the column to return.
543 * @return The column value as a <code>long</code>.
545 * @exception SQLException If an error occurs.
548 getLong(String column) throws SQLException;
550 /*************************************************************************/
553 * This method returns the value of the specified column as a Java
554 * <code>float</code>.
556 * @param column The name of the column to return.
558 * @return The column value as a <code>float</code>.
560 * @exception SQLException If an error occurs.
562 public abstract float
563 getFloat(String column) throws SQLException;
565 /*************************************************************************/
568 * This method returns the value of the specified column as a Java
569 * <code>double</code>.
571 * @param column The name of the column to return.
573 * @return The column value as a <code>double</code>.
575 * @exception SQLException If an error occurs.
577 public abstract double
578 getDouble(String column) throws SQLException;
580 /*************************************************************************/
583 * This method returns the value of the specified column as a Java
584 * <code>BigDecimal</code>.
586 * @param column The name of the column to return.
588 * @return The column value as a <code>BigDecimal</code>.
590 * @exception SQLException If an error occurs.
592 public abstract BigDecimal
593 getBigDecimal(String column) throws SQLException;
595 /*************************************************************************/
598 * This method returns the value of the specified column as a Java
599 * <code>BigDecimal</code>.
601 * @param column The name of the column to return.
602 * @param scale The number of digits to the right of the decimal to return.
604 * @return The column value as a <code>BigDecimal</code>.
606 * @exception SQLException If an error occurs.
608 public abstract BigDecimal
609 getBigDecimal(String column, int scale) throws SQLException;
611 /*************************************************************************/
614 * This method returns the value of the specified column as a Java
617 * @param column The name of the column to return.
619 * @return The column value as a byte array
621 * @exception SQLException If an error occurs.
623 public abstract byte[]
624 getBytes(String column) throws SQLException;
626 /*************************************************************************/
629 * This method returns the value of the specified column as a Java
630 * <code>java.sql.Date</code>.
632 * @param column The name of the column to return.
634 * @return The column value as a <code>java.sql.Date</code>.
636 * @exception SQLException If an error occurs.
638 public abstract java.sql.Date
639 getDate(String column) throws SQLException;
641 /*************************************************************************/
644 * This method returns the value of the specified column as a Java
645 * <code>java.sql.Time</code>.
647 * @param column The name of the column to return.
649 * @return The column value as a <code>java.sql.Time</code>.
651 * @exception SQLException If an error occurs.
653 public abstract java.sql.Time
654 getTime(String column) throws SQLException;
656 /*************************************************************************/
659 * This method returns the value of the specified column as a Java
660 * <code>java.sql.Timestamp</code>.
662 * @param column The name of the column to return.
664 * @return The column value as a <code>java.sql.Timestamp</code>.
666 * @exception SQLException If an error occurs.
668 public abstract java.sql.Timestamp
669 getTimestamp(String column) throws SQLException;
671 /*************************************************************************/
674 * This method returns the value of the specified column as an ASCII
675 * stream. Note that all the data from this stream must be read before
676 * fetching the value of any other column. Please also be aware that
677 * calling <code>next()</code> or <code>close()</code> on this result set
678 * will close this stream as well.
680 * @param column The name of the column to return.
682 * @return The column value as an ASCII <code>InputStream</code>.
684 * @exception SQLException If an error occurs.
686 public abstract InputStream
687 getAsciiStream(String column) throws SQLException;
689 /*************************************************************************/
692 * This method returns the value of the specified column as a Unicode UTF-8
693 * stream. Note that all the data from this stream must be read before
694 * fetching the value of any other column. Please also be aware that
695 * calling <code>next()</code> or <code>close()</code> on this result set
696 * will close this stream as well.
698 * @param column The name of the column to return.
700 * @return The column value as a Unicode UTF-8 <code>InputStream</code>.
702 * @exception SQLException If an error occurs.
704 public abstract InputStream
705 getUnicodeStream(String column) throws SQLException;
707 /*************************************************************************/
710 * This method returns the value of the specified column as a raw byte
711 * stream. Note that all the data from this stream must be read before
712 * fetching the value of any other column. Please also be aware that
713 * calling <code>next()</code> or <code>close()</code> on this result set
714 * will close this stream as well.
716 * @param column The name of the column to return.
718 * @return The column value as a raw byte <code>InputStream</code>.
720 * @exception SQLException If an error occurs.
722 public abstract InputStream
723 getBinaryStream(String column) throws SQLException;
725 /*************************************************************************/
728 * This method returns the value of the specified column as a character
729 * stream. Note that all the data from this stream must be read before
730 * fetching the value of any other column. Please also be aware that
731 * calling <code>next()</code> or <code>close()</code> on this result set
732 * will close this stream as well.
734 * @param column The name of the column to return.
736 * @return The column value as an character <code>Reader</code>.
738 * @exception SQLException If an error occurs.
740 public abstract Reader
741 getCharacterStream(String column) throws SQLException;
743 /*************************************************************************/
746 * This method returns the first SQL warning associated with this result
747 * set. Any additional warnings will be chained to this one.
749 * @return The first SQLWarning for this result set, or <code>null</code> if
750 * there are no warnings.
752 * @exception SQLException If an error occurs.
754 public abstract SQLWarning
755 getWarnings() throws SQLException;
757 /*************************************************************************/
760 * This method clears all warnings associated with this result set.
762 * @exception SQLException If an error occurs.
765 clearWarnings() throws SQLException;
767 /*************************************************************************/
770 * This method returns the name of the database cursor used by this
773 * @return The name of the database cursor used by this result set.
775 * @exception SQLException If an error occurs.
777 public abstract String
778 getCursorName() throws SQLException;
780 /*************************************************************************/
783 * This method returns data about the columns returned as part of the
784 * result set as a <code>ResultSetMetaData</code> instance.
786 * @return The <code>ResultSetMetaData</code> instance for this result set.
788 * @exception SQLException If an error occurs.
790 public abstract ResultSetMetaData
791 getMetaData() throws SQLException;
793 /*************************************************************************/
796 * This method returns the column index of the specified named column.
798 * @param column The name of the column.
800 * @return The index of the column.
802 * @exception SQLException If an error occurs.
805 findColumn(String column) throws SQLException;
807 /*************************************************************************/
810 * This method tests whether or not the cursor is before the first row
813 * @return <code>true</code> if the cursor is positioned before the first
814 * row, <code>false</code> otherwise.
816 * @exception SQLException If an error occurs.
818 public abstract boolean
819 isBeforeFirst() throws SQLException;
821 /*************************************************************************/
824 * This method tests whether or not the cursor is after the last row
827 * @return <code>true</code> if the cursor is positioned after the last
828 * row, <code>false</code> otherwise.
830 * @exception SQLException If an error occurs.
832 public abstract boolean
833 isAfterLast() throws SQLException;
835 /*************************************************************************/
838 * This method tests whether or not the cursor is positioned on the first
839 * row in the result set.
841 * @return <code>true</code> if the cursor is positioned on the first
842 * row, <code>false</code> otherwise.
844 * @exception SQLException If an error occurs.
846 public abstract boolean
847 isFirst() throws SQLException;
849 /*************************************************************************/
852 * This method tests whether or not the cursor is on the last row
855 * @return <code>true</code> if the cursor is positioned on the last
856 * row, <code>false</code> otherwise.
858 * @exception SQLException If an error occurs.
860 public abstract boolean
861 isLast() throws SQLException;
863 /*************************************************************************/
866 * This method repositions the cursor to before the first row in the
869 * @exception SQLException If an error occurs.
872 beforeFirst() throws SQLException;
874 /*************************************************************************/
877 * This method repositions the cursor to after the last row in the result
880 * @exception SQLException If an error occurs.
883 afterLast() throws SQLException;
885 /*************************************************************************/
888 * This method repositions the cursor on the first row in the
891 * @return <code>true</code> if the cursor is on a valid row;
892 * <code>false</code> if there are no rows in the result set.
894 * @exception SQLException If an error occurs.
896 public abstract boolean
897 first() throws SQLException;
899 /*************************************************************************/
902 * This method repositions the cursor on the last row in the result
905 * @return <code>true</code> if the cursor is on a valid row;
906 * <code>false</code> if there are no rows in the result set.
908 * @exception SQLException If an error occurs.
910 public abstract boolean
911 last() throws SQLException;
913 /*************************************************************************/
916 * This method returns the current row number in the cursor. Numbering
919 * @return The current row number, or 0 if there is not current row.
921 * @exception SQLException If an error occurs.
924 getRow() throws SQLException;
926 /*************************************************************************/
929 * This method positions the result set to the specified absolute row.
930 * Positive numbers are row offsets from the beginning of the result
931 * set (numbering starts from row 1) and negative numbers are row offsets
932 * from the end of the result set (numbering starts from -1).
934 * @param row The row to position the result set to.
936 * @return <code>true</code> if the current position was changed,
937 * <code>false</code> otherwise.
939 * @exception SQLException If an error occurs.
941 public abstract boolean
942 absolute(int row) throws SQLException;
944 /*************************************************************************/
947 * This method moves the result set position relative to the current row.
948 * The offset can be positive or negative.
950 * @param row The relative row position to move to.
952 * @return <code>true</code> if the current position was changed,
953 * <code>false</code> otherwise.
955 * @exception SQLException If an error occurs.
957 public abstract boolean
958 relative(int row) throws SQLException;
960 /*************************************************************************/
963 * This method provides a hint to the driver about which direction the
964 * result set will be processed in.
966 * @param direction The direction in which rows will be processed. (Values?)
968 * @exception SQLException If an error occurs.
971 setFetchDirection(int direction) throws SQLException;
973 /*************************************************************************/
976 * This method returns the current fetch direction for this result set.
978 * @return The fetch direction for this result set.
980 * @exception SQLException If an error occurs.
983 getFetchDirection() throws SQLException;
985 /*************************************************************************/
988 * This method provides a hint to the driver about how many rows at a
989 * time it should fetch from the database.
991 * @param rows The number of rows the driver should fetch per call.
993 * @exception SQLException If an error occurs.
996 setFetchSize(int rows) throws SQLException;
998 /*************************************************************************/
1001 * This method returns the current number of rows that will be fetched
1002 * from the database at a time.
1004 * @return The current fetch size for this result set.
1006 * @exception SQLException If an error occurs.
1009 getFetchSize() throws SQLException;
1011 /*************************************************************************/
1014 * This method returns the result set type of this result set. This will
1015 * be one of the TYPE_* constants defined in this interface.
1017 * @return The result set type.
1019 * @exception SQLException If an error occurs.
1022 getType() throws SQLException;
1024 /*************************************************************************/
1027 * This method returns the concurrency type of this result set. This will
1028 * be one of the CONCUR_* constants defined in this interface.
1030 * @return The result set concurrency type.
1032 * @exception SQLException If an error occurs.
1035 getConcurrency() throws SQLException;
1037 /*************************************************************************/
1040 * This method tests whether or not the current row in the result set
1041 * has been updated. Updates must be visible in order of this method to
1042 * detect the update.
1044 * @return <code>true</code> if the row has been updated, <code>false</code>
1047 * @exception SQLException If an error occurs.
1049 public abstract boolean
1050 rowUpdated() throws SQLException;
1052 /*************************************************************************/
1055 * This method tests whether or not the current row in the result set
1056 * has been inserted. Inserts must be visible in order of this method to
1057 * detect the insert.
1059 * @return <code>true</code> if the row has been inserted, <code>false</code>
1062 * @exception SQLException If an error occurs.
1064 public abstract boolean
1065 rowInserted() throws SQLException;
1067 /*************************************************************************/
1070 * This method tests whether or not the current row in the result set
1071 * has been deleted. Deletes must be visible in order of this method to
1072 * detect the deletion.
1074 * @return <code>true</code> if the row has been deleted, <code>false</code>
1077 * @exception SQLException If an error occurs.
1079 public abstract boolean
1080 rowDeleted() throws SQLException;
1082 /*************************************************************************/
1085 * This method updates the specified column to have a NULL value. This
1086 * does not update the actual database. <code>updateRow</code> must be
1087 * called in order to do that.
1089 * @return index The index of the column to update.
1091 * @exception SQLException If an error occurs.
1093 public abstract void
1094 updateNull(int index) throws SQLException;
1096 /*************************************************************************/
1099 * This method updates the specified column to have a boolean value. This
1100 * does not update the actual database. <code>updateRow</code> must be
1101 * called in order to do that.
1103 * @param index The index of the column to update.
1104 * @param value The new value of the column.
1106 * @exception SQLException If an error occurs.
1108 public abstract void
1109 updateBoolean(int index, boolean value) throws SQLException;
1111 /*************************************************************************/
1114 * This method updates the specified column to have a byte value. This
1115 * does not update the actual database. <code>updateRow</code> must be
1116 * called in order to do that.
1118 * @param index The index of the column to update.
1119 * @param value The new value of the column.
1121 * @exception SQLException If an error occurs.
1123 public abstract void
1124 updateByte(int index, byte value) throws SQLException;
1126 /*************************************************************************/
1129 * This method updates the specified column to have a short value. This
1130 * does not update the actual database. <code>updateRow</code> must be
1131 * called in order to do that.
1133 * @param index The index of the column to update.
1134 * @param value The new value of the column.
1136 * @exception SQLException If an error occurs.
1138 public abstract void
1139 updateShort(int index, short value) throws SQLException;
1141 /*************************************************************************/
1144 * This method updates the specified column to have an int value. This
1145 * does not update the actual database. <code>updateRow</code> must be
1146 * called in order to do that.
1148 * @param index The index of the column to update.
1149 * @param value The new value of the column.
1151 * @exception SQLException If an error occurs.
1153 public abstract void
1154 updateInt(int index, int value) throws SQLException;
1156 /*************************************************************************/
1159 * This method updates the specified column to have a long value. This
1160 * does not update the actual database. <code>updateRow</code> must be
1161 * called in order to do that.
1163 * @param index The index of the column to update.
1164 * @param value The new value of the column.
1166 * @exception SQLException If an error occurs.
1168 public abstract void
1169 updateLong(int index, long value) throws SQLException;
1171 /*************************************************************************/
1174 * This method updates the specified column to have a float value. This
1175 * does not update the actual database. <code>updateRow</code> must be
1176 * called in order to do that.
1178 * @param index The index of the column to update.
1179 * @param value The new value of the column.
1181 * @exception SQLException If an error occurs.
1183 public abstract void
1184 updateFloat(int index, float value) throws SQLException;
1186 /*************************************************************************/
1189 * This method updates the specified column to have a double value. This
1190 * does not update the actual database. <code>updateRow</code> must be
1191 * called in order to do that.
1193 * @param index The index of the column to update.
1194 * @param value The new value of the column.
1196 * @exception SQLException If an error occurs.
1198 public abstract void
1199 updateDouble(int index, double value) throws SQLException;
1201 /*************************************************************************/
1204 * This method updates the specified column to have a BigDecimal value. This
1205 * does not update the actual database. <code>updateRow</code> must be
1206 * called in order to do that.
1208 * @param index The index of the column to update.
1209 * @param value The new value of the column.
1211 * @exception SQLException If an error occurs.
1213 public abstract void
1214 updateBigDecimal(int index, BigDecimal value) throws SQLException;
1216 /*************************************************************************/
1219 * This method updates the specified column to have a String value. This
1220 * does not update the actual database. <code>updateRow</code> must be
1221 * called in order to do that.
1223 * @param index The index of the column to update.
1224 * @param value The new value of the column.
1226 * @exception SQLException If an error occurs.
1228 public abstract void
1229 updateString(int index, String value) throws SQLException;
1231 /*************************************************************************/
1234 * This method updates the specified column to have a byte array value. This
1235 * does not update the actual database. <code>updateRow</code> must be
1236 * called in order to do that.
1238 * @param index The index of the column to update.
1239 * @param value The new value of the column.
1241 * @exception SQLException If an error occurs.
1243 public abstract void
1244 updateBytes(int index, byte[] value) throws SQLException;
1246 /*************************************************************************/
1249 * This method updates the specified column to have a java.sql.Date value. This
1250 * does not update the actual database. <code>updateRow</code> must be
1251 * called in order to do that.
1253 * @param index The index of the column to update.
1254 * @param value The new value of the column.
1256 * @exception SQLException If an error occurs.
1258 public abstract void
1259 updateDate(int index, java.sql.Date value) throws SQLException;
1261 /*************************************************************************/
1264 * This method updates the specified column to have a java.sql.Time value. This
1265 * does not update the actual database. <code>updateRow</code> must be
1266 * called in order to do that.
1268 * @param index The index of the column to update.
1269 * @param value The new value of the column.
1271 * @exception SQLException If an error occurs.
1273 public abstract void
1274 updateTime(int index, java.sql.Time value) throws SQLException;
1276 /*************************************************************************/
1279 * This method updates the specified column to have a java.sql.Timestamp value.
1280 * This does not update the actual database. <code>updateRow</code> must be
1281 * called in order to do that.
1283 * @param index The index of the column to update.
1284 * @param value The new value of the column.
1286 * @exception SQLException If an error occurs.
1288 public abstract void
1289 updateTimestamp(int index, java.sql.Timestamp value) throws SQLException;
1291 /*************************************************************************/
1294 * This method updates the specified column from an ASCII text stream.
1295 * This does not update the actual database. <code>updateRow</code> must be
1296 * called in order to do that.
1298 * @param index The index of the column to update.
1299 * @param value The new value of the column.
1300 * @param length The length of the stream.
1302 * @exception SQLException If an error occurs.
1304 public abstract void
1305 updateAsciiStream(int index, InputStream value, int length) throws SQLException;
1307 /*************************************************************************/
1310 * This method updates the specified column from a binary stream.
1311 * This does not update the actual database. <code>updateRow</code> must be
1312 * called in order to do that.
1314 * @param index The index of the column to update.
1315 * @param value The new value of the column.
1316 * @param length The length of the stream.
1318 * @exception SQLException If an error occurs.
1320 public abstract void
1321 updateBinaryStream(int index, InputStream value, int length)
1322 throws SQLException;
1324 /*************************************************************************/
1327 * This method updates the specified column from a character stream.
1328 * This does not update the actual database. <code>updateRow</code> must be
1329 * called in order to do that.
1331 * @param index The index of the column to update.
1332 * @param value The new value of the column.
1333 * @param length The length of the stream.
1335 * @exception SQLException If an error occurs.
1337 public abstract void
1338 updateCharacterStream(int index, Reader value, int length) throws SQLException;
1340 /*************************************************************************/
1343 * This method updates the specified column to have an Object value.
1344 * This does not update the actual database. <code>updateRow</code> must be
1345 * called in order to do that.
1347 * @param index The index of the column to update.
1348 * @param value The new value of the column.
1350 * @exception SQLException If an error occurs.
1352 public abstract void
1353 updateObject(int index, Object value) throws SQLException;
1355 /*************************************************************************/
1358 * This method updates the specified column to have an Object value.
1359 * This does not update the actual database. <code>updateRow</code> must be
1360 * called in order to do that.
1362 * @param index The index of the column to update.
1363 * @param value The new value of the column.
1364 * @param scale The scale of the object in question, which is used only
1365 * for numeric type objects.
1367 * @exception SQLException If an error occurs.
1369 public abstract void
1370 updateObject(int index, Object value, int scale) throws SQLException;
1372 /*************************************************************************/
1375 * This method updates the specified column to have a NULL value. This
1376 * does not update the actual database. <code>updateRow</code> must be
1377 * called in order to do that.
1379 * @return name The name of the column to update.
1381 * @exception SQLException If an error occurs.
1383 public abstract void
1384 updateNull(String name) throws SQLException;
1386 /*************************************************************************/
1389 * This method updates the specified column to have a boolean value. This
1390 * does not update the actual database. <code>updateRow</code> must be
1391 * called in order to do that.
1393 * @param name The name of the column to update.
1394 * @param value The new value of the column.
1396 * @exception SQLException If an error occurs.
1398 public abstract void
1399 updateBoolean(String name, boolean value) throws SQLException;
1401 /*************************************************************************/
1404 * This method updates the specified column to have a byte value. This
1405 * does not update the actual database. <code>updateRow</code> must be
1406 * called in order to do that.
1408 * @param name The name of the column to update.
1409 * @param value The new value of the column.
1411 * @exception SQLException If an error occurs.
1413 public abstract void
1414 updateByte(String name, byte value) throws SQLException;
1416 /*************************************************************************/
1419 * This method updates the specified column to have a short value. This
1420 * does not update the actual database. <code>updateRow</code> must be
1421 * called in order to do that.
1423 * @param name The name of the column to update.
1424 * @param value The new value of the column.
1426 * @exception SQLException If an error occurs.
1428 public abstract void
1429 updateShort(String name, short value) throws SQLException;
1431 /*************************************************************************/
1434 * This method updates the specified column to have an int value. This
1435 * does not update the actual database. <code>updateRow</code> must be
1436 * called in order to do that.
1438 * @param name The name of the column to update.
1439 * @param value The new value of the column.
1441 * @exception SQLException If an error occurs.
1443 public abstract void
1444 updateInt(String name, int value) throws SQLException;
1446 /*************************************************************************/
1449 * This method updates the specified column to have a long value. This
1450 * does not update the actual database. <code>updateRow</code> must be
1451 * called in order to do that.
1453 * @param name The name of the column to update.
1454 * @param value The new value of the column.
1456 * @exception SQLException If an error occurs.
1458 public abstract void
1459 updateLong(String name, long value) throws SQLException;
1461 /*************************************************************************/
1464 * This method updates the specified column to have a float value. This
1465 * does not update the actual database. <code>updateRow</code> must be
1466 * called in order to do that.
1468 * @param name The name of the column to update.
1469 * @param value The new value of the column.
1471 * @exception SQLException If an error occurs.
1473 public abstract void
1474 updateFloat(String name, float value) throws SQLException;
1476 /*************************************************************************/
1479 * This method updates the specified column to have a double value. This
1480 * does not update the actual database. <code>updateRow</code> must be
1481 * called in order to do that.
1483 * @param name The name of the column to update.
1484 * @param value The new value of the column.
1486 * @exception SQLException If an error occurs.
1488 public abstract void
1489 updateDouble(String name, double value) throws SQLException;
1491 /*************************************************************************/
1494 * This method updates the specified column to have a BigDecimal value. This
1495 * does not update the actual database. <code>updateRow</code> must be
1496 * called in order to do that.
1498 * @param name The name of the column to update.
1499 * @param value The new value of the column.
1501 * @exception SQLException If an error occurs.
1503 public abstract void
1504 updateBigDecimal(String name, BigDecimal value) throws SQLException;
1506 /*************************************************************************/
1509 * This method updates the specified column to have a String value. This
1510 * does not update the actual database. <code>updateRow</code> must be
1511 * called in order to do that.
1513 * @param name The name of the column to update.
1514 * @param value The new value of the column.
1516 * @exception SQLException If an error occurs.
1518 public abstract void
1519 updateString(String name, String value) throws SQLException;
1521 /*************************************************************************/
1524 * This method updates the specified column to have a byte array value. This
1525 * does not update the actual database. <code>updateRow</code> must be
1526 * called in order to do that.
1528 * @param name The name of the column to update.
1529 * @param value The new value of the column.
1531 * @exception SQLException If an error occurs.
1533 public abstract void
1534 updateBytes(String name, byte[] value) throws SQLException;
1536 /*************************************************************************/
1539 * This method updates the specified column to have a java.sql.Date value. This
1540 * does not update the actual database. <code>updateRow</code> must be
1541 * called in order to do that.
1543 * @param name The name of the column to update.
1544 * @param value The new value of the column.
1546 * @exception SQLException If an error occurs.
1548 public abstract void
1549 updateDate(String name, java.sql.Date value) throws SQLException;
1551 /*************************************************************************/
1554 * This method updates the specified column to have a java.sql.Time value. This
1555 * does not update the actual database. <code>updateRow</code> must be
1556 * called in order to do that.
1558 * @param name The name of the column to update.
1559 * @param value The new value of the column.
1561 * @exception SQLException If an error occurs.
1563 public abstract void
1564 updateTime(String name, java.sql.Time value) throws SQLException;
1566 /*************************************************************************/
1569 * This method updates the specified column to have a java.sql.Timestamp value.
1570 * This does not update the actual database. <code>updateRow</code> must be
1571 * called in order to do that.
1573 * @param name The name of the column to update.
1574 * @param value The new value of the column.
1576 * @exception SQLException If an error occurs.
1578 public abstract void
1579 updateTimestamp(String name, java.sql.Timestamp value) throws SQLException;
1581 /*************************************************************************/
1584 * This method updates the specified column from an ASCII text stream.
1585 * This does not update the actual database. <code>updateRow</code> must be
1586 * called in order to do that.
1588 * @param name The name of the column to update.
1589 * @param value The new value of the column.
1590 * @param length The length of the stream.
1592 * @exception SQLException If an error occurs.
1594 public abstract void
1595 updateAsciiStream(String name, InputStream value, int length) throws SQLException;
1597 /*************************************************************************/
1600 * This method updates the specified column from a binary stream.
1601 * This does not update the actual database. <code>updateRow</code> must be
1602 * called in order to do that.
1604 * @param name The name of the column to update.
1605 * @param value The new value of the column.
1606 * @param length The length of the stream.
1608 * @exception SQLException If an error occurs.
1610 public abstract void
1611 updateBinaryStream(String name, InputStream value, int length)
1612 throws SQLException;
1614 /*************************************************************************/
1617 * This method updates the specified column from a character stream.
1618 * This does not update the actual database. <code>updateRow</code> must be
1619 * called in order to do that.
1621 * @param name The name of the column to update.
1622 * @param value The new value of the column.
1623 * @param length The length of the stream.
1625 * @exception SQLException If an error occurs.
1627 public abstract void
1628 updateCharacterStream(String name, Reader value, int length) throws SQLException;
1630 /*************************************************************************/
1633 * This method updates the specified column to have an Object value.
1634 * This does not update the actual database. <code>updateRow</code> must be
1635 * called in order to do that.
1637 * @param name The name of the column to update.
1638 * @param value The new value of the column.
1640 * @exception SQLException If an error occurs.
1642 public abstract void
1643 updateObject(String name, Object value) throws SQLException;
1645 /*************************************************************************/
1648 * This method updates the specified column to have an Object value.
1649 * This does not update the actual database. <code>updateRow</code> must be
1650 * called in order to do that.
1652 * @param name The name of the column to update.
1653 * @param value The new value of the column.
1654 * @param scale The scale of the object in question, which is used only
1655 * for numeric type objects.
1657 * @exception SQLException If an error occurs.
1659 public abstract void
1660 updateObject(String name, Object value, int scale) throws SQLException;
1662 /*************************************************************************/
1665 * This method inserts the current row into the database. The result set
1666 * must be positioned on the insert row in order to call this method
1669 * @exception SQLException If an error occurs.
1671 public abstract void
1672 insertRow() throws SQLException;
1674 /*************************************************************************/
1677 * This method updates the current row in the database.
1679 * @exception SQLException If an error occurs.
1681 public abstract void
1682 updateRow() throws SQLException;
1684 /*************************************************************************/
1687 * This method deletes the current row in the database.
1689 * @exception SQLException If an error occurs.
1691 public abstract void
1692 deleteRow() throws SQLException;
1694 /*************************************************************************/
1697 * This method refreshes the contents of the current row from the database.
1699 * @exception SQLException If an error occurs.
1701 public abstract void
1702 refreshRow() throws SQLException;
1704 /*************************************************************************/
1707 * This method cancels any changes that have been made to a row. If
1708 * the <code>rowUpdate</code> method has been called, then the changes
1711 * @exception SQLException If an error occurs.
1713 public abstract void
1714 cancelRowUpdates() throws SQLException;
1716 /*************************************************************************/
1719 * This method positions the result set to the "insert row", which allows
1720 * a new row to be inserted into the database from the result set.
1722 * @exception SQLException If an error occurs.
1724 public abstract void
1725 moveToInsertRow() throws SQLException;
1727 /*************************************************************************/
1730 * This method moves the result set position from the insert row back to
1731 * the current row that was selected prior to moving to the insert row.
1733 * @exception SQLException If an error occurs.
1735 public abstract void
1736 moveToCurrentRow() throws SQLException;
1738 /*************************************************************************/
1741 * This method returns a the <code>Statement</code> that was used to
1742 * produce this result set.
1744 * @return The <code>Statement</code> used to produce this result set.
1746 * @exception SQLException If an error occurs.
1748 public abstract Statement
1749 getStatement() throws SQLException;
1751 /*************************************************************************/
1754 * This method returns the value of the specified column as a Java
1755 * <code>Object</code> using the specified SQL type to Java type map.
1757 * @param index The index of the column to return.
1758 * @param map The SQL type to Java type map to use.
1760 * @return The value of the column as an <code>Object</code>.
1762 * @exception SQLException If an error occurs.
1764 public abstract Object
1765 getObject(int index, Map map) throws SQLException;
1767 /*************************************************************************/
1770 * This method returns a <code>Ref</code> for the specified column which
1771 * represents the structured type for the column.
1773 * @param index The index of the column to return.
1775 * @return A <code>Ref</code> object for the column
1777 * @exception SQLException If an error occurs.
1780 getRef(int index) throws SQLException;
1782 /*************************************************************************/
1785 * This method returns the specified column value as a BLOB.
1787 * @param index The index of the column value to return.
1789 * @return The value of the column as a BLOB.
1791 * @exception SQLException If an error occurs.
1793 public abstract Blob
1794 getBlob(int index) throws SQLException;
1796 /*************************************************************************/
1799 * This method returns the specified column value as a CLOB.
1801 * @param index The index of the column value to return.
1803 * @return The value of the column as a CLOB.
1805 * @exception SQLException If an error occurs.
1807 public abstract Clob
1808 getClob(int index) throws SQLException;
1810 /*************************************************************************/
1813 * This method returns the specified column value as an <code>Array</code>.
1815 * @param index The index of the column value to return.
1817 * @return The value of the column as an <code>Array</code>.
1819 * @exception SQLException If an error occurs.
1821 public abstract Array
1822 getArray(int index) throws SQLException;
1824 /*************************************************************************/
1827 * This method returns the value of the specified column as a Java
1828 * <code>Object</code> using the specified SQL type to Java type map.
1830 * @param name The name of the column to return.
1831 * @param map The SQL type to Java type map to use.
1833 * @return The value of the column as an <code>Object</code>.
1835 * @exception SQLException If an error occurs.
1837 public abstract Object
1838 getObject(String name, Map map) throws SQLException;
1840 /*************************************************************************/
1843 * This method returns a <code>Ref</code> for the specified column which
1844 * represents the structured type for the column.
1846 * @param index The index of the column to return.
1848 * @return A <code>Ref</code> object for the column
1850 * @exception SQLException If an error occurs.
1853 getRef(String name) throws SQLException;
1855 /*************************************************************************/
1858 * This method returns the specified column value as a BLOB.
1860 * @param name The name of the column value to return.
1862 * @return The value of the column as a BLOB.
1864 * @exception SQLException If an error occurs.
1866 public abstract Blob
1867 getBlob(String name) throws SQLException;
1869 /*************************************************************************/
1872 * This method returns the specified column value as a CLOB.
1874 * @param name The name of the column value to return.
1876 * @return The value of the column as a CLOB.
1878 * @exception SQLException If an error occurs.
1880 public abstract Clob
1881 getClob(String name) throws SQLException;
1883 /*************************************************************************/
1886 * This method returns the specified column value as an <code>Array</code>.
1888 * @param name The name of the column value to return.
1890 * @return The value of the column as an <code>Array</code>.
1892 * @exception SQLException If an error occurs.
1894 public abstract Array
1895 getArray(String name) throws SQLException;
1897 /*************************************************************************/
1900 * This method returns the specified column value as a
1901 * <code>java.sql.Date</code>. The specified <code>Calendar</code> is used
1902 * to generate a value for the date if the database does not support
1905 * @param index The index of the column value to return.
1906 * @param cal The <code>Calendar</code> to use for calculating timezones.
1908 * @return The value of the column as a <code>java.sql.Date</code>.
1910 * @exception SQLException If an error occurs.
1912 public abstract java.sql.Date
1913 getDate(int index, Calendar cal) throws SQLException;
1915 /*************************************************************************/
1918 * This method returns the specified column value as a
1919 * <code>java.sql.Time</code>. The specified <code>Calendar</code> is used
1920 * to generate a value for the time if the database does not support
1923 * @param index The index of the column value to return.
1924 * @param cal The <code>Calendar</code> to use for calculating timezones.
1926 * @return The value of the column as a <code>java.sql.Time</code>.
1928 * @exception SQLException If an error occurs.
1930 public abstract java.sql.Time
1931 getTime(int index, Calendar cal) throws SQLException;
1933 /*************************************************************************/
1936 * This method returns the specified column value as a
1937 * <code>java.sql.Timestamp</code>. The specified <code>Calendar</code> is used
1938 * to generate a value for the timestamp if the database does not support
1941 * @param index The index of the column value to return.
1942 * @param cal The <code>Calendar</code> to use for calculating timezones.
1944 * @return The value of the column as a <code>java.sql.Timestamp</code>.
1946 * @exception SQLException If an error occurs.
1948 public abstract java.sql.Timestamp
1949 getTimestamp(int index, Calendar cal) throws SQLException;
1951 /*************************************************************************/
1954 * This method returns the specified column value as a
1955 * <code>java.sql.Date</code>. The specified <code>Calendar</code> is used
1956 * to generate a value for the date if the database does not support
1959 * @param name The name of the column value to return.
1960 * @param cal The <code>Calendar</code> to use for calculating timezones.
1962 * @return The value of the column as a <code>java.sql.Date</code>.
1964 * @exception SQLException If an error occurs.
1966 public abstract java.sql.Date
1967 getDate(String name, Calendar cal) throws SQLException;
1969 /*************************************************************************/
1972 * This method returns the specified column value as a
1973 * <code>java.sql.Time</code>. The specified <code>Calendar</code> is used
1974 * to generate a value for the time if the database does not support
1977 * @param name The name of the column value to return.
1978 * @param cal The <code>Calendar</code> to use for calculating timezones.
1980 * @return The value of the column as a <code>java.sql.Time</code>.
1982 * @exception SQLException If an error occurs.
1984 public abstract java.sql.Time
1985 getTime(String name, Calendar cal) throws SQLException;
1987 /*************************************************************************/
1990 * This method returns the specified column value as a
1991 * <code>java.sql.Timestamp</code>. The specified <code>Calendar</code> is used
1992 * to generate a value for the timestamp if the database does not support
1995 * @param name The name of the column value to return.
1996 * @param cal The <code>Calendar</code> to use for calculating timezones.
1998 * @return The value of the column as a <code>java.sql.Timestamp</code>.
2000 * @exception SQLException If an error occurs.
2002 public abstract java.sql.Timestamp
2003 getTimestamp(String name, Calendar cal) throws SQLException;
2005 } // interface ResultSet