001 /*
002 $Id: GroovyResultSet.java,v 1.5 2004/03/26 18:54:09 jstrachan Exp $
003
004 Copyright 2003 (C) James Strachan and Bob Mcwhirter. All Rights Reserved.
005
006 Redistribution and use of this software and associated documentation
007 ("Software"), with or without modification, are permitted provided
008 that the following conditions are met:
009
010 1. Redistributions of source code must retain copyright
011 statements and notices. Redistributions must also contain a
012 copy of this document.
013
014 2. Redistributions in binary form must reproduce the
015 above copyright notice, this list of conditions and the
016 following disclaimer in the documentation and/or other
017 materials provided with the distribution.
018
019 3. The name "groovy" must not be used to endorse or promote
020 products derived from this Software without prior written
021 permission of The Codehaus. For written permission,
022 please contact info@codehaus.org.
023
024 4. Products derived from this Software may not be called "groovy"
025 nor may "groovy" appear in their names without prior written
026 permission of The Codehaus. "groovy" is a registered
027 trademark of The Codehaus.
028
029 5. Due credit should be given to The Codehaus -
030 http://groovy.codehaus.org/
031
032 THIS SOFTWARE IS PROVIDED BY THE CODEHAUS AND CONTRIBUTORS
033 ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT
034 NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
035 FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
036 THE CODEHAUS OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
037 INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
038 (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
039 SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
040 HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
041 STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
042 ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
043 OF THE POSSIBILITY OF SUCH DAMAGE.
044
045 */
046 package groovy.sql;
047
048 import groovy.lang.GroovyObjectSupport;
049 import groovy.lang.MissingPropertyException;
050
051 import java.math.BigDecimal;
052 import java.sql.Array;
053 import java.sql.Blob;
054 import java.sql.Clob;
055 import java.sql.Ref;
056 import java.sql.ResultSet;
057 import java.sql.ResultSetMetaData;
058 import java.sql.SQLException;
059 import java.sql.SQLWarning;
060 import java.sql.Statement;
061 import java.util.Calendar;
062 import java.util.Iterator;
063 import java.util.Map;
064
065 /**
066 * Represents an extent of objects
067 *
068 * @Author Chris Stevenson
069 * @author <a href="mailto:james@coredevelopers.net">James Strachan</a>
070 * @author <a href="mailto:ivan_ganza@yahoo.com">Ivan Ganza</a>
071 * @version $Revision: 1.5 $
072 */
073 public class GroovyResultSet extends GroovyObjectSupport implements ResultSet {
074
075 private ResultSet resultSet;
076 private boolean updated;
077
078 public GroovyResultSet(ResultSet resultSet) {
079 this.resultSet = resultSet;
080 }
081
082 public Object getProperty(String property) {
083 try {
084 return resultSet.getObject(property);
085 }
086 catch (SQLException e) {
087 throw new MissingPropertyException(property, GroovyResultSet.class, e);
088 }
089 }
090
091 public void setProperty(String property, Object newValue) {
092 try {
093 resultSet.updateObject(property, newValue);
094 updated = true;
095 }
096 catch (SQLException e) {
097 throw new MissingPropertyException(property, GroovyResultSet.class, e);
098 }
099 }
100
101 /**
102 * Supports integer based subscript operators for accessing at numbered columns
103 * starting at zero. Negative indices are supported, they will count from the last column backwards.
104 *
105 * @param index is the number of the column to look at starting at 1
106 * @return
107 */
108 public Object getAt(int index) throws SQLException {
109 index = normalizeIndex(index);
110 return resultSet.getObject(index);
111 }
112
113 /**
114 * Supports integer based subscript operators for updating the values of numbered columns
115 * starting at zero. Negative indices are supported, they will count from the last column backwards.
116 *
117 * @param index is the number of the column to look at starting at 1
118 * @return
119 */
120 public void putAt(int index, Object newValue) throws SQLException {
121 index = normalizeIndex(index);
122 resultSet.updateObject(index, newValue);
123 }
124
125 /**
126 * Adds a new row to this result set
127 * @param values
128 */
129 public void add(Map values) throws SQLException {
130 resultSet.moveToInsertRow();
131 for (Iterator iter = values.entrySet().iterator(); iter.hasNext();) {
132 Map.Entry entry = (Map.Entry) iter.next();
133 resultSet.updateObject(entry.getKey().toString(), entry.getValue());
134 }
135 resultSet.insertRow();
136 }
137
138 /**
139 * Takes a zero based index and convert it into an SQL based 1 based index.
140 * A negative index will count backwards from the last column.
141 *
142 * @param index
143 * @return a JDBC index
144 * @throws SQLException if some exception occurs finding out the column count
145 */
146 protected int normalizeIndex(int index) throws SQLException {
147 if (index < 0) {
148 int columnCount = resultSet.getMetaData().getColumnCount();
149 do {
150 index += columnCount;
151 }
152 while (index < 0);
153 }
154 return index + 1;
155 }
156
157 // Implementation of java.sql.ResultSet
158 // ------------------------------------------------------------
159
160 /**
161 * Moves the cursor down one row from its current position.
162 * A <code>ResultSet</code> cursor is initially positioned
163 * before the first row; the first call to the method
164 * <code>next</code> makes the first row the current row; the
165 * second call makes the second row the current row, and so on.
166 *
167 * <P>If an input stream is open for the current row, a call
168 * to the method <code>next</code> will
169 * implicitly close it. A <code>ResultSet</code> object's
170 * warning chain is cleared when a new row is read.
171 *
172 * @return <code>true</code> if the new current row is valid;
173 * <code>false</code> if there are no more rows
174 * @exception SQLException if a database access error occurs
175 */
176 public boolean next() throws SQLException {
177 if (updated) {
178 resultSet.updateRow();
179 updated = false;
180 }
181 return resultSet.next();
182 }
183
184
185 /**
186 * Releases this <code>ResultSet</code> object's database and
187 * JDBC resources immediately instead of waiting for
188 * this to happen when it is automatically closed.
189 *
190 * <P><B>Note:</B> A <code>ResultSet</code> object
191 * is automatically closed by the
192 * <code>Statement</code> object that generated it when
193 * that <code>Statement</code> object is closed,
194 * re-executed, or is used to retrieve the next result from a
195 * sequence of multiple results. A <code>ResultSet</code> object
196 * is also automatically closed when it is garbage collected.
197 *
198 * @exception SQLException if a database access error occurs
199 */
200 public void close() throws SQLException {
201 resultSet.close();
202 }
203
204 /**
205 * Reports whether
206 * the last column read had a value of SQL <code>NULL</code>.
207 * Note that you must first call one of the getter methods
208 * on a column to try to read its value and then call
209 * the method <code>wasNull</code> to see if the value read was
210 * SQL <code>NULL</code>.
211 *
212 * @return <code>true</code> if the last column value read was SQL
213 * <code>NULL</code> and <code>false</code> otherwise
214 * @exception SQLException if a database access error occurs
215 */
216 public boolean wasNull() throws SQLException {
217 return resultSet.wasNull();
218 }
219
220 //======================================================================
221 // Methods for accessing results by column index
222 //======================================================================
223
224 /**
225 * Retrieves the value of the designated column in the current row
226 * of this <code>ResultSet</code> object as
227 * a <code>String</code> in the Java programming language.
228 *
229 * @param columnIndex the first column is 1, the second is 2, ...
230 * @return the column value; if the value is SQL <code>NULL</code>, the
231 * value returned is <code>null</code>
232 * @exception SQLException if a database access error occurs
233 */
234 public String getString(int columnIndex) throws SQLException {
235 return resultSet.getString(columnIndex);
236 }
237
238 /**
239 * Retrieves the value of the designated column in the current row
240 * of this <code>ResultSet</code> object as
241 * a <code>boolean</code> in the Java programming language.
242 *
243 * @param columnIndex the first column is 1, the second is 2, ...
244 * @return the column value; if the value is SQL <code>NULL</code>, the
245 * value returned is <code>false</code>
246 * @exception SQLException if a database access error occurs
247 */
248 public boolean getBoolean(int columnIndex) throws SQLException {
249 return resultSet.getBoolean(columnIndex);
250 }
251
252 /**
253 * Retrieves the value of the designated column in the current row
254 * of this <code>ResultSet</code> object as
255 * a <code>byte</code> in the Java programming language.
256 *
257 * @param columnIndex the first column is 1, the second is 2, ...
258 * @return the column value; if the value is SQL <code>NULL</code>, the
259 * value returned is <code>0</code>
260 * @exception SQLException if a database access error occurs
261 */
262 public byte getByte(int columnIndex) throws SQLException {
263 return resultSet.getByte(columnIndex);
264 }
265
266 /**
267 * Retrieves the value of the designated column in the current row
268 * of this <code>ResultSet</code> object as
269 * a <code>short</code> in the Java programming language.
270 *
271 * @param columnIndex the first column is 1, the second is 2, ...
272 * @return the column value; if the value is SQL <code>NULL</code>, the
273 * value returned is <code>0</code>
274 * @exception SQLException if a database access error occurs
275 */
276 public short getShort(int columnIndex) throws SQLException {
277 return resultSet.getShort(columnIndex);
278 }
279
280 /**
281 * Retrieves the value of the designated column in the current row
282 * of this <code>ResultSet</code> object as
283 * an <code>int</code> in the Java programming language.
284 *
285 * @param columnIndex the first column is 1, the second is 2, ...
286 * @return the column value; if the value is SQL <code>NULL</code>, the
287 * value returned is <code>0</code>
288 * @exception SQLException if a database access error occurs
289 */
290 public int getInt(int columnIndex) throws SQLException {
291 return resultSet.getInt(columnIndex);
292 }
293
294 /**
295 * Retrieves the value of the designated column in the current row
296 * of this <code>ResultSet</code> object as
297 * a <code>long</code> in the Java programming language.
298 *
299 * @param columnIndex the first column is 1, the second is 2, ...
300 * @return the column value; if the value is SQL <code>NULL</code>, the
301 * value returned is <code>0</code>
302 * @exception SQLException if a database access error occurs
303 */
304 public long getLong(int columnIndex) throws SQLException {
305 return resultSet.getLong(columnIndex);
306 }
307
308 /**
309 * Retrieves the value of the designated column in the current row
310 * of this <code>ResultSet</code> object as
311 * a <code>float</code> in the Java programming language.
312 *
313 * @param columnIndex the first column is 1, the second is 2, ...
314 * @return the column value; if the value is SQL <code>NULL</code>, the
315 * value returned is <code>0</code>
316 * @exception SQLException if a database access error occurs
317 */
318 public float getFloat(int columnIndex) throws SQLException {
319 return resultSet.getFloat(columnIndex);
320 }
321
322 /**
323 * Retrieves the value of the designated column in the current row
324 * of this <code>ResultSet</code> object as
325 * a <code>double</code> in the Java programming language.
326 *
327 * @param columnIndex the first column is 1, the second is 2, ...
328 * @return the column value; if the value is SQL <code>NULL</code>, the
329 * value returned is <code>0</code>
330 * @exception SQLException if a database access error occurs
331 */
332 public double getDouble(int columnIndex) throws SQLException {
333 return resultSet.getDouble(columnIndex);
334 }
335
336 /**
337 * Retrieves the value of the designated column in the current row
338 * of this <code>ResultSet</code> object as
339 * a <code>java.sql.BigDecimal</code> in the Java programming language.
340 *
341 * @param columnIndex the first column is 1, the second is 2, ...
342 * @param scale the number of digits to the right of the decimal point
343 * @return the column value; if the value is SQL <code>NULL</code>, the
344 * value returned is <code>null</code>
345 * @exception SQLException if a database access error occurs
346 * @deprecated
347 */
348 public BigDecimal getBigDecimal(int columnIndex, int scale) throws SQLException {
349 return resultSet.getBigDecimal(columnIndex, scale);
350 }
351
352 /**
353 * Retrieves the value of the designated column in the current row
354 * of this <code>ResultSet</code> object as
355 * a <code>byte</code> array in the Java programming language.
356 * The bytes represent the raw values returned by the driver.
357 *
358 * @param columnIndex the first column is 1, the second is 2, ...
359 * @return the column value; if the value is SQL <code>NULL</code>, the
360 * value returned is <code>null</code>
361 * @exception SQLException if a database access error occurs
362 */
363 public byte[] getBytes(int columnIndex) throws SQLException {
364 return resultSet.getBytes(columnIndex);
365 }
366
367 /**
368 * Retrieves the value of the designated column in the current row
369 * of this <code>ResultSet</code> object as
370 * a <code>java.sql.Date</code> object in the Java programming language.
371 *
372 * @param columnIndex the first column is 1, the second is 2, ...
373 * @return the column value; if the value is SQL <code>NULL</code>, the
374 * value returned is <code>null</code>
375 * @exception SQLException if a database access error occurs
376 */
377 public java.sql.Date getDate(int columnIndex) throws SQLException {
378 return resultSet.getDate(columnIndex);
379 }
380
381 /**
382 * Retrieves the value of the designated column in the current row
383 * of this <code>ResultSet</code> object as
384 * a <code>java.sql.Time</code> object in the Java programming language.
385 *
386 * @param columnIndex the first column is 1, the second is 2, ...
387 * @return the column value; if the value is SQL <code>NULL</code>, the
388 * value returned is <code>null</code>
389 * @exception SQLException if a database access error occurs
390 */
391 public java.sql.Time getTime(int columnIndex) throws SQLException {
392 return resultSet.getTime(columnIndex);
393 }
394
395 /**
396 * Retrieves the value of the designated column in the current row
397 * of this <code>ResultSet</code> object as
398 * a <code>java.sql.Timestamp</code> object in the Java programming language.
399 *
400 * @param columnIndex the first column is 1, the second is 2, ...
401 * @return the column value; if the value is SQL <code>NULL</code>, the
402 * value returned is <code>null</code>
403 * @exception SQLException if a database access error occurs
404 */
405 public java.sql.Timestamp getTimestamp(int columnIndex) throws SQLException {
406 return resultSet.getTimestamp(columnIndex);
407 }
408
409 /**
410 * Retrieves the value of the designated column in the current row
411 * of this <code>ResultSet</code> object as
412 * a stream of ASCII characters. The value can then be read in chunks from the
413 * stream. This method is particularly
414 * suitable for retrieving large <char>LONGVARCHAR</char> values.
415 * The JDBC driver will
416 * do any necessary conversion from the database format into ASCII.
417 *
418 * <P><B>Note:</B> All the data in the returned stream must be
419 * read prior to getting the value of any other column. The next
420 * call to a getter method implicitly closes the stream. Also, a
421 * stream may return <code>0</code> when the method
422 * <code>InputStream.available</code>
423 * is called whether there is data available or not.
424 *
425 * @param columnIndex the first column is 1, the second is 2, ...
426 * @return a Java input stream that delivers the database column value
427 * as a stream of one-byte ASCII characters;
428 * if the value is SQL <code>NULL</code>, the
429 * value returned is <code>null</code>
430 * @exception SQLException if a database access error occurs
431 */
432 public java.io.InputStream getAsciiStream(int columnIndex) throws SQLException {
433 return resultSet.getAsciiStream(columnIndex);
434 }
435
436 /**
437 * Retrieves the value of the designated column in the current row
438 * of this <code>ResultSet</code> object as
439 * as a stream of two-byte Unicode characters. The first byte is
440 * the high byte; the second byte is the low byte.
441 *
442 * The value can then be read in chunks from the
443 * stream. This method is particularly
444 * suitable for retrieving large <code>LONGVARCHAR</code>values. The
445 * JDBC driver will do any necessary conversion from the database
446 * format into Unicode.
447 *
448 * <P><B>Note:</B> All the data in the returned stream must be
449 * read prior to getting the value of any other column. The next
450 * call to a getter method implicitly closes the stream.
451 * Also, a stream may return <code>0</code> when the method
452 * <code>InputStream.available</code>
453 * is called, whether there is data available or not.
454 *
455 * @param columnIndex the first column is 1, the second is 2, ...
456 * @return a Java input stream that delivers the database column value
457 * as a stream of two-byte Unicode characters;
458 * if the value is SQL <code>NULL</code>, the value returned is
459 * <code>null</code>
460 *
461 * @exception SQLException if a database access error occurs
462 * @deprecated use <code>getCharacterStream</code> in place of
463 * <code>getUnicodeStream</code>
464 */
465 public java.io.InputStream getUnicodeStream(int columnIndex) throws SQLException {
466 return resultSet.getUnicodeStream(columnIndex);
467 }
468
469 /**
470 * Retrieves the value of the designated column in the current row
471 * of this <code>ResultSet</code> object as a binary stream of
472 * uninterpreted bytes. The value can then be read in chunks from the
473 * stream. This method is particularly
474 * suitable for retrieving large <code>LONGVARBINARY</code> values.
475 *
476 * <P><B>Note:</B> All the data in the returned stream must be
477 * read prior to getting the value of any other column. The next
478 * call to a getter method implicitly closes the stream. Also, a
479 * stream may return <code>0</code> when the method
480 * <code>InputStream.available</code>
481 * is called whether there is data available or not.
482 *
483 * @param columnIndex the first column is 1, the second is 2, ...
484 * @return a Java input stream that delivers the database column value
485 * as a stream of uninterpreted bytes;
486 * if the value is SQL <code>NULL</code>, the value returned is
487 * <code>null</code>
488 * @exception SQLException if a database access error occurs
489 */
490 public java.io.InputStream getBinaryStream(int columnIndex)
491 throws SQLException {
492
493 return resultSet.getBinaryStream(columnIndex);
494 }
495
496
497 //======================================================================
498 // Methods for accessing results by column name
499 //======================================================================
500
501 /**
502 * Retrieves the value of the designated column in the current row
503 * of this <code>ResultSet</code> object as
504 * a <code>String</code> in the Java programming language.
505 *
506 * @param columnName the SQL name of the column
507 * @return the column value; if the value is SQL <code>NULL</code>, the
508 * value returned is <code>null</code>
509 * @exception SQLException if a database access error occurs
510 */
511 public String getString(String columnName) throws SQLException {
512 return resultSet.getString(columnName);
513 }
514
515 /**
516 * Retrieves the value of the designated column in the current row
517 * of this <code>ResultSet</code> object as
518 * a <code>boolean</code> in the Java programming language.
519 *
520 * @param columnName the SQL name of the column
521 * @return the column value; if the value is SQL <code>NULL</code>, the
522 * value returned is <code>false</code>
523 * @exception SQLException if a database access error occurs
524 */
525 public boolean getBoolean(String columnName) throws SQLException {
526 return resultSet.getBoolean(columnName);
527 }
528
529 /**
530 * Retrieves the value of the designated column in the current row
531 * of this <code>ResultSet</code> object as
532 * a <code>byte</code> in the Java programming language.
533 *
534 * @param columnName the SQL name of the column
535 * @return the column value; if the value is SQL <code>NULL</code>, the
536 * value returned is <code>0</code>
537 * @exception SQLException if a database access error occurs
538 */
539 public byte getByte(String columnName) throws SQLException {
540 return resultSet.getByte(columnName);
541 }
542
543 /**
544 * Retrieves the value of the designated column in the current row
545 * of this <code>ResultSet</code> object as
546 * a <code>short</code> in the Java programming language.
547 *
548 * @param columnName the SQL name of the column
549 * @return the column value; if the value is SQL <code>NULL</code>, the
550 * value returned is <code>0</code>
551 * @exception SQLException if a database access error occurs
552 */
553 public short getShort(String columnName) throws SQLException {
554 return resultSet.getShort(columnName);
555 }
556
557 /**
558 * Retrieves the value of the designated column in the current row
559 * of this <code>ResultSet</code> object as
560 * an <code>int</code> in the Java programming language.
561 *
562 * @param columnName the SQL name of the column
563 * @return the column value; if the value is SQL <code>NULL</code>, the
564 * value returned is <code>0</code>
565 * @exception SQLException if a database access error occurs
566 */
567 public int getInt(String columnName) throws SQLException {
568 return resultSet.getInt(columnName);
569 }
570
571 /**
572 * Retrieves the value of the designated column in the current row
573 * of this <code>ResultSet</code> object as
574 * a <code>long</code> in the Java programming language.
575 *
576 * @param columnName the SQL name of the column
577 * @return the column value; if the value is SQL <code>NULL</code>, the
578 * value returned is <code>0</code>
579 * @exception SQLException if a database access error occurs
580 */
581 public long getLong(String columnName) throws SQLException {
582 return resultSet.getLong(columnName);
583 }
584
585 /**
586 * Retrieves the value of the designated column in the current row
587 * of this <code>ResultSet</code> object as
588 * a <code>float</code> in the Java programming language.
589 *
590 * @param columnName the SQL name of the column
591 * @return the column value; if the value is SQL <code>NULL</code>, the
592 * value returned is <code>0</code>
593 * @exception SQLException if a database access error occurs
594 */
595 public float getFloat(String columnName) throws SQLException {
596 return resultSet.getFloat(columnName);
597 }
598
599 /**
600 * Retrieves the value of the designated column in the current row
601 * of this <code>ResultSet</code> object as
602 * a <code>double</code> in the Java programming language.
603 *
604 * @param columnName the SQL name of the column
605 * @return the column value; if the value is SQL <code>NULL</code>, the
606 * value returned is <code>0</code>
607 * @exception SQLException if a database access error occurs
608 */
609 public double getDouble(String columnName) throws SQLException {
610 return resultSet.getDouble(columnName);
611 }
612
613 /**
614 * Retrieves the value of the designated column in the current row
615 * of this <code>ResultSet</code> object as
616 * a <code>java.math.BigDecimal</code> in the Java programming language.
617 *
618 * @param columnName the SQL name of the column
619 * @param scale the number of digits to the right of the decimal point
620 * @return the column value; if the value is SQL <code>NULL</code>, the
621 * value returned is <code>null</code>
622 * @exception SQLException if a database access error occurs
623 * @deprecated
624 */
625 public BigDecimal getBigDecimal(String columnName, int scale) throws SQLException {
626 return resultSet.getBigDecimal(columnName, scale);
627 }
628
629 /**
630 * Retrieves the value of the designated column in the current row
631 * of this <code>ResultSet</code> object as
632 * a <code>byte</code> array in the Java programming language.
633 * The bytes represent the raw values returned by the driver.
634 *
635 * @param columnName the SQL name of the column
636 * @return the column value; if the value is SQL <code>NULL</code>, the
637 * value returned is <code>null</code>
638 * @exception SQLException if a database access error occurs
639 */
640 public byte[] getBytes(String columnName) throws SQLException {
641 return resultSet.getBytes(columnName);
642 }
643
644 /**
645 * Retrieves the value of the designated column in the current row
646 * of this <code>ResultSet</code> object as
647 * a <code>java.sql.Date</code> object in the Java programming language.
648 *
649 * @param columnName the SQL name of the column
650 * @return the column value; if the value is SQL <code>NULL</code>, the
651 * value returned is <code>null</code>
652 * @exception SQLException if a database access error occurs
653 */
654 public java.sql.Date getDate(String columnName) throws SQLException {
655 return resultSet.getDate(columnName);
656 }
657
658 /**
659 * Retrieves the value of the designated column in the current row
660 * of this <code>ResultSet</code> object as
661 * a <code>java.sql.Time</code> object in the Java programming language.
662 *
663 * @param columnName the SQL name of the column
664 * @return the column value;
665 * if the value is SQL <code>NULL</code>,
666 * the value returned is <code>null</code>
667 * @exception SQLException if a database access error occurs
668 */
669 public java.sql.Time getTime(String columnName) throws SQLException {
670 return resultSet.getTime(columnName);
671 }
672
673 /**
674 * Retrieves the value of the designated column in the current row
675 * of this <code>ResultSet</code> object as
676 * a <code>java.sql.Timestamp</code> object.
677 *
678 * @param columnName the SQL name of the column
679 * @return the column value; if the value is SQL <code>NULL</code>, the
680 * value returned is <code>null</code>
681 * @exception SQLException if a database access error occurs
682 */
683 public java.sql.Timestamp getTimestamp(String columnName) throws SQLException {
684 return resultSet.getTimestamp(columnName);
685 }
686
687 /**
688 * Retrieves the value of the designated column in the current row
689 * of this <code>ResultSet</code> object as a stream of
690 * ASCII characters. The value can then be read in chunks from the
691 * stream. This method is particularly
692 * suitable for retrieving large <code>LONGVARCHAR</code> values.
693 * The JDBC driver will
694 * do any necessary conversion from the database format into ASCII.
695 *
696 * <P><B>Note:</B> All the data in the returned stream must be
697 * read prior to getting the value of any other column. The next
698 * call to a getter method implicitly closes the stream. Also, a
699 * stream may return <code>0</code> when the method <code>available</code>
700 * is called whether there is data available or not.
701 *
702 * @param columnName the SQL name of the column
703 * @return a Java input stream that delivers the database column value
704 * as a stream of one-byte ASCII characters.
705 * If the value is SQL <code>NULL</code>,
706 * the value returned is <code>null</code>.
707 * @exception SQLException if a database access error occurs
708 */
709 public java.io.InputStream getAsciiStream(String columnName) throws SQLException {
710 return resultSet.getAsciiStream(columnName);
711 }
712
713 /**
714 * Retrieves the value of the designated column in the current row
715 * of this <code>ResultSet</code> object as a stream of two-byte
716 * Unicode characters. The first byte is the high byte; the second
717 * byte is the low byte.
718 *
719 * The value can then be read in chunks from the
720 * stream. This method is particularly
721 * suitable for retrieving large <code>LONGVARCHAR</code> values.
722 * The JDBC technology-enabled driver will
723 * do any necessary conversion from the database format into Unicode.
724 *
725 * <P><B>Note:</B> All the data in the returned stream must be
726 * read prior to getting the value of any other column. The next
727 * call to a getter method implicitly closes the stream.
728 * Also, a stream may return <code>0</code> when the method
729 * <code>InputStream.available</code> is called, whether there
730 * is data available or not.
731 *
732 * @param columnName the SQL name of the column
733 * @return a Java input stream that delivers the database column value
734 * as a stream of two-byte Unicode characters.
735 * If the value is SQL <code>NULL</code>, the value returned
736 * is <code>null</code>.
737 * @exception SQLException if a database access error occurs
738 * @deprecated use <code>getCharacterStream</code> instead
739 */
740 public java.io.InputStream getUnicodeStream(String columnName) throws SQLException {
741 return resultSet.getUnicodeStream(columnName);
742 }
743
744 /**
745 * Retrieves the value of the designated column in the current row
746 * of this <code>ResultSet</code> object as a stream of uninterpreted
747 * <code>byte</code>s.
748 * The value can then be read in chunks from the
749 * stream. This method is particularly
750 * suitable for retrieving large <code>LONGVARBINARY</code>
751 * values.
752 *
753 * <P><B>Note:</B> All the data in the returned stream must be
754 * read prior to getting the value of any other column. The next
755 * call to a getter method implicitly closes the stream. Also, a
756 * stream may return <code>0</code> when the method <code>available</code>
757 * is called whether there is data available or not.
758 *
759 * @param columnName the SQL name of the column
760 * @return a Java input stream that delivers the database column value
761 * as a stream of uninterpreted bytes;
762 * if the value is SQL <code>NULL</code>, the result is <code>null</code>
763 * @exception SQLException if a database access error occurs
764 */
765 public java.io.InputStream getBinaryStream(String columnName)
766 throws SQLException {
767
768 return resultSet.getBinaryStream(columnName);
769 }
770
771
772 //=====================================================================
773 // Advanced features:
774 //=====================================================================
775
776 /**
777 * Retrieves the first warning reported by calls on this
778 * <code>ResultSet</code> object.
779 * Subsequent warnings on this <code>ResultSet</code> object
780 * will be chained to the <code>SQLWarning</code> object that
781 * this method returns.
782 *
783 * <P>The warning chain is automatically cleared each time a new
784 * row is read. This method may not be called on a <code>ResultSet</code>
785 * object that has been closed; doing so will cause an
786 * <code>SQLException</code> to be thrown.
787 * <P>
788 * <B>Note:</B> This warning chain only covers warnings caused
789 * by <code>ResultSet</code> methods. Any warning caused by
790 * <code>Statement</code> methods
791 * (such as reading OUT parameters) will be chained on the
792 * <code>Statement</code> object.
793 *
794 * @return the first <code>SQLWarning</code> object reported or
795 * <code>null</code> if there are none
796 * @exception SQLException if a database access error occurs or this method is
797 * called on a closed result set
798 */
799 public SQLWarning getWarnings() throws SQLException {
800 return resultSet.getWarnings();
801 }
802
803 /**
804 * Clears all warnings reported on this <code>ResultSet</code> object.
805 * After this method is called, the method <code>getWarnings</code>
806 * returns <code>null</code> until a new warning is
807 * reported for this <code>ResultSet</code> object.
808 *
809 * @exception SQLException if a database access error occurs
810 */
811 public void clearWarnings() throws SQLException {
812 resultSet.clearWarnings();
813 }
814
815 /**
816 * Retrieves the name of the SQL cursor used by this <code>ResultSet</code>
817 * object.
818 *
819 * <P>In SQL, a result table is retrieved through a cursor that is
820 * named. The current row of a result set can be updated or deleted
821 * using a positioned update/delete statement that references the
822 * cursor name. To insure that the cursor has the proper isolation
823 * level to support update, the cursor's <code>SELECT</code> statement
824 * should be of the form <code>SELECT FOR UPDATE</code>. If
825 * <code>FOR UPDATE</code> is omitted, the positioned updates may fail.
826 *
827 * <P>The JDBC API supports this SQL feature by providing the name of the
828 * SQL cursor used by a <code>ResultSet</code> object.
829 * The current row of a <code>ResultSet</code> object
830 * is also the current row of this SQL cursor.
831 *
832 * <P><B>Note:</B> If positioned update is not supported, a
833 * <code>SQLException</code> is thrown.
834 *
835 * @return the SQL name for this <code>ResultSet</code> object's cursor
836 * @exception SQLException if a database access error occurs
837 */
838 public String getCursorName() throws SQLException {
839 return resultSet.getCursorName();
840 }
841
842 /**
843 * Retrieves the number, types and properties of
844 * this <code>ResultSet</code> object's columns.
845 *
846 * @return the description of this <code>ResultSet</code> object's columns
847 * @exception SQLException if a database access error occurs
848 */
849 public ResultSetMetaData getMetaData() throws SQLException {
850 return resultSet.getMetaData();
851 }
852
853 /**
854 * <p>Gets the value of the designated column in the current row
855 * of this <code>ResultSet</code> object as
856 * an <code>Object</code> in the Java programming language.
857 *
858 * <p>This method will return the value of the given column as a
859 * Java object. The type of the Java object will be the default
860 * Java object type corresponding to the column's SQL type,
861 * following the mapping for built-in types specified in the JDBC
862 * specification. If the value is an SQL <code>NULL</code>,
863 * the driver returns a Java <code>null</code>.
864 *
865 * <p>This method may also be used to read database-specific
866 * abstract data types.
867 *
868 * In the JDBC 2.0 API, the behavior of method
869 * <code>getObject</code> is extended to materialize
870 * data of SQL user-defined types. When a column contains
871 * a structured or distinct value, the behavior of this method is as
872 * if it were a call to: <code>getObject(columnIndex,
873 * this.getStatement().getConnection().getTypeMap())</code>.
874 *
875 * @param columnIndex the first column is 1, the second is 2, ...
876 * @return a <code>java.lang.Object</code> holding the column value
877 * @exception SQLException if a database access error occurs
878 */
879 public Object getObject(int columnIndex) throws SQLException {
880 return resultSet.getObject(columnIndex);
881 }
882
883 /**
884 * <p>Gets the value of the designated column in the current row
885 * of this <code>ResultSet</code> object as
886 * an <code>Object</code> in the Java programming language.
887 *
888 * <p>This method will return the value of the given column as a
889 * Java object. The type of the Java object will be the default
890 * Java object type corresponding to the column's SQL type,
891 * following the mapping for built-in types specified in the JDBC
892 * specification. If the value is an SQL <code>NULL</code>,
893 * the driver returns a Java <code>null</code>.
894 * <P>
895 * This method may also be used to read database-specific
896 * abstract data types.
897 * <P>
898 * In the JDBC 2.0 API, the behavior of the method
899 * <code>getObject</code> is extended to materialize
900 * data of SQL user-defined types. When a column contains
901 * a structured or distinct value, the behavior of this method is as
902 * if it were a call to: <code>getObject(columnIndex,
903 * this.getStatement().getConnection().getTypeMap())</code>.
904 *
905 * @param columnName the SQL name of the column
906 * @return a <code>java.lang.Object</code> holding the column value
907 * @exception SQLException if a database access error occurs
908 */
909 public Object getObject(String columnName) throws SQLException {
910 return resultSet.getObject(columnName);
911 }
912
913 //----------------------------------------------------------------
914
915 /**
916 * Maps the given <code>ResultSet</code> column name to its
917 * <code>ResultSet</code> column index.
918 *
919 * @param columnName the name of the column
920 * @return the column index of the given column name
921 * @exception SQLException if the <code>ResultSet</code> object
922 * does not contain <code>columnName</code> or a database access error occurs
923 */
924 public int findColumn(String columnName) throws SQLException {
925 return resultSet.findColumn(columnName);
926 }
927
928
929 //--------------------------JDBC 2.0-----------------------------------
930
931 //---------------------------------------------------------------------
932 // Getters and Setters
933 //---------------------------------------------------------------------
934
935 /**
936 * Retrieves the value of the designated column in the current row
937 * of this <code>ResultSet</code> object as a
938 * <code>java.io.Reader</code> object.
939 * @return a <code>java.io.Reader</code> object that contains the column
940 * value; if the value is SQL <code>NULL</code>, the value returned is
941 * <code>null</code> in the Java programming language.
942 * @param columnIndex the first column is 1, the second is 2, ...
943 * @exception SQLException if a database access error occurs
944 * @since 1.2
945 */
946 public java.io.Reader getCharacterStream(int columnIndex) throws SQLException {
947 return resultSet.getCharacterStream(columnIndex);
948 }
949
950 /**
951 * Retrieves the value of the designated column in the current row
952 * of this <code>ResultSet</code> object as a
953 * <code>java.io.Reader</code> object.
954 *
955 * @param columnName the name of the column
956 * @return a <code>java.io.Reader</code> object that contains the column
957 * value; if the value is SQL <code>NULL</code>, the value returned is
958 * <code>null</code> in the Java programming language
959 * @exception SQLException if a database access error occurs
960 * @since 1.2
961 */
962 public java.io.Reader getCharacterStream(String columnName) throws SQLException {
963 return resultSet.getCharacterStream(columnName);
964 }
965
966 /**
967 * Retrieves the value of the designated column in the current row
968 * of this <code>ResultSet</code> object as a
969 * <code>java.math.BigDecimal</code> with full precision.
970 *
971 * @param columnIndex the first column is 1, the second is 2, ...
972 * @return the column value (full precision);
973 * if the value is SQL <code>NULL</code>, the value returned is
974 * <code>null</code> in the Java programming language.
975 * @exception SQLException if a database access error occurs
976 * @since 1.2
977 */
978 public BigDecimal getBigDecimal(int columnIndex) throws SQLException {
979 return resultSet.getBigDecimal(columnIndex);
980 }
981
982 /**
983 * Retrieves the value of the designated column in the current row
984 * of this <code>ResultSet</code> object as a
985 * <code>java.math.BigDecimal</code> with full precision.
986 *
987 * @param columnName the column name
988 * @return the column value (full precision);
989 * if the value is SQL <code>NULL</code>, the value returned is
990 * <code>null</code> in the Java programming language.
991 * @exception SQLException if a database access error occurs
992 * @since 1.2
993 *
994 */
995 public BigDecimal getBigDecimal(String columnName) throws SQLException {
996 return resultSet.getBigDecimal(columnName);
997 }
998
999 //---------------------------------------------------------------------
1000 // Traversal/Positioning
1001 //---------------------------------------------------------------------
1002
1003 /**
1004 * Retrieves whether the cursor is before the first row in
1005 * this <code>ResultSet</code> object.
1006 *
1007 * @return <code>true</code> if the cursor is before the first row;
1008 * <code>false</code> if the cursor is at any other position or the
1009 * result set contains no rows
1010 * @exception SQLException if a database access error occurs
1011 * @since 1.2
1012 */
1013 public boolean isBeforeFirst() throws SQLException {
1014 return resultSet.isBeforeFirst();
1015 }
1016
1017 /**
1018 * Retrieves whether the cursor is after the last row in
1019 * this <code>ResultSet</code> object.
1020 *
1021 * @return <code>true</code> if the cursor is after the last row;
1022 * <code>false</code> if the cursor is at any other position or the
1023 * result set contains no rows
1024 * @exception SQLException if a database access error occurs
1025 * @since 1.2
1026 */
1027 public boolean isAfterLast() throws SQLException {
1028 return resultSet.isAfterLast();
1029 }
1030
1031 /**
1032 * Retrieves whether the cursor is on the first row of
1033 * this <code>ResultSet</code> object.
1034 *
1035 * @return <code>true</code> if the cursor is on the first row;
1036 * <code>false</code> otherwise
1037 * @exception SQLException if a database access error occurs
1038 * @since 1.2
1039 */
1040 public boolean isFirst() throws SQLException {
1041 return resultSet.isFirst();
1042 }
1043
1044 /**
1045 * Retrieves whether the cursor is on the last row of
1046 * this <code>ResultSet</code> object.
1047 * Note: Calling the method <code>isLast</code> may be expensive
1048 * because the JDBC driver
1049 * might need to fetch ahead one row in order to determine
1050 * whether the current row is the last row in the result set.
1051 *
1052 * @return <code>true</code> if the cursor is on the last row;
1053 * <code>false</code> otherwise
1054 * @exception SQLException if a database access error occurs
1055 * @since 1.2
1056 */
1057 public boolean isLast() throws SQLException {
1058 return resultSet.isLast();
1059 }
1060
1061 /**
1062 * Moves the cursor to the front of
1063 * this <code>ResultSet</code> object, just before the
1064 * first row. This method has no effect if the result set contains no rows.
1065 *
1066 * @exception SQLException if a database access error
1067 * occurs or the result set type is <code>TYPE_FORWARD_ONLY</code>
1068 * @since 1.2
1069 */
1070 public void beforeFirst() throws SQLException {
1071 resultSet.beforeFirst();
1072 }
1073
1074 /**
1075 * Moves the cursor to the end of
1076 * this <code>ResultSet</code> object, just after the
1077 * last row. This method has no effect if the result set contains no rows.
1078 * @exception SQLException if a database access error
1079 * occurs or the result set type is <code>TYPE_FORWARD_ONLY</code>
1080 * @since 1.2
1081 */
1082 public void afterLast() throws SQLException {
1083 resultSet.afterLast();
1084 }
1085
1086 /**
1087 * Moves the cursor to the first row in
1088 * this <code>ResultSet</code> object.
1089 *
1090 * @return <code>true</code> if the cursor is on a valid row;
1091 * <code>false</code> if there are no rows in the result set
1092 * @exception SQLException if a database access error
1093 * occurs or the result set type is <code>TYPE_FORWARD_ONLY</code>
1094 * @since 1.2
1095 */
1096 public boolean first() throws SQLException {
1097 return resultSet.first();
1098 }
1099
1100 /**
1101 * Moves the cursor to the last row in
1102 * this <code>ResultSet</code> object.
1103 *
1104 * @return <code>true</code> if the cursor is on a valid row;
1105 * <code>false</code> if there are no rows in the result set
1106 * @exception SQLException if a database access error
1107 * occurs or the result set type is <code>TYPE_FORWARD_ONLY</code>
1108 * @since 1.2
1109 */
1110 public boolean last() throws SQLException {
1111 return resultSet.last();
1112 }
1113
1114 /**
1115 * Retrieves the current row number. The first row is number 1, the
1116 * second number 2, and so on.
1117 *
1118 * @return the current row number; <code>0</code> if there is no current row
1119 * @exception SQLException if a database access error occurs
1120 * @since 1.2
1121 */
1122 public int getRow() throws SQLException {
1123 return resultSet.getRow();
1124 }
1125
1126 /**
1127 * Moves the cursor to the given row number in
1128 * this <code>ResultSet</code> object.
1129 *
1130 * <p>If the row number is positive, the cursor moves to
1131 * the given row number with respect to the
1132 * beginning of the result set. The first row is row 1, the second
1133 * is row 2, and so on.
1134 *
1135 * <p>If the given row number is negative, the cursor moves to
1136 * an absolute row position with respect to
1137 * the end of the result set. For example, calling the method
1138 * <code>absolute(-1)</code> positions the
1139 * cursor on the last row; calling the method <code>absolute(-2)</code>
1140 * moves the cursor to the next-to-last row, and so on.
1141 *
1142 * <p>An attempt to position the cursor beyond the first/last row in
1143 * the result set leaves the cursor before the first row or after
1144 * the last row.
1145 *
1146 * <p><B>Note:</B> Calling <code>absolute(1)</code> is the same
1147 * as calling <code>first()</code>. Calling <code>absolute(-1)</code>
1148 * is the same as calling <code>last()</code>.
1149 *
1150 * @param row the number of the row to which the cursor should move.
1151 * A positive number indicates the row number counting from the
1152 * beginning of the result set; a negative number indicates the
1153 * row number counting from the end of the result set
1154 * @return <code>true</code> if the cursor is on the result set;
1155 * <code>false</code> otherwise
1156 * @exception SQLException if a database access error
1157 * occurs, or the result set type is <code>TYPE_FORWARD_ONLY</code>
1158 * @since 1.2
1159 */
1160 public boolean absolute( int row ) throws SQLException {
1161 return resultSet.absolute(row);
1162 }
1163
1164 /**
1165 * Moves the cursor a relative number of rows, either positive or negative.
1166 * Attempting to move beyond the first/last row in the
1167 * result set positions the cursor before/after the
1168 * the first/last row. Calling <code>relative(0)</code> is valid, but does
1169 * not change the cursor position.
1170 *
1171 * <p>Note: Calling the method <code>relative(1)</code>
1172 * is identical to calling the method <code>next()</code> and
1173 * calling the method <code>relative(-1)</code> is identical
1174 * to calling the method <code>previous()</code>.
1175 *
1176 * @param rows an <code>int</code> specifying the number of rows to
1177 * move from the current row; a positive number moves the cursor
1178 * forward; a negative number moves the cursor backward
1179 * @return <code>true</code> if the cursor is on a row;
1180 * <code>false</code> otherwise
1181 * @exception SQLException if a database access error occurs,
1182 * there is no current row, or the result set type is
1183 * <code>TYPE_FORWARD_ONLY</code>
1184 * @since 1.2
1185 */
1186 public boolean relative( int rows ) throws SQLException {
1187 return resultSet.relative(rows);
1188 }
1189
1190 /**
1191 * Moves the cursor to the previous row in this
1192 * <code>ResultSet</code> object.
1193 *
1194 * @return <code>true</code> if the cursor is on a valid row;
1195 * <code>false</code> if it is off the result set
1196 * @exception SQLException if a database access error
1197 * occurs or the result set type is <code>TYPE_FORWARD_ONLY</code>
1198 * @since 1.2
1199 */
1200 public boolean previous() throws SQLException {
1201 if (updated) {
1202 resultSet.updateRow();
1203 updated = false;
1204 }
1205 return resultSet.previous();
1206 }
1207
1208 /**
1209 * Gives a hint as to the direction in which the rows in this
1210 * <code>ResultSet</code> object will be processed.
1211 * The initial value is determined by the
1212 * <code>Statement</code> object
1213 * that produced this <code>ResultSet</code> object.
1214 * The fetch direction may be changed at any time.
1215 *
1216 * @param direction an <code>int</code> specifying the suggested
1217 * fetch direction; one of <code>ResultSet.FETCH_FORWARD</code>,
1218 * <code>ResultSet.FETCH_REVERSE</code>, or
1219 * <code>ResultSet.FETCH_UNKNOWN</code>
1220 * @exception SQLException if a database access error occurs or
1221 * the result set type is <code>TYPE_FORWARD_ONLY</code> and the fetch
1222 * direction is not <code>FETCH_FORWARD</code>
1223 * @since 1.2
1224 * @see Statement#setFetchDirection
1225 * @see #getFetchDirection
1226 */
1227 public void setFetchDirection(int direction) throws SQLException {
1228 resultSet.setFetchDirection(direction);
1229 }
1230
1231 /**
1232 * Retrieves the fetch direction for this
1233 * <code>ResultSet</code> object.
1234 *
1235 * @return the current fetch direction for this <code>ResultSet</code> object
1236 * @exception SQLException if a database access error occurs
1237 * @since 1.2
1238 * @see #setFetchDirection
1239 */
1240 public int getFetchDirection() throws SQLException {
1241 return resultSet.getFetchDirection();
1242 }
1243
1244 /**
1245 * Gives the JDBC driver a hint as to the number of rows that should
1246 * be fetched from the database when more rows are needed for this
1247 * <code>ResultSet</code> object.
1248 * If the fetch size specified is zero, the JDBC driver
1249 * ignores the value and is free to make its own best guess as to what
1250 * the fetch size should be. The default value is set by the
1251 * <code>Statement</code> object
1252 * that created the result set. The fetch size may be changed at any time.
1253 *
1254 * @param rows the number of rows to fetch
1255 * @exception SQLException if a database access error occurs or the
1256 * condition <code>0 <= rows <= Statement.getMaxRows()</code> is not satisfied
1257 * @since 1.2
1258 * @see #getFetchSize
1259 */
1260 public void setFetchSize(int rows) throws SQLException {
1261 resultSet.setFetchSize(rows);
1262 }
1263
1264 /**
1265 * Retrieves the fetch size for this
1266 * <code>ResultSet</code> object.
1267 *
1268 * @return the current fetch size for this <code>ResultSet</code> object
1269 * @exception SQLException if a database access error occurs
1270 * @since 1.2
1271 * @see #setFetchSize
1272 */
1273 public int getFetchSize() throws SQLException {
1274 return resultSet.getFetchSize();
1275 }
1276
1277 /**
1278 * Retrieves the type of this <code>ResultSet</code> object.
1279 * The type is determined by the <code>Statement</code> object
1280 * that created the result set.
1281 *
1282 * @return <code>ResultSet.TYPE_FORWARD_ONLY</code>,
1283 * <code>ResultSet.TYPE_SCROLL_INSENSITIVE</code>,
1284 * or <code>ResultSet.TYPE_SCROLL_SENSITIVE</code>
1285 * @exception SQLException if a database access error occurs
1286 * @since 1.2
1287 */
1288 public int getType() throws SQLException {
1289 return resultSet.getType();
1290 }
1291
1292 /**
1293 * Retrieves the concurrency mode of this <code>ResultSet</code> object.
1294 * The concurrency used is determined by the
1295 * <code>Statement</code> object that created the result set.
1296 *
1297 * @return the concurrency type, either
1298 * <code>ResultSet.CONCUR_READ_ONLY</code>
1299 * or <code>ResultSet.CONCUR_UPDATABLE</code>
1300 * @exception SQLException if a database access error occurs
1301 * @since 1.2
1302 */
1303 public int getConcurrency() throws SQLException {
1304 return resultSet.getConcurrency();
1305 }
1306
1307 //---------------------------------------------------------------------
1308 // Updates
1309 //---------------------------------------------------------------------
1310
1311 /**
1312 * Retrieves whether the current row has been updated. The value returned
1313 * depends on whether or not the result set can detect updates.
1314 *
1315 * @return <code>true</code> if both (1) the row has been visibly updated
1316 * by the owner or another and (2) updates are detected
1317 * @exception SQLException if a database access error occurs
1318 * @see DatabaseMetaData#updatesAreDetected
1319 * @since 1.2
1320 */
1321 public boolean rowUpdated() throws SQLException {
1322 return resultSet.rowUpdated();
1323 }
1324
1325 /**
1326 * Retrieves whether the current row has had an insertion.
1327 * The value returned depends on whether or not this
1328 * <code>ResultSet</code> object can detect visible inserts.
1329 *
1330 * @return <code>true</code> if a row has had an insertion
1331 * and insertions are detected; <code>false</code> otherwise
1332 * @exception SQLException if a database access error occurs
1333 *
1334 * @see DatabaseMetaData#insertsAreDetected
1335 * @since 1.2
1336 */
1337 public boolean rowInserted() throws SQLException {
1338 return resultSet.rowInserted();
1339 }
1340
1341 /**
1342 * Retrieves whether a row has been deleted. A deleted row may leave
1343 * a visible "hole" in a result set. This method can be used to
1344 * detect holes in a result set. The value returned depends on whether
1345 * or not this <code>ResultSet</code> object can detect deletions.
1346 *
1347 * @return <code>true</code> if a row was deleted and deletions are detected;
1348 * <code>false</code> otherwise
1349 * @exception SQLException if a database access error occurs
1350 *
1351 * @see DatabaseMetaData#deletesAreDetected
1352 * @since 1.2
1353 */
1354 public boolean rowDeleted() throws SQLException {
1355 return resultSet.rowDeleted();
1356 }
1357
1358 /**
1359 * Gives a nullable column a null value.
1360 *
1361 * The updater methods are used to update column values in the
1362 * current row or the insert row. The updater methods do not
1363 * update the underlying database; instead the <code>updateRow</code>
1364 * or <code>insertRow</code> methods are called to update the database.
1365 *
1366 * @param columnIndex the first column is 1, the second is 2, ...
1367 * @exception SQLException if a database access error occurs
1368 * @since 1.2
1369 */
1370 public void updateNull(int columnIndex) throws SQLException {
1371 resultSet.updateNull(columnIndex);
1372 }
1373
1374 /**
1375 * Updates the designated column with a <code>boolean</code> value.
1376 * The updater methods are used to update column values in the
1377 * current row or the insert row. The updater methods do not
1378 * update the underlying database; instead the <code>updateRow</code> or
1379 * <code>insertRow</code> methods are called to update the database.
1380 *
1381 * @param columnIndex the first column is 1, the second is 2, ...
1382 * @param x the new column value
1383 * @exception SQLException if a database access error occurs
1384 * @since 1.2
1385 */
1386 public void updateBoolean(int columnIndex, boolean x) throws SQLException {
1387 resultSet.updateBoolean(columnIndex, x);
1388 }
1389
1390 /**
1391 * Updates the designated column with a <code>byte</code> value.
1392 * The updater methods are used to update column values in the
1393 * current row or the insert row. The updater methods do not
1394 * update the underlying database; instead the <code>updateRow</code> or
1395 * <code>insertRow</code> methods are called to update the database.
1396 *
1397 *
1398 * @param columnIndex the first column is 1, the second is 2, ...
1399 * @param x the new column value
1400 * @exception SQLException if a database access error occurs
1401 * @since 1.2
1402 */
1403 public void updateByte(int columnIndex, byte x) throws SQLException {
1404 resultSet.updateByte(columnIndex, x);
1405 }
1406
1407 /**
1408 * Updates the designated column with a <code>short</code> value.
1409 * The updater methods are used to update column values in the
1410 * current row or the insert row. The updater methods do not
1411 * update the underlying database; instead the <code>updateRow</code> or
1412 * <code>insertRow</code> methods are called to update the database.
1413 *
1414 * @param columnIndex the first column is 1, the second is 2, ...
1415 * @param x the new column value
1416 * @exception SQLException if a database access error occurs
1417 * @since 1.2
1418 */
1419 public void updateShort(int columnIndex, short x) throws SQLException {
1420 resultSet.updateShort(columnIndex, x);
1421 }
1422
1423 /**
1424 * Updates the designated column with an <code>int</code> value.
1425 * The updater methods are used to update column values in the
1426 * current row or the insert row. The updater methods do not
1427 * update the underlying database; instead the <code>updateRow</code> or
1428 * <code>insertRow</code> methods are called to update the database.
1429 *
1430 * @param columnIndex the first column is 1, the second is 2, ...
1431 * @param x the new column value
1432 * @exception SQLException if a database access error occurs
1433 * @since 1.2
1434 */
1435 public void updateInt(int columnIndex, int x) throws SQLException {
1436 resultSet.updateInt(columnIndex, x);
1437 }
1438
1439 /**
1440 * Updates the designated column with a <code>long</code> value.
1441 * The updater methods are used to update column values in the
1442 * current row or the insert row. The updater methods do not
1443 * update the underlying database; instead the <code>updateRow</code> or
1444 * <code>insertRow</code> methods are called to update the database.
1445 *
1446 * @param columnIndex the first column is 1, the second is 2, ...
1447 * @param x the new column value
1448 * @exception SQLException if a database access error occurs
1449 * @since 1.2
1450 */
1451 public void updateLong(int columnIndex, long x) throws SQLException {
1452 resultSet.updateLong(columnIndex, x);
1453 }
1454
1455 /**
1456 * Updates the designated column with a <code>float</code> value.
1457 * The updater methods are used to update column values in the
1458 * current row or the insert row. The updater methods do not
1459 * update the underlying database; instead the <code>updateRow</code> or
1460 * <code>insertRow</code> methods are called to update the database.
1461 *
1462 * @param columnIndex the first column is 1, the second is 2, ...
1463 * @param x the new column value
1464 * @exception SQLException if a database access error occurs
1465 * @since 1.2
1466 */
1467 public void updateFloat(int columnIndex, float x) throws SQLException {
1468 resultSet.updateFloat(columnIndex, x);
1469 }
1470
1471 /**
1472 * Updates the designated column with a <code>double</code> value.
1473 * The updater methods are used to update column values in the
1474 * current row or the insert row. The updater methods do not
1475 * update the underlying database; instead the <code>updateRow</code> or
1476 * <code>insertRow</code> methods are called to update the database.
1477 *
1478 * @param columnIndex the first column is 1, the second is 2, ...
1479 * @param x the new column value
1480 * @exception SQLException if a database access error occurs
1481 * @since 1.2
1482 */
1483 public void updateDouble(int columnIndex, double x) throws SQLException {
1484 resultSet.updateDouble(columnIndex, x);
1485 }
1486
1487 /**
1488 * Updates the designated column with a <code>java.math.BigDecimal</code>
1489 * value.
1490 * The updater methods are used to update column values in the
1491 * current row or the insert row. The updater methods do not
1492 * update the underlying database; instead the <code>updateRow</code> or
1493 * <code>insertRow</code> methods are called to update the database.
1494 *
1495 * @param columnIndex the first column is 1, the second is 2, ...
1496 * @param x the new column value
1497 * @exception SQLException if a database access error occurs
1498 * @since 1.2
1499 */
1500 public void updateBigDecimal(int columnIndex, BigDecimal x) throws SQLException {
1501 resultSet.updateBigDecimal(columnIndex, x);
1502 }
1503
1504 /**
1505 * Updates the designated column with a <code>String</code> value.
1506 * The updater methods are used to update column values in the
1507 * current row or the insert row. The updater methods do not
1508 * update the underlying database; instead the <code>updateRow</code> or
1509 * <code>insertRow</code> methods are called to update the database.
1510 *
1511 * @param columnIndex the first column is 1, the second is 2, ...
1512 * @param x the new column value
1513 * @exception SQLException if a database access error occurs
1514 * @since 1.2
1515 */
1516 public void updateString(int columnIndex, String x) throws SQLException {
1517 resultSet.updateString(columnIndex, x);
1518 }
1519
1520 /**
1521 * Updates the designated column with a <code>byte</code> array value.
1522 * The updater methods are used to update column values in the
1523 * current row or the insert row. The updater methods do not
1524 * update the underlying database; instead the <code>updateRow</code> or
1525 * <code>insertRow</code> methods are called to update the database.
1526 *
1527 * @param columnIndex the first column is 1, the second is 2, ...
1528 * @param x the new column value
1529 * @exception SQLException if a database access error occurs
1530 * @since 1.2
1531 */
1532 public void updateBytes(int columnIndex, byte x[]) throws SQLException {
1533 resultSet.updateBytes(columnIndex, x);
1534 }
1535
1536 /**
1537 * Updates the designated column with a <code>java.sql.Date</code> value.
1538 * The updater methods are used to update column values in the
1539 * current row or the insert row. The updater methods do not
1540 * update the underlying database; instead the <code>updateRow</code> or
1541 * <code>insertRow</code> methods are called to update the database.
1542 *
1543 * @param columnIndex the first column is 1, the second is 2, ...
1544 * @param x the new column value
1545 * @exception SQLException if a database access error occurs
1546 * @since 1.2
1547 */
1548 public void updateDate(int columnIndex, java.sql.Date x) throws SQLException {
1549 resultSet.updateDate(columnIndex, x);
1550 }
1551
1552 /**
1553 * Updates the designated column with a <code>java.sql.Time</code> value.
1554 * The updater methods are used to update column values in the
1555 * current row or the insert row. The updater methods do not
1556 * update the underlying database; instead the <code>updateRow</code> or
1557 * <code>insertRow</code> methods are called to update the database.
1558 *
1559 * @param columnIndex the first column is 1, the second is 2, ...
1560 * @param x the new column value
1561 * @exception SQLException if a database access error occurs
1562 * @since 1.2
1563 */
1564 public void updateTime(int columnIndex, java.sql.Time x) throws SQLException {
1565 resultSet.updateTime(columnIndex, x);
1566 }
1567
1568 /**
1569 * Updates the designated column with a <code>java.sql.Timestamp</code>
1570 * value.
1571 * The updater methods are used to update column values in the
1572 * current row or the insert row. The updater methods do not
1573 * update the underlying database; instead the <code>updateRow</code> or
1574 * <code>insertRow</code> methods are called to update the database.
1575 *
1576 * @param columnIndex the first column is 1, the second is 2, ...
1577 * @param x the new column value
1578 * @exception SQLException if a database access error occurs
1579 * @since 1.2
1580 */
1581 public void updateTimestamp(int columnIndex, java.sql.Timestamp x)
1582 throws SQLException {
1583 resultSet.updateTimestamp(columnIndex, x);
1584 }
1585
1586 /**
1587 * Updates the designated column with an ascii stream value.
1588 * The updater methods are used to update column values in the
1589 * current row or the insert row. The updater methods do not
1590 * update the underlying database; instead the <code>updateRow</code> or
1591 * <code>insertRow</code> methods are called to update the database.
1592 *
1593 * @param columnIndex the first column is 1, the second is 2, ...
1594 * @param x the new column value
1595 * @param length the length of the stream
1596 * @exception SQLException if a database access error occurs
1597 * @since 1.2
1598 */
1599 public void updateAsciiStream(int columnIndex,
1600 java.io.InputStream x,
1601 int length) throws SQLException {
1602 resultSet.updateAsciiStream(columnIndex, x, length);
1603 }
1604
1605 /**
1606 * Updates the designated column with a binary stream value.
1607 * The updater methods are used to update column values in the
1608 * current row or the insert row. The updater methods do not
1609 * update the underlying database; instead the <code>updateRow</code> or
1610 * <code>insertRow</code> methods are called to update the database.
1611 *
1612 * @param columnIndex the first column is 1, the second is 2, ...
1613 * @param x the new column value
1614 * @param length the length of the stream
1615 * @exception SQLException if a database access error occurs
1616 * @since 1.2
1617 */
1618 public void updateBinaryStream(int columnIndex,
1619 java.io.InputStream x,
1620 int length) throws SQLException {
1621 resultSet.updateBinaryStream(columnIndex, x, length);
1622 }
1623
1624 /**
1625 * Updates the designated column with a character stream value.
1626 * The updater methods are used to update column values in the
1627 * current row or the insert row. The updater methods do not
1628 * update the underlying database; instead the <code>updateRow</code> or
1629 * <code>insertRow</code> methods are called to update the database.
1630 *
1631 * @param columnIndex the first column is 1, the second is 2, ...
1632 * @param x the new column value
1633 * @param length the length of the stream
1634 * @exception SQLException if a database access error occurs
1635 * @since 1.2
1636 */
1637 public void updateCharacterStream(int columnIndex,
1638 java.io.Reader x,
1639 int length) throws SQLException {
1640 resultSet.updateCharacterStream(columnIndex, x, length);
1641 }
1642
1643 /**
1644 * Updates the designated column with an <code>Object</code> value.
1645 * The updater methods are used to update column values in the
1646 * current row or the insert row. The updater methods do not
1647 * update the underlying database; instead the <code>updateRow</code> or
1648 * <code>insertRow</code> methods are called to update the database.
1649 *
1650 * @param columnIndex the first column is 1, the second is 2, ...
1651 * @param x the new column value
1652 * @param scale for <code>java.sql.Types.DECIMA</code>
1653 * or <code>java.sql.Types.NUMERIC</code> types,
1654 * this is the number of digits after the decimal point. For all other
1655 * types this value will be ignored.
1656 * @exception SQLException if a database access error occurs
1657 * @since 1.2
1658 */
1659 public void updateObject(int columnIndex, Object x, int scale)
1660 throws SQLException {
1661 resultSet.updateObject(columnIndex, x, scale);
1662 }
1663
1664 /**
1665 * Updates the designated column with an <code>Object</code> value.
1666 * The updater methods are used to update column values in the
1667 * current row or the insert row. The updater methods do not
1668 * update the underlying database; instead the <code>updateRow</code> or
1669 * <code>insertRow</code> methods are called to update the database.
1670 *
1671 * @param columnIndex the first column is 1, the second is 2, ...
1672 * @param x the new column value
1673 * @exception SQLException if a database access error occurs
1674 * @since 1.2
1675 */
1676 public void updateObject(int columnIndex, Object x) throws SQLException {
1677 resultSet.updateObject(columnIndex, x);
1678 }
1679
1680 /**
1681 * Updates the designated column with a <code>null</code> value.
1682 * The updater methods are used to update column values in the
1683 * current row or the insert row. The updater methods do not
1684 * update the underlying database; instead the <code>updateRow</code> or
1685 * <code>insertRow</code> methods are called to update the database.
1686 *
1687 * @param columnName the name of the column
1688 * @exception SQLException if a database access error occurs
1689 * @since 1.2
1690 */
1691 public void updateNull(String columnName) throws SQLException {
1692 resultSet.updateNull(columnName);
1693 }
1694
1695 /**
1696 * Updates the designated column with a <code>boolean</code> value.
1697 * The updater methods are used to update column values in the
1698 * current row or the insert row. The updater methods do not
1699 * update the underlying database; instead the <code>updateRow</code> or
1700 * <code>insertRow</code> methods are called to update the database.
1701 *
1702 * @param columnName the name of the column
1703 * @param x the new column value
1704 * @exception SQLException if a database access error occurs
1705 * @since 1.2
1706 */
1707 public void updateBoolean(String columnName, boolean x) throws SQLException {
1708 resultSet.updateBoolean(columnName, x);
1709 }
1710
1711 /**
1712 * Updates the designated column with a <code>byte</code> value.
1713 * The updater methods are used to update column values in the
1714 * current row or the insert row. The updater methods do not
1715 * update the underlying database; instead the <code>updateRow</code> or
1716 * <code>insertRow</code> methods are called to update the database.
1717 *
1718 * @param columnName the name of the column
1719 * @param x the new column value
1720 * @exception SQLException if a database access error occurs
1721 * @since 1.2
1722 */
1723 public void updateByte(String columnName, byte x) throws SQLException {
1724 resultSet.updateByte(columnName, x);
1725 }
1726
1727 /**
1728 * Updates the designated column with a <code>short</code> value.
1729 * The updater methods are used to update column values in the
1730 * current row or the insert row. The updater methods do not
1731 * update the underlying database; instead the <code>updateRow</code> or
1732 * <code>insertRow</code> methods are called to update the database.
1733 *
1734 * @param columnName the name of the column
1735 * @param x the new column value
1736 * @exception SQLException if a database access error occurs
1737 * @since 1.2
1738 */
1739 public void updateShort(String columnName, short x) throws SQLException {
1740 resultSet.updateShort(columnName, x);
1741 }
1742
1743 /**
1744 * Updates the designated column with an <code>int</code> value.
1745 * The updater methods are used to update column values in the
1746 * current row or the insert row. The updater methods do not
1747 * update the underlying database; instead the <code>updateRow</code> or
1748 * <code>insertRow</code> methods are called to update the database.
1749 *
1750 * @param columnName the name of the column
1751 * @param x the new column value
1752 * @exception SQLException if a database access error occurs
1753 * @since 1.2
1754 */
1755 public void updateInt(String columnName, int x) throws SQLException {
1756 resultSet.updateInt(columnName, x);
1757 }
1758
1759 /**
1760 * Updates the designated column with a <code>long</code> value.
1761 * The updater methods are used to update column values in the
1762 * current row or the insert row. The updater methods do not
1763 * update the underlying database; instead the <code>updateRow</code> or
1764 * <code>insertRow</code> methods are called to update the database.
1765 *
1766 * @param columnName the name of the column
1767 * @param x the new column value
1768 * @exception SQLException if a database access error occurs
1769 * @since 1.2
1770 */
1771 public void updateLong(String columnName, long x) throws SQLException {
1772 resultSet.updateLong(columnName, x);
1773 }
1774
1775 /**
1776 * Updates the designated column with a <code>float </code> value.
1777 * The updater methods are used to update column values in the
1778 * current row or the insert row. The updater methods do not
1779 * update the underlying database; instead the <code>updateRow</code> or
1780 * <code>insertRow</code> methods are called to update the database.
1781 *
1782 * @param columnName the name of the column
1783 * @param x the new column value
1784 * @exception SQLException if a database access error occurs
1785 * @since 1.2
1786 */
1787 public void updateFloat(String columnName, float x) throws SQLException {
1788 resultSet.updateFloat(columnName, x);
1789 }
1790
1791 /**
1792 * Updates the designated column with a <code>double</code> value.
1793 * The updater methods are used to update column values in the
1794 * current row or the insert row. The updater methods do not
1795 * update the underlying database; instead the <code>updateRow</code> or
1796 * <code>insertRow</code> methods are called to update the database.
1797 *
1798 * @param columnName the name of the column
1799 * @param x the new column value
1800 * @exception SQLException if a database access error occurs
1801 * @since 1.2
1802 */
1803 public void updateDouble(String columnName, double x) throws SQLException {
1804 resultSet.updateDouble(columnName, x);
1805 }
1806
1807 /**
1808 * Updates the designated column with a <code>java.sql.BigDecimal</code>
1809 * value.
1810 * The updater methods are used to update column values in the
1811 * current row or the insert row. The updater methods do not
1812 * update the underlying database; instead the <code>updateRow</code> or
1813 * <code>insertRow</code> methods are called to update the database.
1814 *
1815 * @param columnName the name of the column
1816 * @param x the new column value
1817 * @exception SQLException if a database access error occurs
1818 * @since 1.2
1819 */
1820 public void updateBigDecimal(String columnName, BigDecimal x) throws SQLException {
1821 resultSet.updateBigDecimal(columnName, x);
1822 }
1823
1824 /**
1825 * Updates the designated column with a <code>String</code> value.
1826 * The updater methods are used to update column values in the
1827 * current row or the insert row. The updater methods do not
1828 * update the underlying database; instead the <code>updateRow</code> or
1829 * <code>insertRow</code> methods are called to update the database.
1830 *
1831 * @param columnName the name of the column
1832 * @param x the new column value
1833 * @exception SQLException if a database access error occurs
1834 * @since 1.2
1835 */
1836 public void updateString(String columnName, String x) throws SQLException {
1837 resultSet.updateString(columnName, x);
1838 }
1839
1840 /**
1841 * Updates the designated column with a byte array value.
1842 *
1843 * The updater methods are used to update column values in the
1844 * current row or the insert row. The updater methods do not
1845 * update the underlying database; instead the <code>updateRow</code>
1846 * or <code>insertRow</code> methods are called to update the database.
1847 *
1848 * @param columnName the name of the column
1849 * @param x the new column value
1850 * @exception SQLException if a database access error occurs
1851 * @since 1.2
1852 */
1853 public void updateBytes(String columnName, byte x[]) throws SQLException {
1854 resultSet.updateBytes(columnName, x);
1855 }
1856
1857 /**
1858 * Updates the designated column with a <code>java.sql.Date</code> value.
1859 * The updater methods are used to update column values in the
1860 * current row or the insert row. The updater methods do not
1861 * update the underlying database; instead the <code>updateRow</code> or
1862 * <code>insertRow</code> methods are called to update the database.
1863 *
1864 * @param columnName the name of the column
1865 * @param x the new column value
1866 * @exception SQLException if a database access error occurs
1867 * @since 1.2
1868 */
1869 public void updateDate(String columnName, java.sql.Date x) throws SQLException {
1870 resultSet.updateDate(columnName, x);
1871 }
1872
1873 /**
1874 * Updates the designated column with a <code>java.sql.Time</code> value.
1875 * The updater methods are used to update column values in the
1876 * current row or the insert row. The updater methods do not
1877 * update the underlying database; instead the <code>updateRow</code> or
1878 * <code>insertRow</code> methods are called to update the database.
1879 *
1880 * @param columnName the name of the column
1881 * @param x the new column value
1882 * @exception SQLException if a database access error occurs
1883 * @since 1.2
1884 */
1885 public void updateTime(String columnName, java.sql.Time x) throws SQLException {
1886 resultSet.updateTime(columnName, x);
1887 }
1888
1889 /**
1890 * Updates the designated column with a <code>java.sql.Timestamp</code>
1891 * value.
1892 * The updater methods are used to update column values in the
1893 * current row or the insert row. The updater methods do not
1894 * update the underlying database; instead the <code>updateRow</code> or
1895 * <code>insertRow</code> methods are called to update the database.
1896 *
1897 * @param columnName the name of the column
1898 * @param x the new column value
1899 * @exception SQLException if a database access error occurs
1900 * @since 1.2
1901 */
1902 public void updateTimestamp(String columnName, java.sql.Timestamp x)
1903 throws SQLException {
1904 resultSet.updateTimestamp(columnName, x);
1905 }
1906
1907 /**
1908 * Updates the designated column with an ascii stream value.
1909 * The updater methods are used to update column values in the
1910 * current row or the insert row. The updater methods do not
1911 * update the underlying database; instead the <code>updateRow</code> or
1912 * <code>insertRow</code> methods are called to update the database.
1913 *
1914 * @param columnName the name of the column
1915 * @param x the new column value
1916 * @param length the length of the stream
1917 * @exception SQLException if a database access error occurs
1918 * @since 1.2
1919 */
1920 public void updateAsciiStream(String columnName,
1921 java.io.InputStream x,
1922 int length) throws SQLException {
1923 resultSet.updateAsciiStream(columnName, x, length);
1924 }
1925
1926 /**
1927 * Updates the designated column with a binary stream value.
1928 * The updater methods are used to update column values in the
1929 * current row or the insert row. The updater methods do not
1930 * update the underlying database; instead the <code>updateRow</code> or
1931 * <code>insertRow</code> methods are called to update the database.
1932 *
1933 * @param columnName the name of the column
1934 * @param x the new column value
1935 * @param length the length of the stream
1936 * @exception SQLException if a database access error occurs
1937 * @since 1.2
1938 */
1939 public void updateBinaryStream(String columnName,
1940 java.io.InputStream x,
1941 int length) throws SQLException {
1942 resultSet.updateBinaryStream(columnName, x, length);
1943 }
1944
1945 /**
1946 * Updates the designated column with a character stream value.
1947 * The updater methods are used to update column values in the
1948 * current row or the insert row. The updater methods do not
1949 * update the underlying database; instead the <code>updateRow</code> or
1950 * <code>insertRow</code> methods are called to update the database.
1951 *
1952 * @param columnName the name of the column
1953 * @param reader the <code>java.io.Reader</code> object containing
1954 * the new column value
1955 * @param length the length of the stream
1956 * @exception SQLException if a database access error occurs
1957 * @since 1.2
1958 */
1959 public void updateCharacterStream(String columnName,
1960 java.io.Reader reader,
1961 int length) throws SQLException {
1962 resultSet.updateCharacterStream(columnName, reader, length);
1963 }
1964
1965 /**
1966 * Updates the designated column with an <code>Object</code> value.
1967 * The updater methods are used to update column values in the
1968 * current row or the insert row. The updater methods do not
1969 * update the underlying database; instead the <code>updateRow</code> or
1970 * <code>insertRow</code> methods are called to update the database.
1971 *
1972 * @param columnName the name of the column
1973 * @param x the new column value
1974 * @param scale for <code>java.sql.Types.DECIMAL</code>
1975 * or <code>java.sql.Types.NUMERIC</code> types,
1976 * this is the number of digits after the decimal point. For all other
1977 * types this value will be ignored.
1978 * @exception SQLException if a database access error occurs
1979 * @since 1.2
1980 */
1981 public void updateObject(String columnName, Object x, int scale)
1982 throws SQLException {
1983 resultSet.updateObject(columnName, x, scale);
1984 }
1985
1986 /**
1987 * Updates the designated column with an <code>Object</code> value.
1988 * The updater methods are used to update column values in the
1989 * current row or the insert row. The updater methods do not
1990 * update the underlying database; instead the <code>updateRow</code> or
1991 * <code>insertRow</code> methods are called to update the database.
1992 *
1993 * @param columnName the name of the column
1994 * @param x the new column value
1995 * @exception SQLException if a database access error occurs
1996 * @since 1.2
1997 */
1998 public void updateObject(String columnName, Object x) throws SQLException {
1999 resultSet.updateObject(columnName, x);
2000 }
2001
2002 /**
2003 * Inserts the contents of the insert row into this
2004 * <code>ResultSet</code> object and into the database.
2005 * The cursor must be on the insert row when this method is called.
2006 *
2007 * @exception SQLException if a database access error occurs,
2008 * if this method is called when the cursor is not on the insert row,
2009 * or if not all of non-nullable columns in
2010 * the insert row have been given a value
2011 * @since 1.2
2012 */
2013 public void insertRow() throws SQLException {
2014 resultSet.insertRow();
2015 }
2016
2017 /**
2018 * Updates the underlying database with the new contents of the
2019 * current row of this <code>ResultSet</code> object.
2020 * This method cannot be called when the cursor is on the insert row.
2021 *
2022 * @exception SQLException if a database access error occurs or
2023 * if this method is called when the cursor is on the insert row
2024 * @since 1.2
2025 */
2026 public void updateRow() throws SQLException {
2027 resultSet.updateRow();
2028 }
2029
2030 /**
2031 * Deletes the current row from this <code>ResultSet</code> object
2032 * and from the underlying database. This method cannot be called when
2033 * the cursor is on the insert row.
2034 *
2035 * @exception SQLException if a database access error occurs
2036 * or if this method is called when the cursor is on the insert row
2037 * @since 1.2
2038 */
2039 public void deleteRow() throws SQLException {
2040 resultSet.deleteRow();
2041 }
2042
2043 /**
2044 * Refreshes the current row with its most recent value in
2045 * the database. This method cannot be called when
2046 * the cursor is on the insert row.
2047 *
2048 * <P>The <code>refreshRow</code> method provides a way for an
2049 * application to
2050 * explicitly tell the JDBC driver to refetch a row(s) from the
2051 * database. An application may want to call <code>refreshRow</code> when
2052 * caching or prefetching is being done by the JDBC driver to
2053 * fetch the latest value of a row from the database. The JDBC driver
2054 * may actually refresh multiple rows at once if the fetch size is
2055 * greater than one.
2056 *
2057 * <P> All values are refetched subject to the transaction isolation
2058 * level and cursor sensitivity. If <code>refreshRow</code> is called after
2059 * calling an updater method, but before calling
2060 * the method <code>updateRow</code>, then the
2061 * updates made to the row are lost. Calling the method
2062 * <code>refreshRow</code> frequently will likely slow performance.
2063 *
2064 * @exception SQLException if a database access error
2065 * occurs or if this method is called when the cursor is on the insert row
2066 * @since 1.2
2067 */
2068 public void refreshRow() throws SQLException {
2069 resultSet.refreshRow();
2070 }
2071
2072 /**
2073 * Cancels the updates made to the current row in this
2074 * <code>ResultSet</code> object.
2075 * This method may be called after calling an
2076 * updater method(s) and before calling
2077 * the method <code>updateRow</code> to roll back
2078 * the updates made to a row. If no updates have been made or
2079 * <code>updateRow</code> has already been called, this method has no
2080 * effect.
2081 *
2082 * @exception SQLException if a database access error
2083 * occurs or if this method is called when the cursor is
2084 * on the insert row
2085 * @since 1.2
2086 */
2087 public void cancelRowUpdates() throws SQLException {
2088 resultSet.cancelRowUpdates();
2089 }
2090
2091 /**
2092 * Moves the cursor to the insert row. The current cursor position is
2093 * remembered while the cursor is positioned on the insert row.
2094 *
2095 * The insert row is a special row associated with an updatable
2096 * result set. It is essentially a buffer where a new row may
2097 * be constructed by calling the updater methods prior to
2098 * inserting the row into the result set.
2099 *
2100 * Only the updater, getter,
2101 * and <code>insertRow</code> methods may be
2102 * called when the cursor is on the insert row. All of the columns in
2103 * a result set must be given a value each time this method is
2104 * called before calling <code>insertRow</code>.
2105 * An updater method must be called before a
2106 * getter method can be called on a column value.
2107 *
2108 * @exception SQLException if a database access error occurs
2109 * or the result set is not updatable
2110 * @since 1.2
2111 */
2112 public void moveToInsertRow() throws SQLException {
2113 resultSet.moveToInsertRow();
2114 }
2115
2116 /**
2117 * Moves the cursor to the remembered cursor position, usually the
2118 * current row. This method has no effect if the cursor is not on
2119 * the insert row.
2120 *
2121 * @exception SQLException if a database access error occurs
2122 * or the result set is not updatable
2123 * @since 1.2
2124 */
2125 public void moveToCurrentRow() throws SQLException {
2126 resultSet.moveToCurrentRow();
2127 }
2128
2129 /**
2130 * Retrieves the <code>Statement</code> object that produced this
2131 * <code>ResultSet</code> object.
2132 * If the result set was generated some other way, such as by a
2133 * <code>DatabaseMetaData</code> method, this method returns
2134 * <code>null</code>.
2135 *
2136 * @return the <code>Statment</code> object that produced
2137 * this <code>ResultSet</code> object or <code>null</code>
2138 * if the result set was produced some other way
2139 * @exception SQLException if a database access error occurs
2140 * @since 1.2
2141 */
2142 public Statement getStatement() throws SQLException {
2143 return resultSet.getStatement();
2144 }
2145
2146 /**
2147 * Retrieves the value of the designated column in the current row
2148 * of this <code>ResultSet</code> object as an <code>Object</code>
2149 * in the Java programming language.
2150 * If the value is an SQL <code>NULL</code>,
2151 * the driver returns a Java <code>null</code>.
2152 * This method uses the given <code>Map</code> object
2153 * for the custom mapping of the
2154 * SQL structured or distinct type that is being retrieved.
2155 *
2156 * @param i the first column is 1, the second is 2, ...
2157 * @param map a <code>java.util.Map</code> object that contains the mapping
2158 * from SQL type names to classes in the Java programming language
2159 * @return an <code>Object</code> in the Java programming language
2160 * representing the SQL value
2161 * @exception SQLException if a database access error occurs
2162 * @since 1.2
2163 */
2164 public Object getObject(int i, java.util.Map map) throws SQLException {
2165 return resultSet.getObject(i, map);
2166 }
2167
2168 /**
2169 * Retrieves the value of the designated column in the current row
2170 * of this <code>ResultSet</code> object as a <code>Ref</code> object
2171 * in the Java programming language.
2172 *
2173 * @param i the first column is 1, the second is 2, ...
2174 * @return a <code>Ref</code> object representing an SQL <code>REF</code>
2175 * value
2176 * @exception SQLException if a database access error occurs
2177 * @since 1.2
2178 */
2179 public Ref getRef(int i) throws SQLException {
2180 return resultSet.getRef(i);
2181 }
2182
2183 /**
2184 * Retrieves the value of the designated column in the current row
2185 * of this <code>ResultSet</code> object as a <code>Blob</code> object
2186 * in the Java programming language.
2187 *
2188 * @param i the first column is 1, the second is 2, ...
2189 * @return a <code>Blob</code> object representing the SQL
2190 * <code>BLOB</code> value in the specified column
2191 * @exception SQLException if a database access error occurs
2192 * @since 1.2
2193 */
2194 public Blob getBlob(int i) throws SQLException {
2195 return resultSet.getBlob(i);
2196 }
2197
2198 /**
2199 * Retrieves the value of the designated column in the current row
2200 * of this <code>ResultSet</code> object as a <code>Clob</code> object
2201 * in the Java programming language.
2202 *
2203 * @param i the first column is 1, the second is 2, ...
2204 * @return a <code>Clob</code> object representing the SQL
2205 * <code>CLOB</code> value in the specified column
2206 * @exception SQLException if a database access error occurs
2207 * @since 1.2
2208 */
2209 public Clob getClob(int i) throws SQLException {
2210 return resultSet.getClob(i);
2211 }
2212
2213 /**
2214 * Retrieves the value of the designated column in the current row
2215 * of this <code>ResultSet</code> object as an <code>Array</code> object
2216 * in the Java programming language.
2217 *
2218 * @param i the first column is 1, the second is 2, ...
2219 * @return an <code>Array</code> object representing the SQL
2220 * <code>ARRAY</code> value in the specified column
2221 * @exception SQLException if a database access error occurs
2222 * @since 1.2
2223 */
2224 public Array getArray(int i) throws SQLException {
2225 return resultSet.getArray(i);
2226 }
2227
2228 /**
2229 * Retrieves the value of the designated column in the current row
2230 * of this <code>ResultSet</code> object as an <code>Object</code>
2231 * in the Java programming language.
2232 * If the value is an SQL <code>NULL</code>,
2233 * the driver returns a Java <code>null</code>.
2234 * This method uses the specified <code>Map</code> object for
2235 * custom mapping if appropriate.
2236 *
2237 * @param colName the name of the column from which to retrieve the value
2238 * @param map a <code>java.util.Map</code> object that contains the mapping
2239 * from SQL type names to classes in the Java programming language
2240 * @return an <code>Object</code> representing the SQL value in the
2241 * specified column
2242 * @exception SQLException if a database access error occurs
2243 * @since 1.2
2244 */
2245 public Object getObject(String colName, java.util.Map map) throws SQLException {
2246 return resultSet.getObject(colName, map);
2247 }
2248
2249 /**
2250 * Retrieves the value of the designated column in the current row
2251 * of this <code>ResultSet</code> object as a <code>Ref</code> object
2252 * in the Java programming language.
2253 *
2254 * @param colName the column name
2255 * @return a <code>Ref</code> object representing the SQL <code>REF</code>
2256 * value in the specified column
2257 * @exception SQLException if a database access error occurs
2258 * @since 1.2
2259 */
2260 public Ref getRef(String colName) throws SQLException {
2261 return resultSet.getRef(colName);
2262 }
2263
2264 /**
2265 * Retrieves the value of the designated column in the current row
2266 * of this <code>ResultSet</code> object as a <code>Blob</code> object
2267 * in the Java programming language.
2268 *
2269 * @param colName the name of the column from which to retrieve the value
2270 * @return a <code>Blob</code> object representing the SQL <code>BLOB</code>
2271 * value in the specified column
2272 * @exception SQLException if a database access error occurs
2273 * @since 1.2
2274 */
2275 public Blob getBlob(String colName) throws SQLException {
2276 return resultSet.getBlob(colName);
2277 }
2278
2279 /**
2280 * Retrieves the value of the designated column in the current row
2281 * of this <code>ResultSet</code> object as a <code>Clob</code> object
2282 * in the Java programming language.
2283 *
2284 * @param colName the name of the column from which to retrieve the value
2285 * @return a <code>Clob</code> object representing the SQL <code>CLOB</code>
2286 * value in the specified column
2287 * @exception SQLException if a database access error occurs
2288 * @since 1.2
2289 */
2290 public Clob getClob(String colName) throws SQLException {
2291 return resultSet.getClob(colName);
2292 }
2293
2294 /**
2295 * Retrieves the value of the designated column in the current row
2296 * of this <code>ResultSet</code> object as an <code>Array</code> object
2297 * in the Java programming language.
2298 *
2299 * @param colName the name of the column from which to retrieve the value
2300 * @return an <code>Array</code> object representing the SQL <code>ARRAY</code> value in
2301 * the specified column
2302 * @exception SQLException if a database access error occurs
2303 * @since 1.2
2304 */
2305 public Array getArray(String colName) throws SQLException {
2306 return resultSet.getArray(colName);
2307 }
2308
2309 /**
2310 * Retrieves the value of the designated column in the current row
2311 * of this <code>ResultSet</code> object as a <code>java.sql.Date</code> object
2312 * in the Java programming language.
2313 * This method uses the given calendar to construct an appropriate millisecond
2314 * value for the date if the underlying database does not store
2315 * timezone information.
2316 *
2317 * @param columnIndex the first column is 1, the second is 2, ...
2318 * @param cal the <code>java.util.Calendar</code> object
2319 * to use in constructing the date
2320 * @return the column value as a <code>java.sql.Date</code> object;
2321 * if the value is SQL <code>NULL</code>,
2322 * the value returned is <code>null</code> in the Java programming language
2323 * @exception SQLException if a database access error occurs
2324 * @since 1.2
2325 */
2326 public java.sql.Date getDate(int columnIndex, Calendar cal) throws SQLException {
2327 return resultSet.getDate(columnIndex, cal);
2328 }
2329
2330 /**
2331 * Retrieves the value of the designated column in the current row
2332 * of this <code>ResultSet</code> object as a <code>java.sql.Date</code> object
2333 * in the Java programming language.
2334 * This method uses the given calendar to construct an appropriate millisecond
2335 * value for the date if the underlying database does not store
2336 * timezone information.
2337 *
2338 * @param columnName the SQL name of the column from which to retrieve the value
2339 * @param cal the <code>java.util.Calendar</code> object
2340 * to use in constructing the date
2341 * @return the column value as a <code>java.sql.Date</code> object;
2342 * if the value is SQL <code>NULL</code>,
2343 * the value returned is <code>null</code> in the Java programming language
2344 * @exception SQLException if a database access error occurs
2345 * @since 1.2
2346 */
2347 public java.sql.Date getDate(String columnName, Calendar cal) throws SQLException {
2348 return resultSet.getDate(columnName, cal);
2349 }
2350
2351 /**
2352 * Retrieves the value of the designated column in the current row
2353 * of this <code>ResultSet</code> object as a <code>java.sql.Time</code> object
2354 * in the Java programming language.
2355 * This method uses the given calendar to construct an appropriate millisecond
2356 * value for the time if the underlying database does not store
2357 * timezone information.
2358 *
2359 * @param columnIndex the first column is 1, the second is 2, ...
2360 * @param cal the <code>java.util.Calendar</code> object
2361 * to use in constructing the time
2362 * @return the column value as a <code>java.sql.Time</code> object;
2363 * if the value is SQL <code>NULL</code>,
2364 * the value returned is <code>null</code> in the Java programming language
2365 * @exception SQLException if a database access error occurs
2366 * @since 1.2
2367 */
2368 public java.sql.Time getTime(int columnIndex, Calendar cal) throws SQLException {
2369 return resultSet.getTime(columnIndex, cal);
2370 }
2371
2372 /**
2373 * Retrieves the value of the designated column in the current row
2374 * of this <code>ResultSet</code> object as a <code>java.sql.Time</code> object
2375 * in the Java programming language.
2376 * This method uses the given calendar to construct an appropriate millisecond
2377 * value for the time if the underlying database does not store
2378 * timezone information.
2379 *
2380 * @param columnName the SQL name of the column
2381 * @param cal the <code>java.util.Calendar</code> object
2382 * to use in constructing the time
2383 * @return the column value as a <code>java.sql.Time</code> object;
2384 * if the value is SQL <code>NULL</code>,
2385 * the value returned is <code>null</code> in the Java programming language
2386 * @exception SQLException if a database access error occurs
2387 * @since 1.2
2388 */
2389 public java.sql.Time getTime(String columnName, Calendar cal) throws SQLException {
2390 return resultSet.getTime(columnName, cal);
2391 }
2392
2393 /**
2394 * Retrieves the value of the designated column in the current row
2395 * of this <code>ResultSet</code> object as a <code>java.sql.Timestamp</code> object
2396 * in the Java programming language.
2397 * This method uses the given calendar to construct an appropriate millisecond
2398 * value for the timestamp if the underlying database does not store
2399 * timezone information.
2400 *
2401 * @param columnIndex the first column is 1, the second is 2, ...
2402 * @param cal the <code>java.util.Calendar</code> object
2403 * to use in constructing the timestamp
2404 * @return the column value as a <code>java.sql.Timestamp</code> object;
2405 * if the value is SQL <code>NULL</code>,
2406 * the value returned is <code>null</code> in the Java programming language
2407 * @exception SQLException if a database access error occurs
2408 * @since 1.2
2409 */
2410 public java.sql.Timestamp getTimestamp(int columnIndex, Calendar cal)
2411 throws SQLException {
2412 return resultSet.getTimestamp(columnIndex, cal);
2413 }
2414
2415 /**
2416 * Retrieves the value of the designated column in the current row
2417 * of this <code>ResultSet</code> object as a <code>java.sql.Timestamp</code> object
2418 * in the Java programming language.
2419 * This method uses the given calendar to construct an appropriate millisecond
2420 * value for the timestamp if the underlying database does not store
2421 * timezone information.
2422 *
2423 * @param columnName the SQL name of the column
2424 * @param cal the <code>java.util.Calendar</code> object
2425 * to use in constructing the date
2426 * @return the column value as a <code>java.sql.Timestamp</code> object;
2427 * if the value is SQL <code>NULL</code>,
2428 * the value returned is <code>null</code> in the Java programming language
2429 * @exception SQLException if a database access error occurs
2430 * @since 1.2
2431 */
2432 public java.sql.Timestamp getTimestamp(String columnName, Calendar cal)
2433 throws SQLException {
2434 return resultSet.getTimestamp(columnName, cal);
2435 }
2436
2437 //-------------------------- JDBC 3.0 ----------------------------------------
2438
2439 /**
2440 * Retrieves the value of the designated column in the current row
2441 * of this <code>ResultSet</code> object as a <code>java.net.URL</code>
2442 * object in the Java programming language.
2443 *
2444 * @param columnIndex the index of the column 1 is the first, 2 is the second,...
2445 * @return the column value as a <code>java.net.URL</code> object;
2446 * if the value is SQL <code>NULL</code>,
2447 * the value returned is <code>null</code> in the Java programming language
2448 * @exception SQLException if a database access error occurs,
2449 * or if a URL is malformed
2450 * @since 1.4
2451 */
2452 public java.net.URL getURL(int columnIndex) throws SQLException {
2453 return resultSet.getURL(columnIndex);
2454 }
2455
2456 /**
2457 * Retrieves the value of the designated column in the current row
2458 * of this <code>ResultSet</code> object as a <code>java.net.URL</code>
2459 * object in the Java programming language.
2460 *
2461 * @param columnName the SQL name of the column
2462 * @return the column value as a <code>java.net.URL</code> object;
2463 * if the value is SQL <code>NULL</code>,
2464 * the value returned is <code>null</code> in the Java programming language
2465 * @exception SQLException if a database access error occurs
2466 * or if a URL is malformed
2467 * @since 1.4
2468 */
2469 public java.net.URL getURL(String columnName) throws SQLException {
2470 return resultSet.getURL(columnName);
2471 }
2472
2473 /**
2474 * Updates the designated column with a <code>java.sql.Ref</code> value.
2475 * The updater methods are used to update column values in the
2476 * current row or the insert row. The updater methods do not
2477 * update the underlying database; instead the <code>updateRow</code> or
2478 * <code>insertRow</code> methods are called to update the database.
2479 *
2480 * @param columnIndex the first column is 1, the second is 2, ...
2481 * @param x the new column value
2482 * @exception SQLException if a database access error occurs
2483 * @since 1.4
2484 */
2485 public void updateRef(int columnIndex, java.sql.Ref x) throws SQLException {
2486 resultSet.updateRef(columnIndex, x);
2487 }
2488
2489 /**
2490 * Updates the designated column with a <code>java.sql.Ref</code> value.
2491 * The updater methods are used to update column values in the
2492 * current row or the insert row. The updater methods do not
2493 * update the underlying database; instead the <code>updateRow</code> or
2494 * <code>insertRow</code> methods are called to update the database.
2495 *
2496 * @param columnName the name of the column
2497 * @param x the new column value
2498 * @exception SQLException if a database access error occurs
2499 * @since 1.4
2500 */
2501 public void updateRef(String columnName, java.sql.Ref x) throws SQLException {
2502 resultSet.updateRef(columnName, x);
2503 }
2504
2505 /**
2506 * Updates the designated column with a <code>java.sql.Blob</code> value.
2507 * The updater methods are used to update column values in the
2508 * current row or the insert row. The updater methods do not
2509 * update the underlying database; instead the <code>updateRow</code> or
2510 * <code>insertRow</code> methods are called to update the database.
2511 *
2512 * @param columnIndex the first column is 1, the second is 2, ...
2513 * @param x the new column value
2514 * @exception SQLException if a database access error occurs
2515 * @since 1.4
2516 */
2517 public void updateBlob(int columnIndex, java.sql.Blob x) throws SQLException {
2518 resultSet.updateBlob(columnIndex, x);
2519 }
2520
2521 /**
2522 * Updates the designated column with a <code>java.sql.Blob</code> value.
2523 * The updater methods are used to update column values in the
2524 * current row or the insert row. The updater methods do not
2525 * update the underlying database; instead the <code>updateRow</code> or
2526 * <code>insertRow</code> methods are called to update the database.
2527 *
2528 * @param columnName the name of the column
2529 * @param x the new column value
2530 * @exception SQLException if a database access error occurs
2531 * @since 1.4
2532 */
2533 public void updateBlob(String columnName, java.sql.Blob x) throws SQLException {
2534 resultSet.updateBlob(columnName, x);
2535 }
2536
2537 /**
2538 * Updates the designated column with a <code>java.sql.Clob</code> value.
2539 * The updater methods are used to update column values in the
2540 * current row or the insert row. The updater methods do not
2541 * update the underlying database; instead the <code>updateRow</code> or
2542 * <code>insertRow</code> methods are called to update the database.
2543 *
2544 * @param columnIndex the first column is 1, the second is 2, ...
2545 * @param x the new column value
2546 * @exception SQLException if a database access error occurs
2547 * @since 1.4
2548 */
2549 public void updateClob(int columnIndex, java.sql.Clob x) throws SQLException {
2550 resultSet.updateClob(columnIndex, x);
2551 }
2552
2553 /**
2554 * Updates the designated column with a <code>java.sql.Clob</code> value.
2555 * The updater methods are used to update column values in the
2556 * current row or the insert row. The updater methods do not
2557 * update the underlying database; instead the <code>updateRow</code> or
2558 * <code>insertRow</code> methods are called to update the database.
2559 *
2560 * @param columnName the name of the column
2561 * @param x the new column value
2562 * @exception SQLException if a database access error occurs
2563 * @since 1.4
2564 */
2565 public void updateClob(String columnName, java.sql.Clob x) throws SQLException {
2566 resultSet.updateClob(columnName, x);
2567 }
2568
2569 /**
2570 * Updates the designated column with a <code>java.sql.Array</code> value.
2571 * The updater methods are used to update column values in the
2572 * current row or the insert row. The updater methods do not
2573 * update the underlying database; instead the <code>updateRow</code> or
2574 * <code>insertRow</code> methods are called to update the database.
2575 *
2576 * @param columnIndex the first column is 1, the second is 2, ...
2577 * @param x the new column value
2578 * @exception SQLException if a database access error occurs
2579 * @since 1.4
2580 */
2581 public void updateArray(int columnIndex, java.sql.Array x) throws SQLException {
2582 resultSet.updateArray(columnIndex, x);
2583 }
2584
2585 /**
2586 * Updates the designated column with a <code>java.sql.Array</code> value.
2587 * The updater methods are used to update column values in the
2588 * current row or the insert row. The updater methods do not
2589 * update the underlying database; instead the <code>updateRow</code> or
2590 * <code>insertRow</code> methods are called to update the database.
2591 *
2592 * @param columnName the name of the column
2593 * @param x the new column value
2594 * @exception SQLException if a database access error occurs
2595 * @since 1.4
2596 */
2597 public void updateArray(String columnName, java.sql.Array x) throws SQLException {
2598 resultSet.updateArray(columnName, x);
2599 }
2600 }