View Javadoc

1   /*
2    * Licensed to the Apache Software Foundation (ASF) under one or more
3    * contributor license agreements.  See the NOTICE file distributed with
4    * this work for additional information regarding copyright ownership.
5    * The ASF licenses this file to You under the Apache License, Version 2.0
6    * (the "License"); you may not use this file except in compliance with
7    * the License.  You may obtain a copy of the License at
8    * 
9    *      http://www.apache.org/licenses/LICENSE-2.0
10   * 
11   * Unless required by applicable law or agreed to in writing, software
12   * distributed under the License is distributed on an "AS IS" BASIS,
13   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14   * See the License for the specific language governing permissions and
15   * limitations under the License.
16   */
17  
18  package org.apache.commons.dbcp;
19  
20  import java.sql.ResultSet;
21  import java.math.BigDecimal;
22  import java.sql.Date;
23  import java.sql.Time;
24  import java.sql.Timestamp;
25  import java.io.InputStream;
26  import java.sql.SQLWarning;
27  import java.sql.ResultSetMetaData;
28  import java.sql.SQLException;
29  import java.io.Reader;
30  import java.sql.Statement;
31  import java.util.Map;
32  import java.sql.Connection;
33  import java.sql.Ref;
34  import java.sql.Blob;
35  import java.sql.Clob;
36  import java.sql.Array;
37  import java.util.Calendar;
38  /* JDBC_4_ANT_KEY_BEGIN */
39  import java.sql.NClob;
40  import java.sql.RowId;
41  import java.sql.SQLXML;
42  /* JDBC_4_ANT_KEY_END */
43  
44  /**
45   * A base delegating implementation of {@link ResultSet}.
46   * <p>
47   * All of the methods from the {@link ResultSet} interface
48   * simply call the corresponding method on the "delegate"
49   * provided in my constructor.
50   * <p>
51   * Extends AbandonedTrace to implement result set tracking and
52   * logging of code which created the ResultSet. Tracking the
53   * ResultSet ensures that the Statment which created it can
54   * close any open ResultSet's on Statement close.
55   *
56   * @author Glenn L. Nielsen
57   * @author James House
58   * @author Dirk Verbeeck
59   * @version $Revision: 745857 $ $Date: 2009-02-19 08:40:35 -0500 (Thu, 19 Feb 2009) $
60   */
61  public class DelegatingResultSet extends AbandonedTrace implements ResultSet {
62  
63      /** My delegate. **/
64      private ResultSet _res;
65  
66      /** The Statement that created me, if any. **/
67      private Statement _stmt;
68  
69      /** The Connection that created me, if any. **/
70      private Connection _conn;
71  
72      /**
73       * Create a wrapper for the ResultSet which traces this
74       * ResultSet to the Statement which created it and the
75       * code which created it.
76       *
77       * @param stmt Statement which created this ResultSet
78       * @param res ResultSet to wrap
79       */
80      public DelegatingResultSet(Statement stmt, ResultSet res) {
81          super((AbandonedTrace)stmt);
82          this._stmt = stmt;
83          this._res = res;
84      }
85      
86      /**
87       * Create a wrapper for the ResultSet which traces this
88       * ResultSet to the Connection which created it (via, for
89       * example DatabaseMetadata, and the code which created it.
90       *
91       * @param conn Connection which created this ResultSet
92       * @param res ResultSet to wrap
93       */
94      public DelegatingResultSet(Connection conn, ResultSet res) {
95          super((AbandonedTrace)conn);
96          this._conn = conn;
97          this._res = res;
98      }
99      
100     public static ResultSet wrapResultSet(Statement stmt, ResultSet rset) {
101         if(null == rset) {
102             return null;
103         } else {
104             return new DelegatingResultSet(stmt,rset);
105         }
106     }
107 
108     public static ResultSet wrapResultSet(Connection conn, ResultSet rset) {
109         if(null == rset) {
110             return null;
111         } else {
112             return new DelegatingResultSet(conn,rset);
113         }
114     }
115 
116     public ResultSet getDelegate() {
117         return _res;
118     }
119 
120     public boolean equals(Object obj) {
121         ResultSet delegate = getInnermostDelegate();
122         if (delegate == null) {
123             return false;
124         }
125         if (obj instanceof DelegatingResultSet) {
126             DelegatingResultSet s = (DelegatingResultSet) obj;
127             return delegate.equals(s.getInnermostDelegate());
128         }
129         else {
130             return delegate.equals(obj);
131         }
132     }
133 
134     public int hashCode() {
135         Object obj = getInnermostDelegate();
136         if (obj == null) {
137             return 0;
138         }
139         return obj.hashCode();
140     }
141 
142     /**
143      * If my underlying {@link ResultSet} is not a
144      * <tt>DelegatingResultSet</tt>, returns it,
145      * otherwise recursively invokes this method on
146      * my delegate.
147      * <p>
148      * Hence this method will return the first
149      * delegate that is not a <tt>DelegatingResultSet</tt>,
150      * or <tt>null</tt> when no non-<tt>DelegatingResultSet</tt>
151      * delegate can be found by transversing this chain.
152      * <p>
153      * This method is useful when you may have nested
154      * <tt>DelegatingResultSet</tt>s, and you want to make
155      * sure to obtain a "genuine" {@link ResultSet}.
156      */
157     public ResultSet getInnermostDelegate() {
158         ResultSet r = _res;
159         while(r != null && r instanceof DelegatingResultSet) {
160             r = ((DelegatingResultSet)r).getDelegate();
161             if(this == r) {
162                 return null;
163             }
164         }
165         return r;
166     }
167     
168     public Statement getStatement() throws SQLException {
169         return _stmt;
170     }
171 
172     /**
173      * Wrapper for close of ResultSet which removes this
174      * result set from being traced then calls close on
175      * the original ResultSet.
176      */
177     public void close() throws SQLException {
178         try {
179             if(_stmt != null) {
180                 ((AbandonedTrace)_stmt).removeTrace(this);
181                 _stmt = null;
182             }
183             if(_conn != null) {
184                 ((AbandonedTrace)_conn).removeTrace(this);
185                 _conn = null;
186             }
187             _res.close();
188         }
189         catch (SQLException e) {
190             handleException(e);
191         }
192     }
193 
194     protected void handleException(SQLException e) throws SQLException {
195         if ((_stmt != null) && (_stmt instanceof DelegatingStatement)) {
196             ((DelegatingStatement)_stmt).handleException(e);
197         }
198         else if ((_conn != null) && (_conn instanceof DelegatingConnection)) {
199             ((DelegatingConnection)_conn).handleException(e);
200         }
201         else {
202             throw e;
203         }
204     }
205 
206     public boolean next() throws SQLException 
207     { try { return _res.next(); } catch (SQLException e) { handleException(e); return false; } }
208 
209     public boolean wasNull() throws SQLException
210     { try { return _res.wasNull(); } catch (SQLException e) { handleException(e); return false; } }
211 
212     public String getString(int columnIndex) throws SQLException
213     { try { return _res.getString(columnIndex); } catch (SQLException e) { handleException(e); return null; } }
214 
215     public boolean getBoolean(int columnIndex) throws SQLException
216     { try { return _res.getBoolean(columnIndex); } catch (SQLException e) { handleException(e); return false; } }
217 
218     public byte getByte(int columnIndex) throws SQLException
219     { try { return _res.getByte(columnIndex); } catch (SQLException e) { handleException(e); return 0; } }
220 
221     public short getShort(int columnIndex) throws SQLException
222     { try { return _res.getShort(columnIndex); } catch (SQLException e) { handleException(e); return 0; } }
223 
224     public int getInt(int columnIndex) throws SQLException
225     { try { return _res.getInt(columnIndex); } catch (SQLException e) { handleException(e); return 0; } }
226 
227     public long getLong(int columnIndex) throws SQLException
228     { try { return _res.getLong(columnIndex); } catch (SQLException e) { handleException(e); return 0; } }
229 
230     public float getFloat(int columnIndex) throws SQLException
231     { try { return _res.getFloat(columnIndex); } catch (SQLException e) { handleException(e); return 0; } }
232 
233     public double getDouble(int columnIndex) throws SQLException
234     { try { return _res.getDouble(columnIndex); } catch (SQLException e) { handleException(e); return 0; } }
235 
236     /** @deprecated */
237     public BigDecimal getBigDecimal(int columnIndex, int scale) throws SQLException
238     { try { return _res.getBigDecimal(columnIndex); } catch (SQLException e) { handleException(e); return null; } }
239 
240     public byte[] getBytes(int columnIndex) throws SQLException
241     { try { return _res.getBytes(columnIndex); } catch (SQLException e) { handleException(e); return null; } }
242 
243     public Date getDate(int columnIndex) throws SQLException
244     { try { return _res.getDate(columnIndex); } catch (SQLException e) { handleException(e); return null; } }
245 
246     public Time getTime(int columnIndex) throws SQLException
247     { try { return _res.getTime(columnIndex); } catch (SQLException e) { handleException(e); return null; } }
248 
249     public Timestamp getTimestamp(int columnIndex) throws SQLException
250     { try { return _res.getTimestamp(columnIndex); } catch (SQLException e) { handleException(e); return null; } }
251 
252     public InputStream getAsciiStream(int columnIndex) throws SQLException
253     { try { return _res.getAsciiStream(columnIndex); } catch (SQLException e) { handleException(e); return null; } }
254 
255     /** @deprecated */
256     public InputStream getUnicodeStream(int columnIndex) throws SQLException
257     { try { return _res.getUnicodeStream(columnIndex); } catch (SQLException e) { handleException(e); return null; } }
258 
259     public InputStream getBinaryStream(int columnIndex) throws SQLException
260     { try { return _res.getBinaryStream(columnIndex); } catch (SQLException e) { handleException(e); return null; } }
261 
262     public String getString(String columnName) throws SQLException
263     { try { return _res.getString(columnName); } catch (SQLException e) { handleException(e); return null; } }
264 
265     public boolean getBoolean(String columnName) throws SQLException
266     { try { return _res.getBoolean(columnName); } catch (SQLException e) { handleException(e); return false; } }
267 
268     public byte getByte(String columnName) throws SQLException
269     { try { return _res.getByte(columnName); } catch (SQLException e) { handleException(e); return 0; } }
270 
271     public short getShort(String columnName) throws SQLException
272     { try { return _res.getShort(columnName); } catch (SQLException e) { handleException(e); return 0; } }
273 
274     public int getInt(String columnName) throws SQLException
275     { try { return _res.getInt(columnName); } catch (SQLException e) { handleException(e); return 0; } }
276 
277     public long getLong(String columnName) throws SQLException
278     { try { return _res.getLong(columnName); } catch (SQLException e) { handleException(e); return 0; } }
279 
280     public float getFloat(String columnName) throws SQLException
281     { try { return _res.getFloat(columnName); } catch (SQLException e) { handleException(e); return 0; } }
282 
283     public double getDouble(String columnName) throws SQLException
284     { try { return _res.getDouble(columnName); } catch (SQLException e) { handleException(e); return 0; } }
285 
286     /** @deprecated */
287     public BigDecimal getBigDecimal(String columnName, int scale) throws SQLException
288     { try { return _res.getBigDecimal(columnName); } catch (SQLException e) { handleException(e); return null; } }
289 
290     public byte[] getBytes(String columnName) throws SQLException
291     { try { return _res.getBytes(columnName); } catch (SQLException e) { handleException(e); return null; } }
292 
293     public Date getDate(String columnName) throws SQLException
294     { try { return _res.getDate(columnName); } catch (SQLException e) { handleException(e); return null; } }
295 
296     public Time getTime(String columnName) throws SQLException
297     { try { return _res.getTime(columnName); } catch (SQLException e) { handleException(e); return null; } }
298 
299     public Timestamp getTimestamp(String columnName) throws SQLException
300     { try { return _res.getTimestamp(columnName); } catch (SQLException e) { handleException(e); return null; } }
301 
302     public InputStream getAsciiStream(String columnName) throws SQLException
303     { try { return _res.getAsciiStream(columnName); } catch (SQLException e) { handleException(e); return null; } }
304 
305     /** @deprecated */
306     public InputStream getUnicodeStream(String columnName) throws SQLException
307     { try { return _res.getUnicodeStream(columnName); } catch (SQLException e) { handleException(e); return null; } }
308 
309     public InputStream getBinaryStream(String columnName) throws SQLException
310     { try { return _res.getBinaryStream(columnName); } catch (SQLException e) { handleException(e); return null; } }
311 
312     public SQLWarning getWarnings() throws SQLException
313     { try { return _res.getWarnings(); } catch (SQLException e) { handleException(e); return null; } }
314 
315     public void clearWarnings() throws SQLException
316     { try { _res.clearWarnings(); } catch (SQLException e) { handleException(e); } }
317 
318     public String getCursorName() throws SQLException
319     { try { return _res.getCursorName(); } catch (SQLException e) { handleException(e); return null; } }
320 
321     public ResultSetMetaData getMetaData() throws SQLException
322     { try { return _res.getMetaData(); } catch (SQLException e) { handleException(e); return null; } }
323 
324     public Object getObject(int columnIndex) throws SQLException
325     { try { return _res.getObject(columnIndex); } catch (SQLException e) { handleException(e); return null; } }
326 
327     public Object getObject(String columnName) throws SQLException
328     { try { return _res.getObject(columnName); } catch (SQLException e) { handleException(e); return null; } }
329 
330     public int findColumn(String columnName) throws SQLException
331     { try { return _res.findColumn(columnName); } catch (SQLException e) { handleException(e); return 0; } }
332 
333     public Reader getCharacterStream(int columnIndex) throws SQLException
334     { try { return _res.getCharacterStream(columnIndex); } catch (SQLException e) { handleException(e); return null; } }
335 
336     public Reader getCharacterStream(String columnName) throws SQLException
337     { try { return _res.getCharacterStream(columnName); } catch (SQLException e) { handleException(e); return null; } }
338 
339     public BigDecimal getBigDecimal(int columnIndex) throws SQLException
340     { try { return _res.getBigDecimal(columnIndex); } catch (SQLException e) { handleException(e); return null; } }
341 
342     public BigDecimal getBigDecimal(String columnName) throws SQLException
343     { try { return _res.getBigDecimal(columnName); } catch (SQLException e) { handleException(e); return null; } }
344 
345     public boolean isBeforeFirst() throws SQLException
346     { try { return _res.isBeforeFirst(); } catch (SQLException e) { handleException(e); return false; } }
347 
348     public boolean isAfterLast() throws SQLException
349     { try { return _res.isAfterLast(); } catch (SQLException e) { handleException(e); return false; } }
350 
351     public boolean isFirst() throws SQLException
352     { try { return _res.isFirst(); } catch (SQLException e) { handleException(e); return false; } }
353 
354     public boolean isLast() throws SQLException
355     { try { return _res.isLast(); } catch (SQLException e) { handleException(e); return false; } }
356 
357     public void beforeFirst() throws SQLException
358     { try { _res.beforeFirst(); } catch (SQLException e) { handleException(e); } }
359 
360     public void afterLast() throws SQLException
361     { try { _res.afterLast(); } catch (SQLException e) { handleException(e); } }
362 
363     public boolean first() throws SQLException
364     { try { return _res.first(); } catch (SQLException e) { handleException(e); return false; } }
365 
366     public boolean last() throws SQLException
367     { try { return _res.last(); } catch (SQLException e) { handleException(e); return false; } }
368 
369     public int getRow() throws SQLException
370     { try { return _res.getRow(); } catch (SQLException e) { handleException(e); return 0; } }
371 
372     public boolean absolute(int row) throws SQLException
373     { try { return _res.absolute(row); } catch (SQLException e) { handleException(e); return false; } }
374 
375     public boolean relative(int rows) throws SQLException
376     { try { return _res.relative(rows); } catch (SQLException e) { handleException(e); return false; } }
377 
378     public boolean previous() throws SQLException
379     { try { return _res.previous(); } catch (SQLException e) { handleException(e); return false; } }
380 
381     public void setFetchDirection(int direction) throws SQLException
382     { try { _res.setFetchDirection(direction); } catch (SQLException e) { handleException(e); } }
383 
384     public int getFetchDirection() throws SQLException
385     { try { return _res.getFetchDirection(); } catch (SQLException e) { handleException(e); return 0; } }
386 
387     public void setFetchSize(int rows) throws SQLException
388     { try { _res.setFetchSize(rows); } catch (SQLException e) { handleException(e); } }
389 
390     public int getFetchSize() throws SQLException
391     { try { return _res.getFetchSize(); } catch (SQLException e) { handleException(e); return 0; } }
392 
393     public int getType() throws SQLException
394     { try { return _res.getType(); } catch (SQLException e) { handleException(e); return 0; } }
395 
396     public int getConcurrency() throws SQLException
397     { try { return _res.getConcurrency(); } catch (SQLException e) { handleException(e); return 0; } }
398 
399     public boolean rowUpdated() throws SQLException
400     { try { return _res.rowUpdated(); } catch (SQLException e) { handleException(e); return false; } }
401 
402     public boolean rowInserted() throws SQLException
403     { try { return _res.rowInserted(); } catch (SQLException e) { handleException(e); return false; } }
404 
405     public boolean rowDeleted() throws SQLException
406     { try { return _res.rowDeleted(); } catch (SQLException e) { handleException(e); return false; } }
407 
408     public void updateNull(int columnIndex) throws SQLException
409     { try { _res.updateNull(columnIndex); } catch (SQLException e) { handleException(e); } }
410 
411     public void updateBoolean(int columnIndex, boolean x) throws SQLException
412     { try { _res.updateBoolean(columnIndex, x); } catch (SQLException e) { handleException(e); } }
413 
414     public void updateByte(int columnIndex, byte x) throws SQLException
415     { try { _res.updateByte(columnIndex, x); } catch (SQLException e) { handleException(e); } }
416 
417     public void updateShort(int columnIndex, short x) throws SQLException
418     { try { _res.updateShort(columnIndex, x); } catch (SQLException e) { handleException(e); } }
419 
420     public void updateInt(int columnIndex, int x) throws SQLException
421     { try { _res.updateInt(columnIndex, x); } catch (SQLException e) { handleException(e); } }
422 
423     public void updateLong(int columnIndex, long x) throws SQLException
424     { try { _res.updateLong(columnIndex, x); } catch (SQLException e) { handleException(e); } }
425 
426     public void updateFloat(int columnIndex, float x) throws SQLException
427     { try { _res.updateFloat(columnIndex, x); } catch (SQLException e) { handleException(e); } }
428 
429     public void updateDouble(int columnIndex, double x) throws SQLException
430     { try { _res.updateDouble(columnIndex, x); } catch (SQLException e) { handleException(e); } }
431 
432     public void updateBigDecimal(int columnIndex, BigDecimal x) throws SQLException
433     { try { _res.updateBigDecimal(columnIndex, x); } catch (SQLException e) { handleException(e); } }
434 
435     public void updateString(int columnIndex, String x) throws SQLException
436     { try { _res.updateString(columnIndex, x); } catch (SQLException e) { handleException(e); } }
437 
438     public void updateBytes(int columnIndex, byte[] x) throws SQLException
439     { try { _res.updateBytes(columnIndex, x); } catch (SQLException e) { handleException(e); } }
440 
441     public void updateDate(int columnIndex, Date x) throws SQLException
442     { try { _res.updateDate(columnIndex, x); } catch (SQLException e) { handleException(e); } }
443 
444     public void updateTime(int columnIndex, Time x) throws SQLException
445     { try { _res.updateTime(columnIndex, x); } catch (SQLException e) { handleException(e); } }
446 
447     public void updateTimestamp(int columnIndex, Timestamp x) throws SQLException
448     { try { _res.updateTimestamp(columnIndex, x); } catch (SQLException e) { handleException(e); } }
449 
450     public void updateAsciiStream(int columnIndex, InputStream x, int length) throws SQLException
451     { try { _res.updateAsciiStream(columnIndex, x, length); } catch (SQLException e) { handleException(e); } }
452 
453     public void updateBinaryStream(int columnIndex, InputStream x, int length) throws SQLException
454     { try { _res.updateBinaryStream(columnIndex, x, length); } catch (SQLException e) { handleException(e); } }
455 
456     public void updateCharacterStream(int columnIndex, Reader x, int length) throws SQLException
457     { try { _res.updateCharacterStream(columnIndex, x, length); } catch (SQLException e) { handleException(e); } }
458 
459     public void updateObject(int columnIndex, Object x, int scale) throws SQLException
460     { try { _res.updateObject(columnIndex, x); } catch (SQLException e) { handleException(e); } }
461 
462     public void updateObject(int columnIndex, Object x) throws SQLException
463     { try { _res.updateObject(columnIndex, x); } catch (SQLException e) { handleException(e); } }
464 
465     public void updateNull(String columnName) throws SQLException
466     { try { _res.updateNull(columnName); } catch (SQLException e) { handleException(e); } }
467 
468     public void updateBoolean(String columnName, boolean x) throws SQLException
469     { try { _res.updateBoolean(columnName, x); } catch (SQLException e) { handleException(e); } }
470 
471     public void updateByte(String columnName, byte x) throws SQLException
472     { try { _res.updateByte(columnName, x); } catch (SQLException e) { handleException(e); } }
473 
474     public void updateShort(String columnName, short x) throws SQLException
475     { try { _res.updateShort(columnName, x); } catch (SQLException e) { handleException(e); } }
476 
477     public void updateInt(String columnName, int x) throws SQLException
478     { try { _res.updateInt(columnName, x); } catch (SQLException e) { handleException(e); } }
479 
480     public void updateLong(String columnName, long x) throws SQLException
481     { try { _res.updateLong(columnName, x); } catch (SQLException e) { handleException(e); } }
482 
483     public void updateFloat(String columnName, float x) throws SQLException
484     { try { _res.updateFloat(columnName, x); } catch (SQLException e) { handleException(e); } }
485 
486     public void updateDouble(String columnName, double x) throws SQLException
487     { try { _res.updateDouble(columnName, x); } catch (SQLException e) { handleException(e); } }
488 
489     public void updateBigDecimal(String columnName, BigDecimal x) throws SQLException
490     { try { _res.updateBigDecimal(columnName, x); } catch (SQLException e) { handleException(e); } }
491 
492     public void updateString(String columnName, String x) throws SQLException
493     { try { _res.updateString(columnName, x); } catch (SQLException e) { handleException(e); } }
494 
495     public void updateBytes(String columnName, byte[] x) throws SQLException
496     { try { _res.updateBytes(columnName, x); } catch (SQLException e) { handleException(e); } }
497 
498     public void updateDate(String columnName, Date x) throws SQLException
499     { try { _res.updateDate(columnName, x); } catch (SQLException e) { handleException(e); } }
500 
501     public void updateTime(String columnName, Time x) throws SQLException
502     { try { _res.updateTime(columnName, x); } catch (SQLException e) { handleException(e); } }
503 
504     public void updateTimestamp(String columnName, Timestamp x) throws SQLException
505     { try { _res.updateTimestamp(columnName, x); } catch (SQLException e) { handleException(e); } }
506 
507     public void updateAsciiStream(String columnName, InputStream x, int length) throws SQLException
508     { try { _res.updateAsciiStream(columnName, x, length); } catch (SQLException e) { handleException(e); } }
509 
510     public void updateBinaryStream(String columnName, InputStream x, int length) throws SQLException
511     { try { _res.updateBinaryStream(columnName, x, length); } catch (SQLException e) { handleException(e); } }
512 
513     public void updateCharacterStream(String columnName, Reader reader, int length) throws SQLException
514     { try { _res.updateCharacterStream(columnName, reader, length); } catch (SQLException e) { handleException(e); } }
515 
516     public void updateObject(String columnName, Object x, int scale) throws SQLException
517     { try { _res.updateObject(columnName, x); } catch (SQLException e) { handleException(e); } }
518 
519     public void updateObject(String columnName, Object x) throws SQLException
520     { try { _res.updateObject(columnName, x); } catch (SQLException e) { handleException(e); } }
521 
522     public void insertRow() throws SQLException
523     { try { _res.insertRow(); } catch (SQLException e) { handleException(e); } }
524 
525     public void updateRow() throws SQLException
526     { try { _res.updateRow(); } catch (SQLException e) { handleException(e); } }
527 
528     public void deleteRow() throws SQLException
529     { try { _res.deleteRow(); } catch (SQLException e) { handleException(e); } }
530 
531     public void refreshRow() throws SQLException
532     { try { _res.refreshRow(); } catch (SQLException e) { handleException(e); } }
533 
534     public void cancelRowUpdates() throws SQLException
535     { try { _res.cancelRowUpdates(); } catch (SQLException e) { handleException(e); } }
536 
537     public void moveToInsertRow() throws SQLException
538     { try { _res.moveToInsertRow(); } catch (SQLException e) { handleException(e); } }
539 
540     public void moveToCurrentRow() throws SQLException
541     { try { _res.moveToCurrentRow(); } catch (SQLException e) { handleException(e); } }
542 
543     public Object getObject(int i, Map map) throws SQLException
544     { try { return _res.getObject(i, map); } catch (SQLException e) { handleException(e); return null; } }
545 
546     public Ref getRef(int i) throws SQLException
547     { try { return _res.getRef(i); } catch (SQLException e) { handleException(e); return null; } }
548 
549     public Blob getBlob(int i) throws SQLException
550     { try { return _res.getBlob(i); } catch (SQLException e) { handleException(e); return null; } }
551 
552     public Clob getClob(int i) throws SQLException
553     { try { return _res.getClob(i); } catch (SQLException e) { handleException(e); return null; } }
554 
555     public Array getArray(int i) throws SQLException
556     { try { return _res.getArray(i); } catch (SQLException e) { handleException(e); return null; } }
557 
558     public Object getObject(String colName, Map map) throws SQLException
559     { try { return _res.getObject(colName, map); } catch (SQLException e) { handleException(e); return null; } }
560 
561     public Ref getRef(String colName) throws SQLException
562     { try { return _res.getRef(colName); } catch (SQLException e) { handleException(e); return null; } }
563 
564     public Blob getBlob(String colName) throws SQLException
565     { try { return _res.getBlob(colName); } catch (SQLException e) { handleException(e); return null; } }
566 
567     public Clob getClob(String colName) throws SQLException
568     { try { return _res.getClob(colName); } catch (SQLException e) { handleException(e); return null; } }
569 
570     public Array getArray(String colName) throws SQLException
571     { try { return _res.getArray(colName); } catch (SQLException e) { handleException(e); return null; } }
572 
573     public Date getDate(int columnIndex, Calendar cal) throws SQLException
574     { try { return _res.getDate(columnIndex, cal); } catch (SQLException e) { handleException(e); return null; } }
575 
576     public Date getDate(String columnName, Calendar cal) throws SQLException
577     { try { return _res.getDate(columnName, cal); } catch (SQLException e) { handleException(e); return null; } }
578 
579     public Time getTime(int columnIndex, Calendar cal) throws SQLException
580     { try { return _res.getTime(columnIndex, cal); } catch (SQLException e) { handleException(e); return null; } }
581 
582     public Time getTime(String columnName, Calendar cal) throws SQLException
583     { try { return _res.getTime(columnName, cal); } catch (SQLException e) { handleException(e); return null; } }
584 
585     public Timestamp getTimestamp(int columnIndex, Calendar cal) throws SQLException
586     { try { return _res.getTimestamp(columnIndex, cal); } catch (SQLException e) { handleException(e); return null; } }
587 
588     public Timestamp getTimestamp(String columnName, Calendar cal) throws SQLException
589     { try { return _res.getTimestamp(columnName, cal); } catch (SQLException e) { handleException(e); return null; } }
590 
591 
592     // ------------------- JDBC 3.0 -----------------------------------------
593     // Will be commented by the build process on a JDBC 2.0 system
594 
595 /* JDBC_3_ANT_KEY_BEGIN */
596 
597     public java.net.URL getURL(int columnIndex) throws SQLException
598     { try { return _res.getURL(columnIndex); } catch (SQLException e) { handleException(e); return null; } }
599 
600     public java.net.URL getURL(String columnName) throws SQLException
601     { try { return _res.getURL(columnName); } catch (SQLException e) { handleException(e); return null; } }
602 
603     public void updateRef(int columnIndex, java.sql.Ref x) throws SQLException
604     { try { _res.updateRef(columnIndex, x); } catch (SQLException e) { handleException(e); } }
605 
606     public void updateRef(String columnName, java.sql.Ref x) throws SQLException
607     { try { _res.updateRef(columnName, x); } catch (SQLException e) { handleException(e); } }
608 
609     public void updateBlob(int columnIndex, java.sql.Blob x) throws SQLException
610     { try { _res.updateBlob(columnIndex, x); } catch (SQLException e) { handleException(e); } }
611 
612     public void updateBlob(String columnName, java.sql.Blob x) throws SQLException
613     { try { _res.updateBlob(columnName, x); } catch (SQLException e) { handleException(e); } }
614 
615     public void updateClob(int columnIndex, java.sql.Clob x) throws SQLException
616     { try { _res.updateClob(columnIndex, x); } catch (SQLException e) { handleException(e); } }
617 
618     public void updateClob(String columnName, java.sql.Clob x) throws SQLException
619     { try { _res.updateClob(columnName, x); } catch (SQLException e) { handleException(e); } }
620 
621     public void updateArray(int columnIndex, java.sql.Array x) throws SQLException
622     { try { _res.updateArray(columnIndex, x); } catch (SQLException e) { handleException(e); } }
623 
624     public void updateArray(String columnName, java.sql.Array x) throws SQLException
625     { try { _res.updateArray(columnName, x); } catch (SQLException e) { handleException(e); } }
626 /* JDBC_3_ANT_KEY_END */
627 /* JDBC_4_ANT_KEY_BEGIN */
628 
629     public boolean isWrapperFor(Class<?> iface) throws SQLException {
630         return iface.isAssignableFrom(getClass()) || _res.isWrapperFor(iface);
631     }
632 
633     public <T> T unwrap(Class<T> iface) throws SQLException {
634         if (iface.isAssignableFrom(getClass())) {
635             return iface.cast(this);
636         } else if (iface.isAssignableFrom(_res.getClass())) {
637             return iface.cast(_res);
638         } else {
639             return _res.unwrap(iface);
640         }
641     }
642 
643     public RowId getRowId(int columnIndex) throws SQLException {
644         try {
645             return _res.getRowId(columnIndex);
646         }
647         catch (SQLException e) {
648             handleException(e);
649             return null;
650         }
651     }
652 
653     public RowId getRowId(String columnLabel) throws SQLException {
654         try {
655             return _res.getRowId(columnLabel);
656         }
657         catch (SQLException e) {
658             handleException(e);
659             return null;
660         }
661     }
662 
663     public void updateRowId(int columnIndex, RowId value) throws SQLException {
664         try {
665             _res.updateRowId(columnIndex, value);
666         }
667         catch (SQLException e) {
668             handleException(e);
669         }
670     }
671 
672     public void updateRowId(String columnLabel, RowId value) throws SQLException {
673         try {
674             _res.updateRowId(columnLabel, value);
675         }
676         catch (SQLException e) {
677             handleException(e);
678         }
679     }
680 
681     public int getHoldability() throws SQLException {
682         try {
683             return _res.getHoldability();
684         }
685         catch (SQLException e) {
686             handleException(e);
687             return 0;
688         }
689     }
690 
691     public boolean isClosed() throws SQLException {
692         try {
693             return _res.isClosed();
694         }
695         catch (SQLException e) {
696             handleException(e);
697             return false;
698         }
699     }
700 
701     public void updateNString(int columnIndex, String value) throws SQLException {
702         try {
703             _res.updateNString(columnIndex, value);
704         }
705         catch (SQLException e) {
706             handleException(e);
707         }
708     }
709 
710     public void updateNString(String columnLabel, String value) throws SQLException {
711         try {
712             _res.updateNString(columnLabel, value);
713         }
714         catch (SQLException e) {
715             handleException(e);
716         }
717     }
718 
719     public void updateNClob(int columnIndex, NClob value) throws SQLException {
720         try {
721             _res.updateNClob(columnIndex, value);
722         }
723         catch (SQLException e) {
724             handleException(e);
725         }
726     }
727 
728     public void updateNClob(String columnLabel, NClob value) throws SQLException {
729         try {
730             _res.updateNClob(columnLabel, value);
731         }
732         catch (SQLException e) {
733             handleException(e);
734         }
735     }
736 
737     public NClob getNClob(int columnIndex) throws SQLException {
738         try {
739             return _res.getNClob(columnIndex);
740         }
741         catch (SQLException e) {
742             handleException(e);
743             return null;
744         }
745     }
746 
747     public NClob getNClob(String columnLabel) throws SQLException {
748         try {
749             return _res.getNClob(columnLabel);
750         }
751         catch (SQLException e) {
752             handleException(e);
753             return null;
754         }
755     }
756 
757     public SQLXML getSQLXML(int columnIndex) throws SQLException {
758         try {
759             return _res.getSQLXML(columnIndex);
760         }
761         catch (SQLException e) {
762             handleException(e);
763             return null;
764         }
765     }
766 
767     public SQLXML getSQLXML(String columnLabel) throws SQLException {
768         try {
769             return _res.getSQLXML(columnLabel);
770         }
771         catch (SQLException e) {
772             handleException(e);
773             return null;
774         }
775     }
776 
777     public void updateSQLXML(int columnIndex, SQLXML value) throws SQLException {
778         try {
779             _res.updateSQLXML(columnIndex, value);
780         }
781         catch (SQLException e) {
782             handleException(e);
783         }
784     }
785 
786     public void updateSQLXML(String columnLabel, SQLXML value) throws SQLException {
787         try {
788             _res.updateSQLXML(columnLabel, value);
789         }
790         catch (SQLException e) {
791             handleException(e);
792         }
793     }
794 
795     public String getNString(int columnIndex) throws SQLException {
796         try {
797             return _res.getNString(columnIndex);
798         }
799         catch (SQLException e) {
800             handleException(e);
801             return null;
802         }
803     }
804 
805     public String getNString(String columnLabel) throws SQLException {
806         try {
807             return _res.getNString(columnLabel);
808         }
809         catch (SQLException e) {
810             handleException(e);
811             return null;
812         }
813     }
814 
815     public Reader getNCharacterStream(int columnIndex) throws SQLException {
816         try {
817             return _res.getNCharacterStream(columnIndex);
818         }
819         catch (SQLException e) {
820             handleException(e);
821             return null;
822         }
823     }
824 
825     public Reader getNCharacterStream(String columnLabel) throws SQLException {
826         try {
827             return _res.getNCharacterStream(columnLabel);
828         }
829         catch (SQLException e) {
830             handleException(e);
831             return null;
832         }
833     }
834 
835     public void updateNCharacterStream(int columnIndex, Reader reader, long length) throws SQLException {
836         try {
837             _res.updateNCharacterStream(columnIndex, reader, length);
838         }
839         catch (SQLException e) {
840             handleException(e);
841         }
842     }
843 
844     public void updateNCharacterStream(String columnLabel, Reader reader, long length) throws SQLException {
845         try {
846             _res.updateNCharacterStream(columnLabel, reader, length);
847         }
848         catch (SQLException e) {
849             handleException(e);
850         }
851     }
852 
853     public void updateAsciiStream(int columnIndex, InputStream inputStream, long length) throws SQLException {
854         try {
855             _res.updateAsciiStream(columnIndex, inputStream, length);
856         }
857         catch (SQLException e) {
858             handleException(e);
859         }
860     }
861 
862     public void updateBinaryStream(int columnIndex, InputStream inputStream, long length) throws SQLException {
863         try {
864             _res.updateBinaryStream(columnIndex, inputStream, length);
865         }
866         catch (SQLException e) {
867             handleException(e);
868         }
869     }
870 
871     public void updateCharacterStream(int columnIndex, Reader reader, long length) throws SQLException {
872         try {
873             _res.updateCharacterStream(columnIndex, reader, length);
874         }
875         catch (SQLException e) {
876             handleException(e);
877         }
878     }
879 
880     public void updateAsciiStream(String columnLabel, InputStream inputStream, long length) throws SQLException {
881         try {
882             _res.updateAsciiStream(columnLabel, inputStream, length);
883         }
884         catch (SQLException e) {
885             handleException(e);
886         }
887     }
888 
889     public void updateBinaryStream(String columnLabel, InputStream inputStream, long length) throws SQLException {
890         try {
891             _res.updateBinaryStream(columnLabel, inputStream, length);
892         }
893         catch (SQLException e) {
894             handleException(e);
895         }
896     }
897 
898     public void updateCharacterStream(String columnLabel, Reader reader, long length) throws SQLException {
899         try {
900             _res.updateCharacterStream(columnLabel, reader, length);
901         }
902         catch (SQLException e) {
903             handleException(e);
904         }
905     }
906 
907     public void updateBlob(int columnIndex, InputStream inputStream, long length) throws SQLException {
908         try {
909             _res.updateBlob(columnIndex, inputStream, length);
910         }
911         catch (SQLException e) {
912             handleException(e);
913         }
914     }
915 
916     public void updateBlob(String columnLabel, InputStream inputStream, long length) throws SQLException {
917         try {
918             _res.updateBlob(columnLabel, inputStream, length);
919         }
920         catch (SQLException e) {
921             handleException(e);
922         }
923     }
924 
925     public void updateClob(int columnIndex, Reader reader, long length) throws SQLException {
926         try {
927             _res.updateClob(columnIndex, reader, length);
928         }
929         catch (SQLException e) {
930             handleException(e);
931         }
932     }
933 
934     public void updateClob(String columnLabel, Reader reader, long length) throws SQLException {
935         try {
936             _res.updateClob(columnLabel, reader, length);
937         }
938         catch (SQLException e) {
939             handleException(e);
940         }
941     }
942 
943     public void updateNClob(int columnIndex, Reader reader, long length) throws SQLException {
944         try {
945             _res.updateNClob(columnIndex, reader, length);
946         }
947         catch (SQLException e) {
948             handleException(e);
949         }
950     }
951 
952     public void updateNClob(String columnLabel, Reader reader, long length) throws SQLException {
953         try {
954             _res.updateNClob(columnLabel, reader, length);
955         }
956         catch (SQLException e) {
957             handleException(e);
958         }
959     }
960 
961     public void updateNCharacterStream(int columnIndex, Reader reader) throws SQLException {
962         try {
963             _res.updateNCharacterStream(columnIndex, reader);
964         }
965         catch (SQLException e) {
966             handleException(e);
967         }
968     }
969 
970     public void updateNCharacterStream(String columnLabel, Reader reader) throws SQLException {
971         try {
972             _res.updateNCharacterStream(columnLabel, reader);
973         }
974         catch (SQLException e) {
975             handleException(e);
976         }
977     }
978 
979     public void updateAsciiStream(int columnIndex, InputStream inputStream) throws SQLException {
980         try {
981             _res.updateAsciiStream(columnIndex, inputStream);
982         }
983         catch (SQLException e) {
984             handleException(e);
985         }
986     }
987 
988     public void updateBinaryStream(int columnIndex, InputStream inputStream) throws SQLException {
989         try {
990             _res.updateBinaryStream(columnIndex, inputStream);
991         }
992         catch (SQLException e) {
993             handleException(e);
994         }
995     }
996 
997     public void updateCharacterStream(int columnIndex, Reader reader) throws SQLException {
998         try {
999             _res.updateCharacterStream(columnIndex, reader);
1000         }
1001         catch (SQLException e) {
1002             handleException(e);
1003         }
1004     }
1005 
1006     public void updateAsciiStream(String columnLabel, InputStream inputStream) throws SQLException {
1007         try {
1008             _res.updateAsciiStream(columnLabel, inputStream);
1009         }
1010         catch (SQLException e) {
1011             handleException(e);
1012         }
1013     }
1014 
1015     public void updateBinaryStream(String columnLabel, InputStream inputStream) throws SQLException {
1016         try {
1017             _res.updateBinaryStream(columnLabel, inputStream);
1018         }
1019         catch (SQLException e) {
1020             handleException(e);
1021         }
1022     }
1023 
1024     public void updateCharacterStream(String columnLabel, Reader reader) throws SQLException {
1025         try {
1026             _res.updateCharacterStream(columnLabel, reader);
1027         }
1028         catch (SQLException e) {
1029             handleException(e);
1030         }
1031     }
1032 
1033     public void updateBlob(int columnIndex, InputStream inputStream) throws SQLException {
1034         try {
1035             _res.updateBlob(columnIndex, inputStream);
1036         }
1037         catch (SQLException e) {
1038             handleException(e);
1039         }
1040     }
1041 
1042     public void updateBlob(String columnLabel, InputStream inputStream) throws SQLException {
1043         try {
1044             _res.updateBlob(columnLabel, inputStream);
1045         }
1046         catch (SQLException e) {
1047             handleException(e);
1048         }
1049     }
1050 
1051     public void updateClob(int columnIndex, Reader reader) throws SQLException {
1052         try {
1053             _res.updateClob(columnIndex, reader);
1054         }
1055         catch (SQLException e) {
1056             handleException(e);
1057         }
1058     }
1059 
1060     public void updateClob(String columnLabel, Reader reader) throws SQLException {
1061         try {
1062             _res.updateClob(columnLabel, reader);
1063         }
1064         catch (SQLException e) {
1065             handleException(e);
1066         }
1067     }
1068 
1069     public void updateNClob(int columnIndex, Reader reader) throws SQLException {
1070         try {
1071             _res.updateNClob(columnIndex, reader);
1072         }
1073         catch (SQLException e) {
1074             handleException(e);
1075         }
1076     }
1077 
1078     public void updateNClob(String columnLabel, Reader reader) throws SQLException {
1079         try {
1080             _res.updateNClob(columnLabel, reader);
1081         }
1082         catch (SQLException e) {
1083             handleException(e);
1084         }
1085     }
1086 /* JDBC_4_ANT_KEY_END */
1087 }