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 018package org.apache.commons.dbcp2; 019 020import java.io.InputStream; 021import java.io.Reader; 022import java.math.BigDecimal; 023import java.sql.Array; 024import java.sql.Blob; 025import java.sql.Clob; 026import java.sql.Connection; 027import java.sql.Date; 028import java.sql.NClob; 029import java.sql.Ref; 030import java.sql.ResultSet; 031import java.sql.ResultSetMetaData; 032import java.sql.RowId; 033import java.sql.SQLException; 034import java.sql.SQLWarning; 035import java.sql.SQLXML; 036import java.sql.Statement; 037import java.sql.Time; 038import java.sql.Timestamp; 039import java.util.Calendar; 040import java.util.Map; 041 042/** 043 * A base delegating implementation of {@link ResultSet}. 044 * <p> 045 * All of the methods from the {@link ResultSet} interface 046 * simply call the corresponding method on the "delegate" 047 * provided in my constructor. 048 * <p> 049 * Extends AbandonedTrace to implement result set tracking and 050 * logging of code which created the ResultSet. Tracking the 051 * ResultSet ensures that the Statement which created it can 052 * close any open ResultSet's on Statement close. 053 * 054 * @author Glenn L. Nielsen 055 * @author James House 056 * @author Dirk Verbeeck 057 * @version $Id: DelegatingResultSet.java 1649430 2015-01-04 21:29:32Z tn $ 058 * @since 2.0 059 */ 060public final class DelegatingResultSet extends AbandonedTrace implements ResultSet { 061 062 /** My delegate. **/ 063 private final ResultSet _res; 064 065 /** The Statement that created me, if any. **/ 066 private Statement _stmt; 067 068 /** The Connection that created me, if any. **/ 069 private Connection _conn; 070 071 /** 072 * Create a wrapper for the ResultSet which traces this 073 * ResultSet to the Statement which created it and the 074 * code which created it. 075 * <p> 076 * Private to ensure all construction is 077 * {@link #wrapResultSet(Statement, ResultSet)} 078 * 079 * @param stmt Statement which created this ResultSet 080 * @param res ResultSet to wrap 081 */ 082 private DelegatingResultSet(Statement stmt, ResultSet res) { 083 super((AbandonedTrace)stmt); 084 this._stmt = stmt; 085 this._res = res; 086 } 087 088 /** 089 * Create a wrapper for the ResultSet which traces this 090 * ResultSet to the Connection which created it (via, for 091 * example DatabaseMetadata, and the code which created it. 092 * <p> 093 * Private to ensure all construction is 094 * {@link #wrapResultSet(Connection, ResultSet)} 095 * 096 * @param conn Connection which created this ResultSet 097 * @param res ResultSet to wrap 098 */ 099 private DelegatingResultSet(Connection conn, ResultSet res) { 100 super((AbandonedTrace)conn); 101 this._conn = conn; 102 this._res = res; 103 } 104 105 public static ResultSet wrapResultSet(Statement stmt, ResultSet rset) { 106 if(null == rset) { 107 return null; 108 } 109 return new DelegatingResultSet(stmt,rset); 110 } 111 112 public static ResultSet wrapResultSet(Connection conn, ResultSet rset) { 113 if(null == rset) { 114 return null; 115 } 116 return new DelegatingResultSet(conn,rset); 117 } 118 119 public ResultSet getDelegate() { 120 return _res; 121 } 122 123 /** 124 * If my underlying {@link ResultSet} is not a 125 * {@code DelegatingResultSet}, returns it, 126 * otherwise recursively invokes this method on 127 * my delegate. 128 * <p> 129 * Hence this method will return the first 130 * delegate that is not a {@code DelegatingResultSet}, 131 * or {@code null} when no non-{@code DelegatingResultSet} 132 * delegate can be found by transversing this chain. 133 * <p> 134 * This method is useful when you may have nested 135 * {@code DelegatingResultSet}s, and you want to make 136 * sure to obtain a "genuine" {@link ResultSet}. 137 */ 138 public ResultSet getInnermostDelegate() { 139 ResultSet r = _res; 140 while(r != null && r instanceof DelegatingResultSet) { 141 r = ((DelegatingResultSet)r).getDelegate(); 142 if(this == r) { 143 return null; 144 } 145 } 146 return r; 147 } 148 149 @Override 150 public Statement getStatement() throws SQLException { 151 return _stmt; 152 } 153 154 /** 155 * Wrapper for close of ResultSet which removes this 156 * result set from being traced then calls close on 157 * the original ResultSet. 158 */ 159 @Override 160 public void close() throws SQLException { 161 try { 162 if(_stmt != null) { 163 ((AbandonedTrace)_stmt).removeTrace(this); 164 _stmt = null; 165 } 166 if(_conn != null) { 167 ((AbandonedTrace)_conn).removeTrace(this); 168 _conn = null; 169 } 170 _res.close(); 171 } 172 catch (SQLException e) { 173 handleException(e); 174 } 175 } 176 177 protected void handleException(SQLException e) throws SQLException { 178 if (_stmt != null && _stmt instanceof DelegatingStatement) { 179 ((DelegatingStatement)_stmt).handleException(e); 180 } 181 else if (_conn != null && _conn instanceof DelegatingConnection) { 182 ((DelegatingConnection<?>)_conn).handleException(e); 183 } 184 else { 185 throw e; 186 } 187 } 188 189 @Override 190 public boolean next() throws SQLException 191 { try { return _res.next(); } catch (SQLException e) { handleException(e); return false; } } 192 193 @Override 194 public boolean wasNull() throws SQLException 195 { try { return _res.wasNull(); } catch (SQLException e) { handleException(e); return false; } } 196 197 @Override 198 public String getString(int columnIndex) throws SQLException 199 { try { return _res.getString(columnIndex); } catch (SQLException e) { handleException(e); return null; } } 200 201 @Override 202 public boolean getBoolean(int columnIndex) throws SQLException 203 { try { return _res.getBoolean(columnIndex); } catch (SQLException e) { handleException(e); return false; } } 204 205 @Override 206 public byte getByte(int columnIndex) throws SQLException 207 { try { return _res.getByte(columnIndex); } catch (SQLException e) { handleException(e); return 0; } } 208 209 @Override 210 public short getShort(int columnIndex) throws SQLException 211 { try { return _res.getShort(columnIndex); } catch (SQLException e) { handleException(e); return 0; } } 212 213 @Override 214 public int getInt(int columnIndex) throws SQLException 215 { try { return _res.getInt(columnIndex); } catch (SQLException e) { handleException(e); return 0; } } 216 217 @Override 218 public long getLong(int columnIndex) throws SQLException 219 { try { return _res.getLong(columnIndex); } catch (SQLException e) { handleException(e); return 0; } } 220 221 @Override 222 public float getFloat(int columnIndex) throws SQLException 223 { try { return _res.getFloat(columnIndex); } catch (SQLException e) { handleException(e); return 0; } } 224 225 @Override 226 public double getDouble(int columnIndex) throws SQLException 227 { try { return _res.getDouble(columnIndex); } catch (SQLException e) { handleException(e); return 0; } } 228 229 /** @deprecated */ 230 @Deprecated 231 @Override 232 public BigDecimal getBigDecimal(int columnIndex, int scale) throws SQLException 233 { try { return _res.getBigDecimal(columnIndex); } catch (SQLException e) { handleException(e); return null; } } 234 235 @Override 236 public byte[] getBytes(int columnIndex) throws SQLException 237 { try { return _res.getBytes(columnIndex); } catch (SQLException e) { handleException(e); return null; } } 238 239 @Override 240 public Date getDate(int columnIndex) throws SQLException 241 { try { return _res.getDate(columnIndex); } catch (SQLException e) { handleException(e); return null; } } 242 243 @Override 244 public Time getTime(int columnIndex) throws SQLException 245 { try { return _res.getTime(columnIndex); } catch (SQLException e) { handleException(e); return null; } } 246 247 @Override 248 public Timestamp getTimestamp(int columnIndex) throws SQLException 249 { try { return _res.getTimestamp(columnIndex); } catch (SQLException e) { handleException(e); return null; } } 250 251 @Override 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 @Deprecated 257 @Override 258 public InputStream getUnicodeStream(int columnIndex) throws SQLException 259 { try { return _res.getUnicodeStream(columnIndex); } catch (SQLException e) { handleException(e); return null; } } 260 261 @Override 262 public InputStream getBinaryStream(int columnIndex) throws SQLException 263 { try { return _res.getBinaryStream(columnIndex); } catch (SQLException e) { handleException(e); return null; } } 264 265 @Override 266 public String getString(String columnName) throws SQLException 267 { try { return _res.getString(columnName); } catch (SQLException e) { handleException(e); return null; } } 268 269 @Override 270 public boolean getBoolean(String columnName) throws SQLException 271 { try { return _res.getBoolean(columnName); } catch (SQLException e) { handleException(e); return false; } } 272 273 @Override 274 public byte getByte(String columnName) throws SQLException 275 { try { return _res.getByte(columnName); } catch (SQLException e) { handleException(e); return 0; } } 276 277 @Override 278 public short getShort(String columnName) throws SQLException 279 { try { return _res.getShort(columnName); } catch (SQLException e) { handleException(e); return 0; } } 280 281 @Override 282 public int getInt(String columnName) throws SQLException 283 { try { return _res.getInt(columnName); } catch (SQLException e) { handleException(e); return 0; } } 284 285 @Override 286 public long getLong(String columnName) throws SQLException 287 { try { return _res.getLong(columnName); } catch (SQLException e) { handleException(e); return 0; } } 288 289 @Override 290 public float getFloat(String columnName) throws SQLException 291 { try { return _res.getFloat(columnName); } catch (SQLException e) { handleException(e); return 0; } } 292 293 @Override 294 public double getDouble(String columnName) throws SQLException 295 { try { return _res.getDouble(columnName); } catch (SQLException e) { handleException(e); return 0; } } 296 297 /** @deprecated */ 298 @Deprecated 299 @Override 300 public BigDecimal getBigDecimal(String columnName, int scale) throws SQLException 301 { try { return _res.getBigDecimal(columnName); } catch (SQLException e) { handleException(e); return null; } } 302 303 @Override 304 public byte[] getBytes(String columnName) throws SQLException 305 { try { return _res.getBytes(columnName); } catch (SQLException e) { handleException(e); return null; } } 306 307 @Override 308 public Date getDate(String columnName) throws SQLException 309 { try { return _res.getDate(columnName); } catch (SQLException e) { handleException(e); return null; } } 310 311 @Override 312 public Time getTime(String columnName) throws SQLException 313 { try { return _res.getTime(columnName); } catch (SQLException e) { handleException(e); return null; } } 314 315 @Override 316 public Timestamp getTimestamp(String columnName) throws SQLException 317 { try { return _res.getTimestamp(columnName); } catch (SQLException e) { handleException(e); return null; } } 318 319 @Override 320 public InputStream getAsciiStream(String columnName) throws SQLException 321 { try { return _res.getAsciiStream(columnName); } catch (SQLException e) { handleException(e); return null; } } 322 323 /** @deprecated */ 324 @Deprecated 325 @Override 326 public InputStream getUnicodeStream(String columnName) throws SQLException 327 { try { return _res.getUnicodeStream(columnName); } catch (SQLException e) { handleException(e); return null; } } 328 329 @Override 330 public InputStream getBinaryStream(String columnName) throws SQLException 331 { try { return _res.getBinaryStream(columnName); } catch (SQLException e) { handleException(e); return null; } } 332 333 @Override 334 public SQLWarning getWarnings() throws SQLException 335 { try { return _res.getWarnings(); } catch (SQLException e) { handleException(e); return null; } } 336 337 @Override 338 public void clearWarnings() throws SQLException 339 { try { _res.clearWarnings(); } catch (SQLException e) { handleException(e); } } 340 341 @Override 342 public String getCursorName() throws SQLException 343 { try { return _res.getCursorName(); } catch (SQLException e) { handleException(e); return null; } } 344 345 @Override 346 public ResultSetMetaData getMetaData() throws SQLException 347 { try { return _res.getMetaData(); } catch (SQLException e) { handleException(e); return null; } } 348 349 @Override 350 public Object getObject(int columnIndex) throws SQLException 351 { try { return _res.getObject(columnIndex); } catch (SQLException e) { handleException(e); return null; } } 352 353 @Override 354 public Object getObject(String columnName) throws SQLException 355 { try { return _res.getObject(columnName); } catch (SQLException e) { handleException(e); return null; } } 356 357 @Override 358 public int findColumn(String columnName) throws SQLException 359 { try { return _res.findColumn(columnName); } catch (SQLException e) { handleException(e); return 0; } } 360 361 @Override 362 public Reader getCharacterStream(int columnIndex) throws SQLException 363 { try { return _res.getCharacterStream(columnIndex); } catch (SQLException e) { handleException(e); return null; } } 364 365 @Override 366 public Reader getCharacterStream(String columnName) throws SQLException 367 { try { return _res.getCharacterStream(columnName); } catch (SQLException e) { handleException(e); return null; } } 368 369 @Override 370 public BigDecimal getBigDecimal(int columnIndex) throws SQLException 371 { try { return _res.getBigDecimal(columnIndex); } catch (SQLException e) { handleException(e); return null; } } 372 373 @Override 374 public BigDecimal getBigDecimal(String columnName) throws SQLException 375 { try { return _res.getBigDecimal(columnName); } catch (SQLException e) { handleException(e); return null; } } 376 377 @Override 378 public boolean isBeforeFirst() throws SQLException 379 { try { return _res.isBeforeFirst(); } catch (SQLException e) { handleException(e); return false; } } 380 381 @Override 382 public boolean isAfterLast() throws SQLException 383 { try { return _res.isAfterLast(); } catch (SQLException e) { handleException(e); return false; } } 384 385 @Override 386 public boolean isFirst() throws SQLException 387 { try { return _res.isFirst(); } catch (SQLException e) { handleException(e); return false; } } 388 389 @Override 390 public boolean isLast() throws SQLException 391 { try { return _res.isLast(); } catch (SQLException e) { handleException(e); return false; } } 392 393 @Override 394 public void beforeFirst() throws SQLException 395 { try { _res.beforeFirst(); } catch (SQLException e) { handleException(e); } } 396 397 @Override 398 public void afterLast() throws SQLException 399 { try { _res.afterLast(); } catch (SQLException e) { handleException(e); } } 400 401 @Override 402 public boolean first() throws SQLException 403 { try { return _res.first(); } catch (SQLException e) { handleException(e); return false; } } 404 405 @Override 406 public boolean last() throws SQLException 407 { try { return _res.last(); } catch (SQLException e) { handleException(e); return false; } } 408 409 @Override 410 public int getRow() throws SQLException 411 { try { return _res.getRow(); } catch (SQLException e) { handleException(e); return 0; } } 412 413 @Override 414 public boolean absolute(int row) throws SQLException 415 { try { return _res.absolute(row); } catch (SQLException e) { handleException(e); return false; } } 416 417 @Override 418 public boolean relative(int rows) throws SQLException 419 { try { return _res.relative(rows); } catch (SQLException e) { handleException(e); return false; } } 420 421 @Override 422 public boolean previous() throws SQLException 423 { try { return _res.previous(); } catch (SQLException e) { handleException(e); return false; } } 424 425 @Override 426 public void setFetchDirection(int direction) throws SQLException 427 { try { _res.setFetchDirection(direction); } catch (SQLException e) { handleException(e); } } 428 429 @Override 430 public int getFetchDirection() throws SQLException 431 { try { return _res.getFetchDirection(); } catch (SQLException e) { handleException(e); return 0; } } 432 433 @Override 434 public void setFetchSize(int rows) throws SQLException 435 { try { _res.setFetchSize(rows); } catch (SQLException e) { handleException(e); } } 436 437 @Override 438 public int getFetchSize() throws SQLException 439 { try { return _res.getFetchSize(); } catch (SQLException e) { handleException(e); return 0; } } 440 441 @Override 442 public int getType() throws SQLException 443 { try { return _res.getType(); } catch (SQLException e) { handleException(e); return 0; } } 444 445 @Override 446 public int getConcurrency() throws SQLException 447 { try { return _res.getConcurrency(); } catch (SQLException e) { handleException(e); return 0; } } 448 449 @Override 450 public boolean rowUpdated() throws SQLException 451 { try { return _res.rowUpdated(); } catch (SQLException e) { handleException(e); return false; } } 452 453 @Override 454 public boolean rowInserted() throws SQLException 455 { try { return _res.rowInserted(); } catch (SQLException e) { handleException(e); return false; } } 456 457 @Override 458 public boolean rowDeleted() throws SQLException 459 { try { return _res.rowDeleted(); } catch (SQLException e) { handleException(e); return false; } } 460 461 @Override 462 public void updateNull(int columnIndex) throws SQLException 463 { try { _res.updateNull(columnIndex); } catch (SQLException e) { handleException(e); } } 464 465 @Override 466 public void updateBoolean(int columnIndex, boolean x) throws SQLException 467 { try { _res.updateBoolean(columnIndex, x); } catch (SQLException e) { handleException(e); } } 468 469 @Override 470 public void updateByte(int columnIndex, byte x) throws SQLException 471 { try { _res.updateByte(columnIndex, x); } catch (SQLException e) { handleException(e); } } 472 473 @Override 474 public void updateShort(int columnIndex, short x) throws SQLException 475 { try { _res.updateShort(columnIndex, x); } catch (SQLException e) { handleException(e); } } 476 477 @Override 478 public void updateInt(int columnIndex, int x) throws SQLException 479 { try { _res.updateInt(columnIndex, x); } catch (SQLException e) { handleException(e); } } 480 481 @Override 482 public void updateLong(int columnIndex, long x) throws SQLException 483 { try { _res.updateLong(columnIndex, x); } catch (SQLException e) { handleException(e); } } 484 485 @Override 486 public void updateFloat(int columnIndex, float x) throws SQLException 487 { try { _res.updateFloat(columnIndex, x); } catch (SQLException e) { handleException(e); } } 488 489 @Override 490 public void updateDouble(int columnIndex, double x) throws SQLException 491 { try { _res.updateDouble(columnIndex, x); } catch (SQLException e) { handleException(e); } } 492 493 @Override 494 public void updateBigDecimal(int columnIndex, BigDecimal x) throws SQLException 495 { try { _res.updateBigDecimal(columnIndex, x); } catch (SQLException e) { handleException(e); } } 496 497 @Override 498 public void updateString(int columnIndex, String x) throws SQLException 499 { try { _res.updateString(columnIndex, x); } catch (SQLException e) { handleException(e); } } 500 501 @Override 502 public void updateBytes(int columnIndex, byte[] x) throws SQLException 503 { try { _res.updateBytes(columnIndex, x); } catch (SQLException e) { handleException(e); } } 504 505 @Override 506 public void updateDate(int columnIndex, Date x) throws SQLException 507 { try { _res.updateDate(columnIndex, x); } catch (SQLException e) { handleException(e); } } 508 509 @Override 510 public void updateTime(int columnIndex, Time x) throws SQLException 511 { try { _res.updateTime(columnIndex, x); } catch (SQLException e) { handleException(e); } } 512 513 @Override 514 public void updateTimestamp(int columnIndex, Timestamp x) throws SQLException 515 { try { _res.updateTimestamp(columnIndex, x); } catch (SQLException e) { handleException(e); } } 516 517 @Override 518 public void updateAsciiStream(int columnIndex, InputStream x, int length) throws SQLException 519 { try { _res.updateAsciiStream(columnIndex, x, length); } catch (SQLException e) { handleException(e); } } 520 521 @Override 522 public void updateBinaryStream(int columnIndex, InputStream x, int length) throws SQLException 523 { try { _res.updateBinaryStream(columnIndex, x, length); } catch (SQLException e) { handleException(e); } } 524 525 @Override 526 public void updateCharacterStream(int columnIndex, Reader x, int length) throws SQLException 527 { try { _res.updateCharacterStream(columnIndex, x, length); } catch (SQLException e) { handleException(e); } } 528 529 @Override 530 public void updateObject(int columnIndex, Object x, int scale) throws SQLException 531 { try { _res.updateObject(columnIndex, x); } catch (SQLException e) { handleException(e); } } 532 533 @Override 534 public void updateObject(int columnIndex, Object x) throws SQLException 535 { try { _res.updateObject(columnIndex, x); } catch (SQLException e) { handleException(e); } } 536 537 @Override 538 public void updateNull(String columnName) throws SQLException 539 { try { _res.updateNull(columnName); } catch (SQLException e) { handleException(e); } } 540 541 @Override 542 public void updateBoolean(String columnName, boolean x) throws SQLException 543 { try { _res.updateBoolean(columnName, x); } catch (SQLException e) { handleException(e); } } 544 545 @Override 546 public void updateByte(String columnName, byte x) throws SQLException 547 { try { _res.updateByte(columnName, x); } catch (SQLException e) { handleException(e); } } 548 549 @Override 550 public void updateShort(String columnName, short x) throws SQLException 551 { try { _res.updateShort(columnName, x); } catch (SQLException e) { handleException(e); } } 552 553 @Override 554 public void updateInt(String columnName, int x) throws SQLException 555 { try { _res.updateInt(columnName, x); } catch (SQLException e) { handleException(e); } } 556 557 @Override 558 public void updateLong(String columnName, long x) throws SQLException 559 { try { _res.updateLong(columnName, x); } catch (SQLException e) { handleException(e); } } 560 561 @Override 562 public void updateFloat(String columnName, float x) throws SQLException 563 { try { _res.updateFloat(columnName, x); } catch (SQLException e) { handleException(e); } } 564 565 @Override 566 public void updateDouble(String columnName, double x) throws SQLException 567 { try { _res.updateDouble(columnName, x); } catch (SQLException e) { handleException(e); } } 568 569 @Override 570 public void updateBigDecimal(String columnName, BigDecimal x) throws SQLException 571 { try { _res.updateBigDecimal(columnName, x); } catch (SQLException e) { handleException(e); } } 572 573 @Override 574 public void updateString(String columnName, String x) throws SQLException 575 { try { _res.updateString(columnName, x); } catch (SQLException e) { handleException(e); } } 576 577 @Override 578 public void updateBytes(String columnName, byte[] x) throws SQLException 579 { try { _res.updateBytes(columnName, x); } catch (SQLException e) { handleException(e); } } 580 581 @Override 582 public void updateDate(String columnName, Date x) throws SQLException 583 { try { _res.updateDate(columnName, x); } catch (SQLException e) { handleException(e); } } 584 585 @Override 586 public void updateTime(String columnName, Time x) throws SQLException 587 { try { _res.updateTime(columnName, x); } catch (SQLException e) { handleException(e); } } 588 589 @Override 590 public void updateTimestamp(String columnName, Timestamp x) throws SQLException 591 { try { _res.updateTimestamp(columnName, x); } catch (SQLException e) { handleException(e); } } 592 593 @Override 594 public void updateAsciiStream(String columnName, InputStream x, int length) throws SQLException 595 { try { _res.updateAsciiStream(columnName, x, length); } catch (SQLException e) { handleException(e); } } 596 597 @Override 598 public void updateBinaryStream(String columnName, InputStream x, int length) throws SQLException 599 { try { _res.updateBinaryStream(columnName, x, length); } catch (SQLException e) { handleException(e); } } 600 601 @Override 602 public void updateCharacterStream(String columnName, Reader reader, int length) throws SQLException 603 { try { _res.updateCharacterStream(columnName, reader, length); } catch (SQLException e) { handleException(e); } } 604 605 @Override 606 public void updateObject(String columnName, Object x, int scale) throws SQLException 607 { try { _res.updateObject(columnName, x); } catch (SQLException e) { handleException(e); } } 608 609 @Override 610 public void updateObject(String columnName, Object x) throws SQLException 611 { try { _res.updateObject(columnName, x); } catch (SQLException e) { handleException(e); } } 612 613 @Override 614 public void insertRow() throws SQLException 615 { try { _res.insertRow(); } catch (SQLException e) { handleException(e); } } 616 617 @Override 618 public void updateRow() throws SQLException 619 { try { _res.updateRow(); } catch (SQLException e) { handleException(e); } } 620 621 @Override 622 public void deleteRow() throws SQLException 623 { try { _res.deleteRow(); } catch (SQLException e) { handleException(e); } } 624 625 @Override 626 public void refreshRow() throws SQLException 627 { try { _res.refreshRow(); } catch (SQLException e) { handleException(e); } } 628 629 @Override 630 public void cancelRowUpdates() throws SQLException 631 { try { _res.cancelRowUpdates(); } catch (SQLException e) { handleException(e); } } 632 633 @Override 634 public void moveToInsertRow() throws SQLException 635 { try { _res.moveToInsertRow(); } catch (SQLException e) { handleException(e); } } 636 637 @Override 638 public void moveToCurrentRow() throws SQLException 639 { try { _res.moveToCurrentRow(); } catch (SQLException e) { handleException(e); } } 640 641 @Override 642 public Object getObject(int i, Map<String,Class<?>> map) throws SQLException 643 { try { return _res.getObject(i, map); } catch (SQLException e) { handleException(e); return null; } } 644 645 @Override 646 public Ref getRef(int i) throws SQLException 647 { try { return _res.getRef(i); } catch (SQLException e) { handleException(e); return null; } } 648 649 @Override 650 public Blob getBlob(int i) throws SQLException 651 { try { return _res.getBlob(i); } catch (SQLException e) { handleException(e); return null; } } 652 653 @Override 654 public Clob getClob(int i) throws SQLException 655 { try { return _res.getClob(i); } catch (SQLException e) { handleException(e); return null; } } 656 657 @Override 658 public Array getArray(int i) throws SQLException 659 { try { return _res.getArray(i); } catch (SQLException e) { handleException(e); return null; } } 660 661 @Override 662 public Object getObject(String colName, Map<String,Class<?>> map) throws SQLException 663 { try { return _res.getObject(colName, map); } catch (SQLException e) { handleException(e); return null; } } 664 665 @Override 666 public Ref getRef(String colName) throws SQLException 667 { try { return _res.getRef(colName); } catch (SQLException e) { handleException(e); return null; } } 668 669 @Override 670 public Blob getBlob(String colName) throws SQLException 671 { try { return _res.getBlob(colName); } catch (SQLException e) { handleException(e); return null; } } 672 673 @Override 674 public Clob getClob(String colName) throws SQLException 675 { try { return _res.getClob(colName); } catch (SQLException e) { handleException(e); return null; } } 676 677 @Override 678 public Array getArray(String colName) throws SQLException 679 { try { return _res.getArray(colName); } catch (SQLException e) { handleException(e); return null; } } 680 681 @Override 682 public Date getDate(int columnIndex, Calendar cal) throws SQLException 683 { try { return _res.getDate(columnIndex, cal); } catch (SQLException e) { handleException(e); return null; } } 684 685 @Override 686 public Date getDate(String columnName, Calendar cal) throws SQLException 687 { try { return _res.getDate(columnName, cal); } catch (SQLException e) { handleException(e); return null; } } 688 689 @Override 690 public Time getTime(int columnIndex, Calendar cal) throws SQLException 691 { try { return _res.getTime(columnIndex, cal); } catch (SQLException e) { handleException(e); return null; } } 692 693 @Override 694 public Time getTime(String columnName, Calendar cal) throws SQLException 695 { try { return _res.getTime(columnName, cal); } catch (SQLException e) { handleException(e); return null; } } 696 697 @Override 698 public Timestamp getTimestamp(int columnIndex, Calendar cal) throws SQLException 699 { try { return _res.getTimestamp(columnIndex, cal); } catch (SQLException e) { handleException(e); return null; } } 700 701 @Override 702 public Timestamp getTimestamp(String columnName, Calendar cal) throws SQLException 703 { try { return _res.getTimestamp(columnName, cal); } catch (SQLException e) { handleException(e); return null; } } 704 705 706 @Override 707 public java.net.URL getURL(int columnIndex) throws SQLException 708 { try { return _res.getURL(columnIndex); } catch (SQLException e) { handleException(e); return null; } } 709 710 @Override 711 public java.net.URL getURL(String columnName) throws SQLException 712 { try { return _res.getURL(columnName); } catch (SQLException e) { handleException(e); return null; } } 713 714 @Override 715 public void updateRef(int columnIndex, Ref x) throws SQLException 716 { try { _res.updateRef(columnIndex, x); } catch (SQLException e) { handleException(e); } } 717 718 @Override 719 public void updateRef(String columnName, Ref x) throws SQLException 720 { try { _res.updateRef(columnName, x); } catch (SQLException e) { handleException(e); } } 721 722 @Override 723 public void updateBlob(int columnIndex, Blob x) throws SQLException 724 { try { _res.updateBlob(columnIndex, x); } catch (SQLException e) { handleException(e); } } 725 726 @Override 727 public void updateBlob(String columnName, Blob x) throws SQLException 728 { try { _res.updateBlob(columnName, x); } catch (SQLException e) { handleException(e); } } 729 730 @Override 731 public void updateClob(int columnIndex, Clob x) throws SQLException 732 { try { _res.updateClob(columnIndex, x); } catch (SQLException e) { handleException(e); } } 733 734 @Override 735 public void updateClob(String columnName, Clob x) throws SQLException 736 { try { _res.updateClob(columnName, x); } catch (SQLException e) { handleException(e); } } 737 738 @Override 739 public void updateArray(int columnIndex, Array x) throws SQLException 740 { try { _res.updateArray(columnIndex, x); } catch (SQLException e) { handleException(e); } } 741 742 @Override 743 public void updateArray(String columnName, Array x) throws SQLException 744 { try { _res.updateArray(columnName, x); } catch (SQLException e) { handleException(e); } } 745 746 747 @Override 748 public boolean isWrapperFor(Class<?> iface) throws SQLException { 749 if (iface.isAssignableFrom(getClass())) { 750 return true; 751 } else if (iface.isAssignableFrom(_res.getClass())) { 752 return true; 753 } else { 754 return _res.isWrapperFor(iface); 755 } 756 } 757 758 @Override 759 public <T> T unwrap(Class<T> iface) throws SQLException { 760 if (iface.isAssignableFrom(getClass())) { 761 return iface.cast(this); 762 } else if (iface.isAssignableFrom(_res.getClass())) { 763 return iface.cast(_res); 764 } else { 765 return _res.unwrap(iface); 766 } 767 } 768 769 @Override 770 public RowId getRowId(int columnIndex) throws SQLException { 771 try { 772 return _res.getRowId(columnIndex); 773 } 774 catch (SQLException e) { 775 handleException(e); 776 return null; 777 } 778 } 779 780 @Override 781 public RowId getRowId(String columnLabel) throws SQLException { 782 try { 783 return _res.getRowId(columnLabel); 784 } 785 catch (SQLException e) { 786 handleException(e); 787 return null; 788 } 789 } 790 791 @Override 792 public void updateRowId(int columnIndex, RowId value) throws SQLException { 793 try { 794 _res.updateRowId(columnIndex, value); 795 } 796 catch (SQLException e) { 797 handleException(e); 798 } 799 } 800 801 @Override 802 public void updateRowId(String columnLabel, RowId value) throws SQLException { 803 try { 804 _res.updateRowId(columnLabel, value); 805 } 806 catch (SQLException e) { 807 handleException(e); 808 } 809 } 810 811 @Override 812 public int getHoldability() throws SQLException { 813 try { 814 return _res.getHoldability(); 815 } 816 catch (SQLException e) { 817 handleException(e); 818 return 0; 819 } 820 } 821 822 @Override 823 public boolean isClosed() throws SQLException { 824 try { 825 return _res.isClosed(); 826 } 827 catch (SQLException e) { 828 handleException(e); 829 return false; 830 } 831 } 832 833 @Override 834 public void updateNString(int columnIndex, String value) throws SQLException { 835 try { 836 _res.updateNString(columnIndex, value); 837 } 838 catch (SQLException e) { 839 handleException(e); 840 } 841 } 842 843 @Override 844 public void updateNString(String columnLabel, String value) throws SQLException { 845 try { 846 _res.updateNString(columnLabel, value); 847 } 848 catch (SQLException e) { 849 handleException(e); 850 } 851 } 852 853 @Override 854 public void updateNClob(int columnIndex, NClob value) throws SQLException { 855 try { 856 _res.updateNClob(columnIndex, value); 857 } 858 catch (SQLException e) { 859 handleException(e); 860 } 861 } 862 863 @Override 864 public void updateNClob(String columnLabel, NClob value) throws SQLException { 865 try { 866 _res.updateNClob(columnLabel, value); 867 } 868 catch (SQLException e) { 869 handleException(e); 870 } 871 } 872 873 @Override 874 public NClob getNClob(int columnIndex) throws SQLException { 875 try { 876 return _res.getNClob(columnIndex); 877 } 878 catch (SQLException e) { 879 handleException(e); 880 return null; 881 } 882 } 883 884 @Override 885 public NClob getNClob(String columnLabel) throws SQLException { 886 try { 887 return _res.getNClob(columnLabel); 888 } 889 catch (SQLException e) { 890 handleException(e); 891 return null; 892 } 893 } 894 895 @Override 896 public SQLXML getSQLXML(int columnIndex) throws SQLException { 897 try { 898 return _res.getSQLXML(columnIndex); 899 } 900 catch (SQLException e) { 901 handleException(e); 902 return null; 903 } 904 } 905 906 @Override 907 public SQLXML getSQLXML(String columnLabel) throws SQLException { 908 try { 909 return _res.getSQLXML(columnLabel); 910 } 911 catch (SQLException e) { 912 handleException(e); 913 return null; 914 } 915 } 916 917 @Override 918 public void updateSQLXML(int columnIndex, SQLXML value) throws SQLException { 919 try { 920 _res.updateSQLXML(columnIndex, value); 921 } 922 catch (SQLException e) { 923 handleException(e); 924 } 925 } 926 927 @Override 928 public void updateSQLXML(String columnLabel, SQLXML value) throws SQLException { 929 try { 930 _res.updateSQLXML(columnLabel, value); 931 } 932 catch (SQLException e) { 933 handleException(e); 934 } 935 } 936 937 @Override 938 public String getNString(int columnIndex) throws SQLException { 939 try { 940 return _res.getNString(columnIndex); 941 } 942 catch (SQLException e) { 943 handleException(e); 944 return null; 945 } 946 } 947 948 @Override 949 public String getNString(String columnLabel) throws SQLException { 950 try { 951 return _res.getNString(columnLabel); 952 } 953 catch (SQLException e) { 954 handleException(e); 955 return null; 956 } 957 } 958 959 @Override 960 public Reader getNCharacterStream(int columnIndex) throws SQLException { 961 try { 962 return _res.getNCharacterStream(columnIndex); 963 } 964 catch (SQLException e) { 965 handleException(e); 966 return null; 967 } 968 } 969 970 @Override 971 public Reader getNCharacterStream(String columnLabel) throws SQLException { 972 try { 973 return _res.getNCharacterStream(columnLabel); 974 } 975 catch (SQLException e) { 976 handleException(e); 977 return null; 978 } 979 } 980 981 @Override 982 public void updateNCharacterStream(int columnIndex, Reader reader, long length) throws SQLException { 983 try { 984 _res.updateNCharacterStream(columnIndex, reader, length); 985 } 986 catch (SQLException e) { 987 handleException(e); 988 } 989 } 990 991 @Override 992 public void updateNCharacterStream(String columnLabel, Reader reader, long length) throws SQLException { 993 try { 994 _res.updateNCharacterStream(columnLabel, reader, length); 995 } 996 catch (SQLException e) { 997 handleException(e); 998 } 999 } 1000 1001 @Override 1002 public void updateAsciiStream(int columnIndex, InputStream inputStream, long length) throws SQLException { 1003 try { 1004 _res.updateAsciiStream(columnIndex, inputStream, length); 1005 } 1006 catch (SQLException e) { 1007 handleException(e); 1008 } 1009 } 1010 1011 @Override 1012 public void updateBinaryStream(int columnIndex, InputStream inputStream, long length) throws SQLException { 1013 try { 1014 _res.updateBinaryStream(columnIndex, inputStream, length); 1015 } 1016 catch (SQLException e) { 1017 handleException(e); 1018 } 1019 } 1020 1021 @Override 1022 public void updateCharacterStream(int columnIndex, Reader reader, long length) throws SQLException { 1023 try { 1024 _res.updateCharacterStream(columnIndex, reader, length); 1025 } 1026 catch (SQLException e) { 1027 handleException(e); 1028 } 1029 } 1030 1031 @Override 1032 public void updateAsciiStream(String columnLabel, InputStream inputStream, long length) throws SQLException { 1033 try { 1034 _res.updateAsciiStream(columnLabel, inputStream, length); 1035 } 1036 catch (SQLException e) { 1037 handleException(e); 1038 } 1039 } 1040 1041 @Override 1042 public void updateBinaryStream(String columnLabel, InputStream inputStream, long length) throws SQLException { 1043 try { 1044 _res.updateBinaryStream(columnLabel, inputStream, length); 1045 } 1046 catch (SQLException e) { 1047 handleException(e); 1048 } 1049 } 1050 1051 @Override 1052 public void updateCharacterStream(String columnLabel, Reader reader, long length) throws SQLException { 1053 try { 1054 _res.updateCharacterStream(columnLabel, reader, length); 1055 } 1056 catch (SQLException e) { 1057 handleException(e); 1058 } 1059 } 1060 1061 @Override 1062 public void updateBlob(int columnIndex, InputStream inputStream, long length) throws SQLException { 1063 try { 1064 _res.updateBlob(columnIndex, inputStream, length); 1065 } 1066 catch (SQLException e) { 1067 handleException(e); 1068 } 1069 } 1070 1071 @Override 1072 public void updateBlob(String columnLabel, InputStream inputStream, long length) throws SQLException { 1073 try { 1074 _res.updateBlob(columnLabel, inputStream, length); 1075 } 1076 catch (SQLException e) { 1077 handleException(e); 1078 } 1079 } 1080 1081 @Override 1082 public void updateClob(int columnIndex, Reader reader, long length) throws SQLException { 1083 try { 1084 _res.updateClob(columnIndex, reader, length); 1085 } 1086 catch (SQLException e) { 1087 handleException(e); 1088 } 1089 } 1090 1091 @Override 1092 public void updateClob(String columnLabel, Reader reader, long length) throws SQLException { 1093 try { 1094 _res.updateClob(columnLabel, reader, length); 1095 } 1096 catch (SQLException e) { 1097 handleException(e); 1098 } 1099 } 1100 1101 @Override 1102 public void updateNClob(int columnIndex, Reader reader, long length) throws SQLException { 1103 try { 1104 _res.updateNClob(columnIndex, reader, length); 1105 } 1106 catch (SQLException e) { 1107 handleException(e); 1108 } 1109 } 1110 1111 @Override 1112 public void updateNClob(String columnLabel, Reader reader, long length) throws SQLException { 1113 try { 1114 _res.updateNClob(columnLabel, reader, length); 1115 } 1116 catch (SQLException e) { 1117 handleException(e); 1118 } 1119 } 1120 1121 @Override 1122 public void updateNCharacterStream(int columnIndex, Reader reader) throws SQLException { 1123 try { 1124 _res.updateNCharacterStream(columnIndex, reader); 1125 } 1126 catch (SQLException e) { 1127 handleException(e); 1128 } 1129 } 1130 1131 @Override 1132 public void updateNCharacterStream(String columnLabel, Reader reader) throws SQLException { 1133 try { 1134 _res.updateNCharacterStream(columnLabel, reader); 1135 } 1136 catch (SQLException e) { 1137 handleException(e); 1138 } 1139 } 1140 1141 @Override 1142 public void updateAsciiStream(int columnIndex, InputStream inputStream) throws SQLException { 1143 try { 1144 _res.updateAsciiStream(columnIndex, inputStream); 1145 } 1146 catch (SQLException e) { 1147 handleException(e); 1148 } 1149 } 1150 1151 @Override 1152 public void updateBinaryStream(int columnIndex, InputStream inputStream) throws SQLException { 1153 try { 1154 _res.updateBinaryStream(columnIndex, inputStream); 1155 } 1156 catch (SQLException e) { 1157 handleException(e); 1158 } 1159 } 1160 1161 @Override 1162 public void updateCharacterStream(int columnIndex, Reader reader) throws SQLException { 1163 try { 1164 _res.updateCharacterStream(columnIndex, reader); 1165 } 1166 catch (SQLException e) { 1167 handleException(e); 1168 } 1169 } 1170 1171 @Override 1172 public void updateAsciiStream(String columnLabel, InputStream inputStream) throws SQLException { 1173 try { 1174 _res.updateAsciiStream(columnLabel, inputStream); 1175 } 1176 catch (SQLException e) { 1177 handleException(e); 1178 } 1179 } 1180 1181 @Override 1182 public void updateBinaryStream(String columnLabel, InputStream inputStream) throws SQLException { 1183 try { 1184 _res.updateBinaryStream(columnLabel, inputStream); 1185 } 1186 catch (SQLException e) { 1187 handleException(e); 1188 } 1189 } 1190 1191 @Override 1192 public void updateCharacterStream(String columnLabel, Reader reader) throws SQLException { 1193 try { 1194 _res.updateCharacterStream(columnLabel, reader); 1195 } 1196 catch (SQLException e) { 1197 handleException(e); 1198 } 1199 } 1200 1201 @Override 1202 public void updateBlob(int columnIndex, InputStream inputStream) throws SQLException { 1203 try { 1204 _res.updateBlob(columnIndex, inputStream); 1205 } 1206 catch (SQLException e) { 1207 handleException(e); 1208 } 1209 } 1210 1211 @Override 1212 public void updateBlob(String columnLabel, InputStream inputStream) throws SQLException { 1213 try { 1214 _res.updateBlob(columnLabel, inputStream); 1215 } 1216 catch (SQLException e) { 1217 handleException(e); 1218 } 1219 } 1220 1221 @Override 1222 public void updateClob(int columnIndex, Reader reader) throws SQLException { 1223 try { 1224 _res.updateClob(columnIndex, reader); 1225 } 1226 catch (SQLException e) { 1227 handleException(e); 1228 } 1229 } 1230 1231 @Override 1232 public void updateClob(String columnLabel, Reader reader) throws SQLException { 1233 try { 1234 _res.updateClob(columnLabel, reader); 1235 } 1236 catch (SQLException e) { 1237 handleException(e); 1238 } 1239 } 1240 1241 @Override 1242 public void updateNClob(int columnIndex, Reader reader) throws SQLException { 1243 try { 1244 _res.updateNClob(columnIndex, reader); 1245 } 1246 catch (SQLException e) { 1247 handleException(e); 1248 } 1249 } 1250 1251 @Override 1252 public void updateNClob(String columnLabel, Reader reader) throws SQLException { 1253 try { 1254 _res.updateNClob(columnLabel, reader); 1255 } 1256 catch (SQLException e) { 1257 handleException(e); 1258 } 1259 } 1260 1261 @Override 1262 public <T> T getObject(int columnIndex, Class<T> type) throws SQLException { 1263 try { 1264 return _res.getObject(columnIndex, type); 1265 } 1266 catch (SQLException e) { 1267 handleException(e); 1268 return null; 1269 } 1270 } 1271 1272 @Override 1273 public <T> T getObject(String columnLabel, Class<T> type) 1274 throws SQLException { 1275 try { 1276 return _res.getObject(columnLabel, type); 1277 } 1278 catch (SQLException e) { 1279 handleException(e); 1280 return null; 1281 } 1282 } 1283}