001    /*
002     * Licensed to the Apache Software Foundation (ASF) under one or more
003     * contributor license agreements.  See the NOTICE file distributed with
004     * this work for additional information regarding copyright ownership.
005     * The ASF licenses this file to You under the Apache License, Version 2.0
006     * (the "License"); you may not use this file except in compliance with
007     * the License.  You may obtain a copy of the License at
008     * 
009     *      http://www.apache.org/licenses/LICENSE-2.0
010     * 
011     * Unless required by applicable law or agreed to in writing, software
012     * distributed under the License is distributed on an "AS IS" BASIS,
013     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
014     * See the License for the specific language governing permissions and
015     * limitations under the License.
016     */
017    
018    package org.apache.commons.dbcp;
019    
020    import java.sql.ResultSet;
021    import java.math.BigDecimal;
022    import java.sql.Date;
023    import java.sql.Time;
024    import java.sql.Timestamp;
025    import java.io.InputStream;
026    import java.sql.SQLWarning;
027    import java.sql.ResultSetMetaData;
028    import java.sql.SQLException;
029    import java.io.Reader;
030    import java.sql.Statement;
031    import java.util.Map;
032    import java.sql.Connection;
033    import java.sql.Ref;
034    import java.sql.Blob;
035    import java.sql.Clob;
036    import java.sql.Array;
037    import java.util.Calendar;
038    /* JDBC_4_ANT_KEY_BEGIN */
039    import java.sql.NClob;
040    import java.sql.RowId;
041    import java.sql.SQLXML;
042    /* JDBC_4_ANT_KEY_END */
043    
044    /**
045     * A base delegating implementation of {@link ResultSet}.
046     * <p>
047     * All of the methods from the {@link ResultSet} interface
048     * simply call the corresponding method on the "delegate"
049     * provided in my constructor.
050     * <p>
051     * Extends AbandonedTrace to implement result set tracking and
052     * logging of code which created the ResultSet. Tracking the
053     * ResultSet ensures that the Statment which created it can
054     * close any open ResultSet's on Statement close.
055     *
056     * @author Glenn L. Nielsen
057     * @author James House
058     * @author Dirk Verbeeck
059     * @version $Revision: 892307 $ $Date: 2013-12-31 23:27:28 +0000 (Tue, 31 Dec 2013) $
060     */
061    public class DelegatingResultSet extends AbandonedTrace implements ResultSet {
062    
063        /** My delegate. **/
064        private ResultSet _res;
065    
066        /** The Statement that created me, if any. **/
067        private Statement _stmt;
068    
069        /** The Connection that created me, if any. **/
070        private Connection _conn;
071    
072        /**
073         * Create a wrapper for the ResultSet which traces this
074         * ResultSet to the Statement which created it and the
075         * code which created it.
076         *
077         * @param stmt Statement which created this ResultSet
078         * @param res ResultSet to wrap
079         */
080        public DelegatingResultSet(Statement stmt, ResultSet res) {
081            super((AbandonedTrace)stmt);
082            this._stmt = stmt;
083            this._res = res;
084        }
085        
086        /**
087         * Create a wrapper for the ResultSet which traces this
088         * ResultSet to the Connection which created it (via, for
089         * example DatabaseMetadata, and the code which created it.
090         *
091         * @param conn Connection which created this ResultSet
092         * @param res ResultSet to wrap
093         */
094        public DelegatingResultSet(Connection conn, ResultSet res) {
095            super((AbandonedTrace)conn);
096            this._conn = conn;
097            this._res = res;
098        }
099        
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        public java.net.URL getURL(int columnIndex) throws SQLException
593        { try { return _res.getURL(columnIndex); } catch (SQLException e) { handleException(e); return null; } }
594    
595        public java.net.URL getURL(String columnName) throws SQLException
596        { try { return _res.getURL(columnName); } catch (SQLException e) { handleException(e); return null; } }
597    
598        public void updateRef(int columnIndex, java.sql.Ref x) throws SQLException
599        { try { _res.updateRef(columnIndex, x); } catch (SQLException e) { handleException(e); } }
600    
601        public void updateRef(String columnName, java.sql.Ref x) throws SQLException
602        { try { _res.updateRef(columnName, x); } catch (SQLException e) { handleException(e); } }
603    
604        public void updateBlob(int columnIndex, java.sql.Blob x) throws SQLException
605        { try { _res.updateBlob(columnIndex, x); } catch (SQLException e) { handleException(e); } }
606    
607        public void updateBlob(String columnName, java.sql.Blob x) throws SQLException
608        { try { _res.updateBlob(columnName, x); } catch (SQLException e) { handleException(e); } }
609    
610        public void updateClob(int columnIndex, java.sql.Clob x) throws SQLException
611        { try { _res.updateClob(columnIndex, x); } catch (SQLException e) { handleException(e); } }
612    
613        public void updateClob(String columnName, java.sql.Clob x) throws SQLException
614        { try { _res.updateClob(columnName, x); } catch (SQLException e) { handleException(e); } }
615    
616        public void updateArray(int columnIndex, java.sql.Array x) throws SQLException
617        { try { _res.updateArray(columnIndex, x); } catch (SQLException e) { handleException(e); } }
618    
619        public void updateArray(String columnName, java.sql.Array x) throws SQLException
620        { try { _res.updateArray(columnName, x); } catch (SQLException e) { handleException(e); } }
621    
622    /* JDBC_4_ANT_KEY_BEGIN */
623    
624        public boolean isWrapperFor(Class<?> iface) throws SQLException {
625            return iface.isAssignableFrom(getClass()) || _res.isWrapperFor(iface);
626        }
627    
628        public <T> T unwrap(Class<T> iface) throws SQLException {
629            if (iface.isAssignableFrom(getClass())) {
630                return iface.cast(this);
631            } else if (iface.isAssignableFrom(_res.getClass())) {
632                return iface.cast(_res);
633            } else {
634                return _res.unwrap(iface);
635            }
636        }
637    
638        public RowId getRowId(int columnIndex) throws SQLException {
639            try {
640                return _res.getRowId(columnIndex);
641            }
642            catch (SQLException e) {
643                handleException(e);
644                return null;
645            }
646        }
647    
648        public RowId getRowId(String columnLabel) throws SQLException {
649            try {
650                return _res.getRowId(columnLabel);
651            }
652            catch (SQLException e) {
653                handleException(e);
654                return null;
655            }
656        }
657    
658        public void updateRowId(int columnIndex, RowId value) throws SQLException {
659            try {
660                _res.updateRowId(columnIndex, value);
661            }
662            catch (SQLException e) {
663                handleException(e);
664            }
665        }
666    
667        public void updateRowId(String columnLabel, RowId value) throws SQLException {
668            try {
669                _res.updateRowId(columnLabel, value);
670            }
671            catch (SQLException e) {
672                handleException(e);
673            }
674        }
675    
676        public int getHoldability() throws SQLException {
677            try {
678                return _res.getHoldability();
679            }
680            catch (SQLException e) {
681                handleException(e);
682                return 0;
683            }
684        }
685    
686        public boolean isClosed() throws SQLException {
687            try {
688                return _res.isClosed();
689            }
690            catch (SQLException e) {
691                handleException(e);
692                return false;
693            }
694        }
695    
696        public void updateNString(int columnIndex, String value) throws SQLException {
697            try {
698                _res.updateNString(columnIndex, value);
699            }
700            catch (SQLException e) {
701                handleException(e);
702            }
703        }
704    
705        public void updateNString(String columnLabel, String value) throws SQLException {
706            try {
707                _res.updateNString(columnLabel, value);
708            }
709            catch (SQLException e) {
710                handleException(e);
711            }
712        }
713    
714        public void updateNClob(int columnIndex, NClob value) throws SQLException {
715            try {
716                _res.updateNClob(columnIndex, value);
717            }
718            catch (SQLException e) {
719                handleException(e);
720            }
721        }
722    
723        public void updateNClob(String columnLabel, NClob value) throws SQLException {
724            try {
725                _res.updateNClob(columnLabel, value);
726            }
727            catch (SQLException e) {
728                handleException(e);
729            }
730        }
731    
732        public NClob getNClob(int columnIndex) throws SQLException {
733            try {
734                return _res.getNClob(columnIndex);
735            }
736            catch (SQLException e) {
737                handleException(e);
738                return null;
739            }
740        }
741    
742        public NClob getNClob(String columnLabel) throws SQLException {
743            try {
744                return _res.getNClob(columnLabel);
745            }
746            catch (SQLException e) {
747                handleException(e);
748                return null;
749            }
750        }
751    
752        public SQLXML getSQLXML(int columnIndex) throws SQLException {
753            try {
754                return _res.getSQLXML(columnIndex);
755            }
756            catch (SQLException e) {
757                handleException(e);
758                return null;
759            }
760        }
761    
762        public SQLXML getSQLXML(String columnLabel) throws SQLException {
763            try {
764                return _res.getSQLXML(columnLabel);
765            }
766            catch (SQLException e) {
767                handleException(e);
768                return null;
769            }
770        }
771    
772        public void updateSQLXML(int columnIndex, SQLXML value) throws SQLException {
773            try {
774                _res.updateSQLXML(columnIndex, value);
775            }
776            catch (SQLException e) {
777                handleException(e);
778            }
779        }
780    
781        public void updateSQLXML(String columnLabel, SQLXML value) throws SQLException {
782            try {
783                _res.updateSQLXML(columnLabel, value);
784            }
785            catch (SQLException e) {
786                handleException(e);
787            }
788        }
789    
790        public String getNString(int columnIndex) throws SQLException {
791            try {
792                return _res.getNString(columnIndex);
793            }
794            catch (SQLException e) {
795                handleException(e);
796                return null;
797            }
798        }
799    
800        public String getNString(String columnLabel) throws SQLException {
801            try {
802                return _res.getNString(columnLabel);
803            }
804            catch (SQLException e) {
805                handleException(e);
806                return null;
807            }
808        }
809    
810        public Reader getNCharacterStream(int columnIndex) throws SQLException {
811            try {
812                return _res.getNCharacterStream(columnIndex);
813            }
814            catch (SQLException e) {
815                handleException(e);
816                return null;
817            }
818        }
819    
820        public Reader getNCharacterStream(String columnLabel) throws SQLException {
821            try {
822                return _res.getNCharacterStream(columnLabel);
823            }
824            catch (SQLException e) {
825                handleException(e);
826                return null;
827            }
828        }
829    
830        public void updateNCharacterStream(int columnIndex, Reader reader, long length) throws SQLException {
831            try {
832                _res.updateNCharacterStream(columnIndex, reader, length);
833            }
834            catch (SQLException e) {
835                handleException(e);
836            }
837        }
838    
839        public void updateNCharacterStream(String columnLabel, Reader reader, long length) throws SQLException {
840            try {
841                _res.updateNCharacterStream(columnLabel, reader, length);
842            }
843            catch (SQLException e) {
844                handleException(e);
845            }
846        }
847    
848        public void updateAsciiStream(int columnIndex, InputStream inputStream, long length) throws SQLException {
849            try {
850                _res.updateAsciiStream(columnIndex, inputStream, length);
851            }
852            catch (SQLException e) {
853                handleException(e);
854            }
855        }
856    
857        public void updateBinaryStream(int columnIndex, InputStream inputStream, long length) throws SQLException {
858            try {
859                _res.updateBinaryStream(columnIndex, inputStream, length);
860            }
861            catch (SQLException e) {
862                handleException(e);
863            }
864        }
865    
866        public void updateCharacterStream(int columnIndex, Reader reader, long length) throws SQLException {
867            try {
868                _res.updateCharacterStream(columnIndex, reader, length);
869            }
870            catch (SQLException e) {
871                handleException(e);
872            }
873        }
874    
875        public void updateAsciiStream(String columnLabel, InputStream inputStream, long length) throws SQLException {
876            try {
877                _res.updateAsciiStream(columnLabel, inputStream, length);
878            }
879            catch (SQLException e) {
880                handleException(e);
881            }
882        }
883    
884        public void updateBinaryStream(String columnLabel, InputStream inputStream, long length) throws SQLException {
885            try {
886                _res.updateBinaryStream(columnLabel, inputStream, length);
887            }
888            catch (SQLException e) {
889                handleException(e);
890            }
891        }
892    
893        public void updateCharacterStream(String columnLabel, Reader reader, long length) throws SQLException {
894            try {
895                _res.updateCharacterStream(columnLabel, reader, length);
896            }
897            catch (SQLException e) {
898                handleException(e);
899            }
900        }
901    
902        public void updateBlob(int columnIndex, InputStream inputStream, long length) throws SQLException {
903            try {
904                _res.updateBlob(columnIndex, inputStream, length);
905            }
906            catch (SQLException e) {
907                handleException(e);
908            }
909        }
910    
911        public void updateBlob(String columnLabel, InputStream inputStream, long length) throws SQLException {
912            try {
913                _res.updateBlob(columnLabel, inputStream, length);
914            }
915            catch (SQLException e) {
916                handleException(e);
917            }
918        }
919    
920        public void updateClob(int columnIndex, Reader reader, long length) throws SQLException {
921            try {
922                _res.updateClob(columnIndex, reader, length);
923            }
924            catch (SQLException e) {
925                handleException(e);
926            }
927        }
928    
929        public void updateClob(String columnLabel, Reader reader, long length) throws SQLException {
930            try {
931                _res.updateClob(columnLabel, reader, length);
932            }
933            catch (SQLException e) {
934                handleException(e);
935            }
936        }
937    
938        public void updateNClob(int columnIndex, Reader reader, long length) throws SQLException {
939            try {
940                _res.updateNClob(columnIndex, reader, length);
941            }
942            catch (SQLException e) {
943                handleException(e);
944            }
945        }
946    
947        public void updateNClob(String columnLabel, Reader reader, long length) throws SQLException {
948            try {
949                _res.updateNClob(columnLabel, reader, length);
950            }
951            catch (SQLException e) {
952                handleException(e);
953            }
954        }
955    
956        public void updateNCharacterStream(int columnIndex, Reader reader) throws SQLException {
957            try {
958                _res.updateNCharacterStream(columnIndex, reader);
959            }
960            catch (SQLException e) {
961                handleException(e);
962            }
963        }
964    
965        public void updateNCharacterStream(String columnLabel, Reader reader) throws SQLException {
966            try {
967                _res.updateNCharacterStream(columnLabel, reader);
968            }
969            catch (SQLException e) {
970                handleException(e);
971            }
972        }
973    
974        public void updateAsciiStream(int columnIndex, InputStream inputStream) throws SQLException {
975            try {
976                _res.updateAsciiStream(columnIndex, inputStream);
977            }
978            catch (SQLException e) {
979                handleException(e);
980            }
981        }
982    
983        public void updateBinaryStream(int columnIndex, InputStream inputStream) throws SQLException {
984            try {
985                _res.updateBinaryStream(columnIndex, inputStream);
986            }
987            catch (SQLException e) {
988                handleException(e);
989            }
990        }
991    
992        public void updateCharacterStream(int columnIndex, Reader reader) throws SQLException {
993            try {
994                _res.updateCharacterStream(columnIndex, reader);
995            }
996            catch (SQLException e) {
997                handleException(e);
998            }
999        }
1000    
1001        public void updateAsciiStream(String columnLabel, InputStream inputStream) throws SQLException {
1002            try {
1003                _res.updateAsciiStream(columnLabel, inputStream);
1004            }
1005            catch (SQLException e) {
1006                handleException(e);
1007            }
1008        }
1009    
1010        public void updateBinaryStream(String columnLabel, InputStream inputStream) throws SQLException {
1011            try {
1012                _res.updateBinaryStream(columnLabel, inputStream);
1013            }
1014            catch (SQLException e) {
1015                handleException(e);
1016            }
1017        }
1018    
1019        public void updateCharacterStream(String columnLabel, Reader reader) throws SQLException {
1020            try {
1021                _res.updateCharacterStream(columnLabel, reader);
1022            }
1023            catch (SQLException e) {
1024                handleException(e);
1025            }
1026        }
1027    
1028        public void updateBlob(int columnIndex, InputStream inputStream) throws SQLException {
1029            try {
1030                _res.updateBlob(columnIndex, inputStream);
1031            }
1032            catch (SQLException e) {
1033                handleException(e);
1034            }
1035        }
1036    
1037        public void updateBlob(String columnLabel, InputStream inputStream) throws SQLException {
1038            try {
1039                _res.updateBlob(columnLabel, inputStream);
1040            }
1041            catch (SQLException e) {
1042                handleException(e);
1043            }
1044        }
1045    
1046        public void updateClob(int columnIndex, Reader reader) throws SQLException {
1047            try {
1048                _res.updateClob(columnIndex, reader);
1049            }
1050            catch (SQLException e) {
1051                handleException(e);
1052            }
1053        }
1054    
1055        public void updateClob(String columnLabel, Reader reader) throws SQLException {
1056            try {
1057                _res.updateClob(columnLabel, reader);
1058            }
1059            catch (SQLException e) {
1060                handleException(e);
1061            }
1062        }
1063    
1064        public void updateNClob(int columnIndex, Reader reader) throws SQLException {
1065            try {
1066                _res.updateNClob(columnIndex, reader);
1067            }
1068            catch (SQLException e) {
1069                handleException(e);
1070            }
1071        }
1072    
1073        public void updateNClob(String columnLabel, Reader reader) throws SQLException {
1074            try {
1075                _res.updateNClob(columnLabel, reader);
1076            }
1077            catch (SQLException e) {
1078                handleException(e);
1079            }
1080        }
1081    /* JDBC_4_ANT_KEY_END */
1082    }