0001: /*
0002: * JBoss, Home of Professional Open Source.
0003: * Copyright 2006, Red Hat Middleware LLC, and individual contributors
0004: * as indicated by the @author tags. See the copyright.txt file in the
0005: * distribution for a full listing of individual contributors.
0006: *
0007: * This is free software; you can redistribute it and/or modify it
0008: * under the terms of the GNU Lesser General Public License as
0009: * published by the Free Software Foundation; either version 2.1 of
0010: * the License, or (at your option) any later version.
0011: *
0012: * This software is distributed in the hope that it will be useful,
0013: * but WITHOUT ANY WARRANTY; without even the implied warranty of
0014: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
0015: * Lesser General Public License for more details.
0016: *
0017: * You should have received a copy of the GNU Lesser General Public
0018: * License along with this software; if not, write to the Free
0019: * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
0020: * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
0021: */
0022: package org.jboss.resource.adapter.jdbc;
0023:
0024: import java.io.InputStream;
0025: import java.io.Reader;
0026: import java.math.BigDecimal;
0027: import java.net.URL;
0028: import java.sql.Array;
0029: import java.sql.Blob;
0030: import java.sql.Clob;
0031: import java.sql.Date;
0032: import java.sql.Ref;
0033: import java.sql.ResultSet;
0034: import java.sql.ResultSetMetaData;
0035: import java.sql.SQLException;
0036: import java.sql.SQLWarning;
0037: import java.sql.Statement;
0038: import java.sql.Time;
0039: import java.sql.Timestamp;
0040: import java.util.Calendar;
0041: import java.util.Map;
0042:
0043: /**
0044: * A wrapper for a result set
0045: *
0046: * @author <a href="mailto:adrian@jboss.com">Adrian Brock</a>
0047: * @author <a href="weston.price@jboss.com">Weston Price</a>
0048: * @version $Revision: 57189 $
0049: */
0050: public class WrappedResultSet implements ResultSet {
0051: /** The wrapped statement */
0052: private WrappedStatement statement;
0053:
0054: /** The real result set */
0055: private ResultSet resultSet;
0056:
0057: /** Whether we are closed */
0058: private boolean closed = false;
0059:
0060: /** The state lock */
0061: private Object lock = new Object();
0062:
0063: /**
0064: * Create a new wrapped result set
0065: *
0066: * @param statement the wrapped statement
0067: * @param resultSet the real result set
0068: */
0069: public WrappedResultSet(WrappedStatement statement,
0070: ResultSet resultSet) {
0071: if (statement == null)
0072: throw new IllegalArgumentException("Null statement!");
0073: if (resultSet == null)
0074: throw new IllegalArgumentException("Null result set!");
0075: this .statement = statement;
0076: this .resultSet = resultSet;
0077: }
0078:
0079: public boolean equals(Object o) {
0080: if (o == null)
0081: return false;
0082: else if (o == this )
0083: return true;
0084: else if (o instanceof WrappedResultSet)
0085: return (resultSet.equals(((WrappedResultSet) o).resultSet));
0086: else if (o instanceof ResultSet)
0087: return resultSet.equals(o);
0088: return false;
0089: }
0090:
0091: public int hashCode() {
0092: return resultSet.hashCode();
0093: }
0094:
0095: public String toString() {
0096: return resultSet.toString();
0097: }
0098:
0099: public ResultSet getUnderlyingResultSet() throws SQLException {
0100: checkState();
0101: return resultSet;
0102: }
0103:
0104: public boolean absolute(int row) throws SQLException {
0105: checkState();
0106: try {
0107: return resultSet.absolute(row);
0108: } catch (Throwable t) {
0109: throw checkException(t);
0110: }
0111: }
0112:
0113: public void afterLast() throws SQLException {
0114: checkState();
0115: try {
0116: resultSet.afterLast();
0117: } catch (Throwable t) {
0118: throw checkException(t);
0119: }
0120: }
0121:
0122: public void beforeFirst() throws SQLException {
0123: checkState();
0124: try {
0125: resultSet.beforeFirst();
0126: } catch (Throwable t) {
0127: throw checkException(t);
0128: }
0129: }
0130:
0131: public void cancelRowUpdates() throws SQLException {
0132: checkState();
0133: try {
0134: resultSet.cancelRowUpdates();
0135: } catch (Throwable t) {
0136: throw checkException(t);
0137: }
0138: }
0139:
0140: public void clearWarnings() throws SQLException {
0141: checkState();
0142: try {
0143: resultSet.clearWarnings();
0144: } catch (Throwable t) {
0145: throw checkException(t);
0146: }
0147: }
0148:
0149: public void close() throws SQLException {
0150: synchronized (lock) {
0151: if (closed)
0152: return;
0153: closed = true;
0154:
0155: }
0156: statement.unregisterResultSet(this );
0157: internalClose();
0158: }
0159:
0160: public void deleteRow() throws SQLException {
0161: checkState();
0162: try {
0163: resultSet.deleteRow();
0164: } catch (Throwable t) {
0165: throw checkException(t);
0166: }
0167: }
0168:
0169: public int findColumn(String columnName) throws SQLException {
0170: checkState();
0171: try {
0172: return resultSet.findColumn(columnName);
0173: } catch (Throwable t) {
0174: throw checkException(t);
0175: }
0176: }
0177:
0178: public boolean first() throws SQLException {
0179: checkState();
0180: try {
0181: return resultSet.first();
0182: } catch (Throwable t) {
0183: throw checkException(t);
0184: }
0185: }
0186:
0187: public Array getArray(int i) throws SQLException {
0188: checkState();
0189: try {
0190: return resultSet.getArray(i);
0191: } catch (Throwable t) {
0192: throw checkException(t);
0193: }
0194: }
0195:
0196: public Array getArray(String colName) throws SQLException {
0197: checkState();
0198: try {
0199: return resultSet.getArray(colName);
0200: } catch (Throwable t) {
0201: throw checkException(t);
0202: }
0203: }
0204:
0205: public InputStream getAsciiStream(int columnIndex)
0206: throws SQLException {
0207: checkState();
0208: try {
0209: return resultSet.getAsciiStream(columnIndex);
0210: } catch (Throwable t) {
0211: throw checkException(t);
0212: }
0213: }
0214:
0215: public InputStream getAsciiStream(String columnName)
0216: throws SQLException {
0217: checkState();
0218: try {
0219: return resultSet.getAsciiStream(columnName);
0220: } catch (Throwable t) {
0221: throw checkException(t);
0222: }
0223: }
0224:
0225: public BigDecimal getBigDecimal(int columnIndex)
0226: throws SQLException {
0227: checkState();
0228: try {
0229: return resultSet.getBigDecimal(columnIndex);
0230: } catch (Throwable t) {
0231: throw checkException(t);
0232: }
0233: }
0234:
0235: /**
0236: * @deprecated
0237: */
0238: public BigDecimal getBigDecimal(int columnIndex, int scale)
0239: throws SQLException {
0240: checkState();
0241: try {
0242: return resultSet.getBigDecimal(columnIndex, scale);
0243: } catch (Throwable t) {
0244: throw checkException(t);
0245: }
0246: }
0247:
0248: public BigDecimal getBigDecimal(String columnName)
0249: throws SQLException {
0250: checkState();
0251: try {
0252: return resultSet.getBigDecimal(columnName);
0253: } catch (Throwable t) {
0254: throw checkException(t);
0255: }
0256: }
0257:
0258: /**
0259: * @deprecated
0260: */
0261: public BigDecimal getBigDecimal(String columnName, int scale)
0262: throws SQLException {
0263: checkState();
0264: try {
0265: return resultSet.getBigDecimal(columnName, scale);
0266: } catch (Throwable t) {
0267: throw checkException(t);
0268: }
0269: }
0270:
0271: public InputStream getBinaryStream(int columnIndex)
0272: throws SQLException {
0273: checkState();
0274: try {
0275: return resultSet.getBinaryStream(columnIndex);
0276: } catch (Throwable t) {
0277: throw checkException(t);
0278: }
0279: }
0280:
0281: public InputStream getBinaryStream(String columnName)
0282: throws SQLException {
0283: checkState();
0284: try {
0285: return resultSet.getBinaryStream(columnName);
0286: } catch (Throwable t) {
0287: throw checkException(t);
0288: }
0289: }
0290:
0291: public Blob getBlob(int i) throws SQLException {
0292: checkState();
0293: try {
0294: return resultSet.getBlob(i);
0295: } catch (Throwable t) {
0296: throw checkException(t);
0297: }
0298: }
0299:
0300: public Blob getBlob(String colName) throws SQLException {
0301: checkState();
0302: try {
0303: return resultSet.getBlob(colName);
0304: } catch (Throwable t) {
0305: throw checkException(t);
0306: }
0307: }
0308:
0309: public boolean getBoolean(int columnIndex) throws SQLException {
0310: checkState();
0311: try {
0312: return resultSet.getBoolean(columnIndex);
0313: } catch (Throwable t) {
0314: throw checkException(t);
0315: }
0316: }
0317:
0318: public boolean getBoolean(String columnName) throws SQLException {
0319: checkState();
0320: try {
0321: return resultSet.getBoolean(columnName);
0322: } catch (Throwable t) {
0323: throw checkException(t);
0324: }
0325: }
0326:
0327: public byte getByte(int columnIndex) throws SQLException {
0328: checkState();
0329: try {
0330: return resultSet.getByte(columnIndex);
0331: } catch (Throwable t) {
0332: throw checkException(t);
0333: }
0334: }
0335:
0336: public byte getByte(String columnName) throws SQLException {
0337: checkState();
0338: try {
0339: return resultSet.getByte(columnName);
0340: } catch (Throwable t) {
0341: throw checkException(t);
0342: }
0343: }
0344:
0345: public byte[] getBytes(int columnIndex) throws SQLException {
0346: checkState();
0347: try {
0348: return resultSet.getBytes(columnIndex);
0349: } catch (Throwable t) {
0350: throw checkException(t);
0351: }
0352: }
0353:
0354: public byte[] getBytes(String columnName) throws SQLException {
0355: checkState();
0356: try {
0357: return resultSet.getBytes(columnName);
0358: } catch (Throwable t) {
0359: throw checkException(t);
0360: }
0361: }
0362:
0363: public Reader getCharacterStream(int columnIndex)
0364: throws SQLException {
0365: checkState();
0366: try {
0367: return resultSet.getCharacterStream(columnIndex);
0368: } catch (Throwable t) {
0369: throw checkException(t);
0370: }
0371: }
0372:
0373: public Reader getCharacterStream(String columnName)
0374: throws SQLException {
0375: checkState();
0376: try {
0377: return resultSet.getCharacterStream(columnName);
0378: } catch (Throwable t) {
0379: throw checkException(t);
0380: }
0381: }
0382:
0383: public Clob getClob(int i) throws SQLException {
0384: checkState();
0385: try {
0386: return resultSet.getClob(i);
0387: } catch (Throwable t) {
0388: throw checkException(t);
0389: }
0390: }
0391:
0392: public Clob getClob(String colName) throws SQLException {
0393: checkState();
0394: try {
0395: return resultSet.getClob(colName);
0396: } catch (Throwable t) {
0397: throw checkException(t);
0398: }
0399: }
0400:
0401: public int getConcurrency() throws SQLException {
0402: checkState();
0403: try {
0404: return resultSet.getConcurrency();
0405: } catch (Throwable t) {
0406: throw checkException(t);
0407: }
0408: }
0409:
0410: public String getCursorName() throws SQLException {
0411: checkState();
0412: try {
0413: return resultSet.getCursorName();
0414: } catch (Throwable t) {
0415: throw checkException(t);
0416: }
0417: }
0418:
0419: public Date getDate(int columnIndex) throws SQLException {
0420: checkState();
0421: try {
0422: return resultSet.getDate(columnIndex);
0423: } catch (Throwable t) {
0424: throw checkException(t);
0425: }
0426: }
0427:
0428: public Date getDate(int columnIndex, Calendar cal)
0429: throws SQLException {
0430: checkState();
0431: try {
0432: return resultSet.getDate(columnIndex, cal);
0433: } catch (Throwable t) {
0434: throw checkException(t);
0435: }
0436: }
0437:
0438: public Date getDate(String columnName) throws SQLException {
0439: checkState();
0440: try {
0441: return resultSet.getDate(columnName);
0442: } catch (Throwable t) {
0443: throw checkException(t);
0444: }
0445: }
0446:
0447: public Date getDate(String columnName, Calendar cal)
0448: throws SQLException {
0449: checkState();
0450: try {
0451: return resultSet.getDate(columnName, cal);
0452: } catch (Throwable t) {
0453: throw checkException(t);
0454: }
0455: }
0456:
0457: public double getDouble(int columnIndex) throws SQLException {
0458: checkState();
0459: try {
0460: return resultSet.getDouble(columnIndex);
0461: } catch (Throwable t) {
0462: throw checkException(t);
0463: }
0464: }
0465:
0466: public double getDouble(String columnName) throws SQLException {
0467: checkState();
0468: try {
0469: return resultSet.getDouble(columnName);
0470: } catch (Throwable t) {
0471: throw checkException(t);
0472: }
0473: }
0474:
0475: public int getFetchDirection() throws SQLException {
0476: checkState();
0477: try {
0478: return resultSet.getFetchDirection();
0479: } catch (Throwable t) {
0480: throw checkException(t);
0481: }
0482: }
0483:
0484: public int getFetchSize() throws SQLException {
0485: checkState();
0486: try {
0487: return resultSet.getFetchSize();
0488: } catch (Throwable t) {
0489: throw checkException(t);
0490: }
0491: }
0492:
0493: public float getFloat(int columnIndex) throws SQLException {
0494: checkState();
0495: try {
0496: return resultSet.getFloat(columnIndex);
0497: } catch (Throwable t) {
0498: throw checkException(t);
0499: }
0500: }
0501:
0502: public float getFloat(String columnName) throws SQLException {
0503: checkState();
0504: try {
0505: return resultSet.getFloat(columnName);
0506: } catch (Throwable t) {
0507: throw checkException(t);
0508: }
0509: }
0510:
0511: public int getInt(int columnIndex) throws SQLException {
0512: checkState();
0513: try {
0514: return resultSet.getInt(columnIndex);
0515: } catch (Throwable t) {
0516: throw checkException(t);
0517: }
0518: }
0519:
0520: public int getInt(String columnName) throws SQLException {
0521: checkState();
0522: try {
0523: return resultSet.getInt(columnName);
0524: } catch (Throwable t) {
0525: throw checkException(t);
0526: }
0527: }
0528:
0529: public long getLong(int columnIndex) throws SQLException {
0530: checkState();
0531: try {
0532: return resultSet.getLong(columnIndex);
0533: } catch (Throwable t) {
0534: throw checkException(t);
0535: }
0536: }
0537:
0538: public long getLong(String columnName) throws SQLException {
0539: checkState();
0540: try {
0541: return resultSet.getLong(columnName);
0542: } catch (Throwable t) {
0543: throw checkException(t);
0544: }
0545: }
0546:
0547: public ResultSetMetaData getMetaData() throws SQLException {
0548: checkState();
0549: try {
0550: return resultSet.getMetaData();
0551: } catch (Throwable t) {
0552: throw checkException(t);
0553: }
0554: }
0555:
0556: public Object getObject(int columnIndex) throws SQLException {
0557: checkState();
0558: try {
0559: return resultSet.getObject(columnIndex);
0560: } catch (Throwable t) {
0561: throw checkException(t);
0562: }
0563: }
0564:
0565: public Object getObject(int i, Map map) throws SQLException {
0566: checkState();
0567: try {
0568: return resultSet.getObject(i, map);
0569: } catch (Throwable t) {
0570: throw checkException(t);
0571: }
0572: }
0573:
0574: public Object getObject(String columnName) throws SQLException {
0575: checkState();
0576: try {
0577: return resultSet.getObject(columnName);
0578: } catch (Throwable t) {
0579: throw checkException(t);
0580: }
0581: }
0582:
0583: public Object getObject(String colName, Map map)
0584: throws SQLException {
0585: checkState();
0586: try {
0587: return resultSet.getObject(colName, map);
0588: } catch (Throwable t) {
0589: throw checkException(t);
0590: }
0591: }
0592:
0593: public Ref getRef(int i) throws SQLException {
0594: checkState();
0595: try {
0596: return resultSet.getRef(i);
0597: } catch (Throwable t) {
0598: throw checkException(t);
0599: }
0600: }
0601:
0602: public Ref getRef(String colName) throws SQLException {
0603: checkState();
0604: try {
0605: return resultSet.getRef(colName);
0606: } catch (Throwable t) {
0607: throw checkException(t);
0608: }
0609: }
0610:
0611: public int getRow() throws SQLException {
0612: checkState();
0613: try {
0614: return resultSet.getRow();
0615: } catch (Throwable t) {
0616: throw checkException(t);
0617: }
0618: }
0619:
0620: public short getShort(int columnIndex) throws SQLException {
0621: checkState();
0622: try {
0623: return resultSet.getShort(columnIndex);
0624: } catch (Throwable t) {
0625: throw checkException(t);
0626: }
0627: }
0628:
0629: public short getShort(String columnName) throws SQLException {
0630: checkState();
0631: try {
0632: return resultSet.getShort(columnName);
0633: } catch (Throwable t) {
0634: throw checkException(t);
0635: }
0636: }
0637:
0638: public Statement getStatement() throws SQLException {
0639: checkState();
0640: return statement;
0641: }
0642:
0643: public String getString(int columnIndex) throws SQLException {
0644: checkState();
0645: try {
0646: return resultSet.getString(columnIndex);
0647: } catch (Throwable t) {
0648: throw checkException(t);
0649: }
0650: }
0651:
0652: public String getString(String columnName) throws SQLException {
0653: checkState();
0654: try {
0655: return resultSet.getString(columnName);
0656: } catch (Throwable t) {
0657: throw checkException(t);
0658: }
0659: }
0660:
0661: public Time getTime(int columnIndex) throws SQLException {
0662: checkState();
0663: try {
0664: return resultSet.getTime(columnIndex);
0665: } catch (Throwable t) {
0666: throw checkException(t);
0667: }
0668: }
0669:
0670: public Time getTime(int columnIndex, Calendar cal)
0671: throws SQLException {
0672: checkState();
0673: try {
0674: return resultSet.getTime(columnIndex, cal);
0675: } catch (Throwable t) {
0676: throw checkException(t);
0677: }
0678: }
0679:
0680: public Time getTime(String columnName) throws SQLException {
0681: checkState();
0682: try {
0683: return resultSet.getTime(columnName);
0684: } catch (Throwable t) {
0685: throw checkException(t);
0686: }
0687: }
0688:
0689: public Time getTime(String columnName, Calendar cal)
0690: throws SQLException {
0691: checkState();
0692: try {
0693: return resultSet.getTime(columnName, cal);
0694: } catch (Throwable t) {
0695: throw checkException(t);
0696: }
0697: }
0698:
0699: public Timestamp getTimestamp(int columnIndex) throws SQLException {
0700: checkState();
0701: try {
0702: return resultSet.getTimestamp(columnIndex);
0703: } catch (Throwable t) {
0704: throw checkException(t);
0705: }
0706: }
0707:
0708: public Timestamp getTimestamp(int columnIndex, Calendar cal)
0709: throws SQLException {
0710: checkState();
0711: try {
0712: return resultSet.getTimestamp(columnIndex, cal);
0713: } catch (Throwable t) {
0714: throw checkException(t);
0715: }
0716: }
0717:
0718: public Timestamp getTimestamp(String columnName)
0719: throws SQLException {
0720: checkState();
0721: try {
0722: return resultSet.getTimestamp(columnName);
0723: } catch (Throwable t) {
0724: throw checkException(t);
0725: }
0726: }
0727:
0728: public Timestamp getTimestamp(String columnName, Calendar cal)
0729: throws SQLException {
0730: checkState();
0731: try {
0732: return resultSet.getTimestamp(columnName, cal);
0733: } catch (Throwable t) {
0734: throw checkException(t);
0735: }
0736: }
0737:
0738: public int getType() throws SQLException {
0739: checkState();
0740: try {
0741: return resultSet.getType();
0742: } catch (Throwable t) {
0743: throw checkException(t);
0744: }
0745: }
0746:
0747: /**
0748: * @deprecated
0749: */
0750: public InputStream getUnicodeStream(int columnIndex)
0751: throws SQLException {
0752: checkState();
0753: try {
0754: return resultSet.getUnicodeStream(columnIndex);
0755: } catch (Throwable t) {
0756: throw checkException(t);
0757: }
0758: }
0759:
0760: /**
0761: * @deprecated
0762: */
0763: public InputStream getUnicodeStream(String columnName)
0764: throws SQLException {
0765: try {
0766: return resultSet.getUnicodeStream(columnName);
0767: } catch (Throwable t) {
0768: throw checkException(t);
0769: }
0770: }
0771:
0772: public URL getURL(int columnIndex) throws SQLException {
0773: checkState();
0774: try {
0775: return resultSet.getURL(columnIndex);
0776: } catch (Throwable t) {
0777: throw checkException(t);
0778: }
0779: }
0780:
0781: public URL getURL(String columnName) throws SQLException {
0782: checkState();
0783: try {
0784: return resultSet.getURL(columnName);
0785: } catch (Throwable t) {
0786: throw checkException(t);
0787: }
0788: }
0789:
0790: public SQLWarning getWarnings() throws SQLException {
0791: checkState();
0792: try {
0793: return resultSet.getWarnings();
0794: } catch (Throwable t) {
0795: throw checkException(t);
0796: }
0797: }
0798:
0799: public void insertRow() throws SQLException {
0800: checkState();
0801: try {
0802: resultSet.insertRow();
0803: } catch (Throwable t) {
0804: throw checkException(t);
0805: }
0806: }
0807:
0808: public boolean isAfterLast() throws SQLException {
0809: checkState();
0810: try {
0811: return resultSet.isAfterLast();
0812: } catch (Throwable t) {
0813: throw checkException(t);
0814: }
0815: }
0816:
0817: public boolean isBeforeFirst() throws SQLException {
0818: checkState();
0819: try {
0820: return resultSet.isBeforeFirst();
0821: } catch (Throwable t) {
0822: throw checkException(t);
0823: }
0824: }
0825:
0826: public boolean isFirst() throws SQLException {
0827: checkState();
0828: try {
0829: return resultSet.isFirst();
0830: } catch (Throwable t) {
0831: throw checkException(t);
0832: }
0833: }
0834:
0835: public boolean isLast() throws SQLException {
0836: checkState();
0837: try {
0838: return resultSet.isLast();
0839: } catch (Throwable t) {
0840: throw checkException(t);
0841: }
0842: }
0843:
0844: public boolean last() throws SQLException {
0845: checkState();
0846: try {
0847: return resultSet.last();
0848: } catch (Throwable t) {
0849: throw checkException(t);
0850: }
0851: }
0852:
0853: public void moveToCurrentRow() throws SQLException {
0854: checkState();
0855: try {
0856: resultSet.moveToCurrentRow();
0857: } catch (Throwable t) {
0858: throw checkException(t);
0859: }
0860: }
0861:
0862: public void moveToInsertRow() throws SQLException {
0863: checkState();
0864: try {
0865: resultSet.moveToInsertRow();
0866: } catch (Throwable t) {
0867: throw checkException(t);
0868: }
0869: }
0870:
0871: public boolean next() throws SQLException {
0872: checkState();
0873: try {
0874: return resultSet.next();
0875: } catch (Throwable t) {
0876: throw checkException(t);
0877: }
0878: }
0879:
0880: public boolean previous() throws SQLException {
0881: checkState();
0882: try {
0883: return resultSet.previous();
0884: } catch (Throwable t) {
0885: throw checkException(t);
0886: }
0887: }
0888:
0889: public void refreshRow() throws SQLException {
0890: checkState();
0891: try {
0892: resultSet.refreshRow();
0893: } catch (Throwable t) {
0894: throw checkException(t);
0895: }
0896: }
0897:
0898: public boolean relative(int rows) throws SQLException {
0899: checkState();
0900: try {
0901: return resultSet.relative(rows);
0902: } catch (Throwable t) {
0903: throw checkException(t);
0904: }
0905: }
0906:
0907: public boolean rowDeleted() throws SQLException {
0908: checkState();
0909: try {
0910: return resultSet.rowDeleted();
0911: } catch (Throwable t) {
0912: throw checkException(t);
0913: }
0914: }
0915:
0916: public boolean rowInserted() throws SQLException {
0917: checkState();
0918: try {
0919: return resultSet.rowInserted();
0920: } catch (Throwable t) {
0921: throw checkException(t);
0922: }
0923: }
0924:
0925: public boolean rowUpdated() throws SQLException {
0926: checkState();
0927: try {
0928: return resultSet.rowUpdated();
0929: } catch (Throwable t) {
0930: throw checkException(t);
0931: }
0932: }
0933:
0934: public void setFetchDirection(int direction) throws SQLException {
0935: checkState();
0936: try {
0937: resultSet.setFetchDirection(direction);
0938: } catch (Throwable t) {
0939: throw checkException(t);
0940: }
0941: }
0942:
0943: public void setFetchSize(int rows) throws SQLException {
0944: checkState();
0945: try {
0946: resultSet.setFetchSize(rows);
0947: } catch (Throwable t) {
0948: throw checkException(t);
0949: }
0950: }
0951:
0952: public void updateArray(int columnIndex, Array x)
0953: throws SQLException {
0954: checkState();
0955: try {
0956: resultSet.updateArray(columnIndex, x);
0957: } catch (Throwable t) {
0958: throw checkException(t);
0959: }
0960: }
0961:
0962: public void updateArray(String columnName, Array x)
0963: throws SQLException {
0964: checkState();
0965: try {
0966: resultSet.updateArray(columnName, x);
0967: } catch (Throwable t) {
0968: throw checkException(t);
0969: }
0970: }
0971:
0972: public void updateAsciiStream(int columnIndex, InputStream x,
0973: int length) throws SQLException {
0974: checkState();
0975: try {
0976: resultSet.updateAsciiStream(columnIndex, x, length);
0977: } catch (Throwable t) {
0978: throw checkException(t);
0979: }
0980: }
0981:
0982: public void updateAsciiStream(String columnName, InputStream x,
0983: int length) throws SQLException {
0984: checkState();
0985: try {
0986: resultSet.updateAsciiStream(columnName, x, length);
0987: } catch (Throwable t) {
0988: throw checkException(t);
0989: }
0990: }
0991:
0992: public void updateBigDecimal(int columnIndex, BigDecimal x)
0993: throws SQLException {
0994: checkState();
0995: try {
0996: resultSet.updateBigDecimal(columnIndex, x);
0997: } catch (Throwable t) {
0998: throw checkException(t);
0999: }
1000: }
1001:
1002: public void updateBigDecimal(String columnName, BigDecimal x)
1003: throws SQLException {
1004: checkState();
1005: try {
1006: resultSet.updateBigDecimal(columnName, x);
1007: } catch (Throwable t) {
1008: throw checkException(t);
1009: }
1010: }
1011:
1012: public void updateBinaryStream(int columnIndex, InputStream x,
1013: int length) throws SQLException {
1014: checkState();
1015: try {
1016: resultSet.updateBinaryStream(columnIndex, x, length);
1017: } catch (Throwable t) {
1018: throw checkException(t);
1019: }
1020: }
1021:
1022: public void updateBinaryStream(String columnName, InputStream x,
1023: int length) throws SQLException {
1024: checkState();
1025: try {
1026: resultSet.updateBinaryStream(columnName, x, length);
1027: } catch (Throwable t) {
1028: throw checkException(t);
1029: }
1030: }
1031:
1032: public void updateBlob(int columnIndex, Blob x) throws SQLException {
1033: checkState();
1034: try {
1035: resultSet.updateBlob(columnIndex, x);
1036: } catch (Throwable t) {
1037: throw checkException(t);
1038: }
1039: }
1040:
1041: public void updateBlob(String columnName, Blob x)
1042: throws SQLException {
1043: checkState();
1044: try {
1045: resultSet.updateBlob(columnName, x);
1046: } catch (Throwable t) {
1047: throw checkException(t);
1048: }
1049: }
1050:
1051: public void updateBoolean(int columnIndex, boolean x)
1052: throws SQLException {
1053: checkState();
1054: try {
1055: resultSet.updateBoolean(columnIndex, x);
1056: } catch (Throwable t) {
1057: throw checkException(t);
1058: }
1059: }
1060:
1061: public void updateBoolean(String columnName, boolean x)
1062: throws SQLException {
1063: checkState();
1064: try {
1065: resultSet.updateBoolean(columnName, x);
1066: } catch (Throwable t) {
1067: throw checkException(t);
1068: }
1069: }
1070:
1071: public void updateByte(int columnIndex, byte x) throws SQLException {
1072: checkState();
1073: try {
1074: resultSet.updateByte(columnIndex, x);
1075: } catch (Throwable t) {
1076: throw checkException(t);
1077: }
1078: }
1079:
1080: public void updateByte(String columnName, byte x)
1081: throws SQLException {
1082: checkState();
1083: try {
1084: resultSet.updateByte(columnName, x);
1085: } catch (Throwable t) {
1086: throw checkException(t);
1087: }
1088: }
1089:
1090: public void updateBytes(int columnIndex, byte[] x)
1091: throws SQLException {
1092: checkState();
1093: try {
1094: resultSet.updateBytes(columnIndex, x);
1095: } catch (Throwable t) {
1096: throw checkException(t);
1097: }
1098: }
1099:
1100: public void updateBytes(String columnName, byte[] x)
1101: throws SQLException {
1102: checkState();
1103: try {
1104: resultSet.updateBytes(columnName, x);
1105: } catch (Throwable t) {
1106: throw checkException(t);
1107: }
1108: }
1109:
1110: public void updateCharacterStream(int columnIndex, Reader x,
1111: int length) throws SQLException {
1112: checkState();
1113: try {
1114: resultSet.updateCharacterStream(columnIndex, x, length);
1115: } catch (Throwable t) {
1116: throw checkException(t);
1117: }
1118: }
1119:
1120: public void updateCharacterStream(String columnName, Reader reader,
1121: int length) throws SQLException {
1122: checkState();
1123: try {
1124: resultSet.updateCharacterStream(columnName, reader, length);
1125: } catch (Throwable t) {
1126: throw checkException(t);
1127: }
1128: }
1129:
1130: public void updateClob(int columnIndex, Clob x) throws SQLException {
1131: checkState();
1132: try {
1133: resultSet.updateClob(columnIndex, x);
1134: } catch (Throwable t) {
1135: throw checkException(t);
1136: }
1137: }
1138:
1139: public void updateClob(String columnName, Clob x)
1140: throws SQLException {
1141: checkState();
1142: try {
1143: resultSet.updateClob(columnName, x);
1144: } catch (Throwable t) {
1145: throw checkException(t);
1146: }
1147: }
1148:
1149: public void updateDate(int columnIndex, Date x) throws SQLException {
1150: checkState();
1151: try {
1152: resultSet.updateDate(columnIndex, x);
1153: } catch (Throwable t) {
1154: throw checkException(t);
1155: }
1156: }
1157:
1158: public void updateDate(String columnName, Date x)
1159: throws SQLException {
1160: checkState();
1161: try {
1162: resultSet.updateDate(columnName, x);
1163: } catch (Throwable t) {
1164: throw checkException(t);
1165: }
1166: }
1167:
1168: public void updateDouble(int columnIndex, double x)
1169: throws SQLException {
1170: checkState();
1171: try {
1172: resultSet.updateDouble(columnIndex, x);
1173: } catch (Throwable t) {
1174: throw checkException(t);
1175: }
1176: }
1177:
1178: public void updateDouble(String columnName, double x)
1179: throws SQLException {
1180: checkState();
1181: try {
1182: resultSet.updateDouble(columnName, x);
1183: } catch (Throwable t) {
1184: throw checkException(t);
1185: }
1186: }
1187:
1188: public void updateFloat(int columnIndex, float x)
1189: throws SQLException {
1190: checkState();
1191: try {
1192: resultSet.updateFloat(columnIndex, x);
1193: } catch (Throwable t) {
1194: throw checkException(t);
1195: }
1196: }
1197:
1198: public void updateFloat(String columnName, float x)
1199: throws SQLException {
1200: checkState();
1201: try {
1202: resultSet.updateFloat(columnName, x);
1203: } catch (Throwable t) {
1204: throw checkException(t);
1205: }
1206: }
1207:
1208: public void updateInt(int columnIndex, int x) throws SQLException {
1209: checkState();
1210: try {
1211: resultSet.updateInt(columnIndex, x);
1212: } catch (Throwable t) {
1213: throw checkException(t);
1214: }
1215: }
1216:
1217: public void updateInt(String columnName, int x) throws SQLException {
1218: checkState();
1219: try {
1220: resultSet.updateInt(columnName, x);
1221: } catch (Throwable t) {
1222: throw checkException(t);
1223: }
1224: }
1225:
1226: public void updateLong(int columnIndex, long x) throws SQLException {
1227: checkState();
1228: try {
1229: resultSet.updateLong(columnIndex, x);
1230: } catch (Throwable t) {
1231: throw checkException(t);
1232: }
1233: }
1234:
1235: public void updateLong(String columnName, long x)
1236: throws SQLException {
1237: checkState();
1238: try {
1239: resultSet.updateLong(columnName, x);
1240: } catch (Throwable t) {
1241: throw checkException(t);
1242: }
1243: }
1244:
1245: public void updateNull(int columnIndex) throws SQLException {
1246: checkState();
1247: try {
1248: resultSet.updateNull(columnIndex);
1249: } catch (Throwable t) {
1250: throw checkException(t);
1251: }
1252: }
1253:
1254: public void updateNull(String columnName) throws SQLException {
1255: checkState();
1256: try {
1257: resultSet.updateNull(columnName);
1258: } catch (Throwable t) {
1259: throw checkException(t);
1260: }
1261: }
1262:
1263: public void updateObject(int columnIndex, Object x)
1264: throws SQLException {
1265: checkState();
1266: try {
1267: resultSet.updateObject(columnIndex, x);
1268: } catch (Throwable t) {
1269: throw checkException(t);
1270: }
1271: }
1272:
1273: public void updateObject(int columnIndex, Object x, int scale)
1274: throws SQLException {
1275: checkState();
1276: try {
1277: resultSet.updateObject(columnIndex, x, scale);
1278: } catch (Throwable t) {
1279: throw checkException(t);
1280: }
1281: }
1282:
1283: public void updateObject(String columnName, Object x)
1284: throws SQLException {
1285: checkState();
1286: try {
1287: resultSet.updateObject(columnName, x);
1288: } catch (Throwable t) {
1289: throw checkException(t);
1290: }
1291: }
1292:
1293: public void updateObject(String columnName, Object x, int scale)
1294: throws SQLException {
1295: checkState();
1296: try {
1297: resultSet.updateObject(columnName, x, scale);
1298: } catch (Throwable t) {
1299: throw checkException(t);
1300: }
1301: }
1302:
1303: public void updateRef(int columnIndex, Ref x) throws SQLException {
1304: checkState();
1305: try {
1306: resultSet.updateRef(columnIndex, x);
1307: } catch (Throwable t) {
1308: throw checkException(t);
1309: }
1310: }
1311:
1312: public void updateRef(String columnName, Ref x) throws SQLException {
1313: checkState();
1314: try {
1315: resultSet.updateRef(columnName, x);
1316: } catch (Throwable t) {
1317: throw checkException(t);
1318: }
1319: }
1320:
1321: public void updateRow() throws SQLException {
1322: checkState();
1323: try {
1324: resultSet.updateRow();
1325: } catch (Throwable t) {
1326: throw checkException(t);
1327: }
1328: }
1329:
1330: public void updateShort(int columnIndex, short x)
1331: throws SQLException {
1332: checkState();
1333: try {
1334: resultSet.updateShort(columnIndex, x);
1335: } catch (Throwable t) {
1336: throw checkException(t);
1337: }
1338: }
1339:
1340: public void updateShort(String columnName, short x)
1341: throws SQLException {
1342: checkState();
1343: try {
1344: resultSet.updateShort(columnName, x);
1345: } catch (Throwable t) {
1346: throw checkException(t);
1347: }
1348: }
1349:
1350: public void updateString(int columnIndex, String x)
1351: throws SQLException {
1352: checkState();
1353: try {
1354: resultSet.updateString(columnIndex, x);
1355: } catch (Throwable t) {
1356: throw checkException(t);
1357: }
1358: }
1359:
1360: public void updateString(String columnName, String x)
1361: throws SQLException {
1362: checkState();
1363: try {
1364: resultSet.updateString(columnName, x);
1365: } catch (Throwable t) {
1366: throw checkException(t);
1367: }
1368: }
1369:
1370: public void updateTime(int columnIndex, Time x) throws SQLException {
1371: checkState();
1372: try {
1373: resultSet.updateTime(columnIndex, x);
1374: } catch (Throwable t) {
1375: throw checkException(t);
1376: }
1377: }
1378:
1379: public void updateTime(String columnName, Time x)
1380: throws SQLException {
1381: checkState();
1382: try {
1383: resultSet.updateTime(columnName, x);
1384: } catch (Throwable t) {
1385: throw checkException(t);
1386: }
1387: }
1388:
1389: public void updateTimestamp(int columnIndex, Timestamp x)
1390: throws SQLException {
1391: checkState();
1392: try {
1393: resultSet.updateTimestamp(columnIndex, x);
1394: } catch (Throwable t) {
1395: throw checkException(t);
1396: }
1397: }
1398:
1399: public void updateTimestamp(String columnName, Timestamp x)
1400: throws SQLException {
1401: checkState();
1402: try {
1403: resultSet.updateTimestamp(columnName, x);
1404: } catch (Throwable t) {
1405: throw checkException(t);
1406: }
1407: }
1408:
1409: public boolean wasNull() throws SQLException {
1410: checkState();
1411: try {
1412: return resultSet.wasNull();
1413: } catch (Throwable t) {
1414: throw checkException(t);
1415: }
1416: }
1417:
1418: SQLException checkException(Throwable t) throws SQLException {
1419: throw statement.checkException(t);
1420: }
1421:
1422: void internalClose() throws SQLException {
1423: synchronized (lock) {
1424: closed = true;
1425: }
1426: resultSet.close();
1427: }
1428:
1429: void checkState() throws SQLException {
1430: synchronized (lock) {
1431: if (closed)
1432: throw new SQLException("The result set is closed.");
1433: }
1434: }
1435: }
|