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