001: /*
002: * JBoss, Home of Professional Open Source.
003: * Copyright 2006, Red Hat Middleware LLC, and individual contributors
004: * as indicated by the @author tags. See the copyright.txt file in the
005: * distribution for a full listing of individual contributors.
006: *
007: * This is free software; you can redistribute it and/or modify it
008: * under the terms of the GNU Lesser General Public License as
009: * published by the Free Software Foundation; either version 2.1 of
010: * the License, or (at your option) any later version.
011: *
012: * This software is distributed in the hope that it will be useful,
013: * but WITHOUT ANY WARRANTY; without even the implied warranty of
014: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
015: * Lesser General Public License for more details.
016: *
017: * You should have received a copy of the GNU Lesser General Public
018: * License along with this software; if not, write to the Free
019: * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
020: * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
021: */
022: package org.jboss.resource.adapter.jdbc;
023:
024: import java.io.InputStream;
025: import java.io.Reader;
026: import java.math.BigDecimal;
027: import java.net.URL;
028: import java.sql.Array;
029: import java.sql.Blob;
030: import java.sql.CallableStatement;
031: import java.sql.Clob;
032: import java.sql.Date;
033: import java.sql.Ref;
034: import java.sql.SQLException;
035: import java.sql.Time;
036: import java.sql.Timestamp;
037: import java.util.Calendar;
038: import java.util.Map;
039:
040: /**
041: * WrappedCallableStatement
042: *
043: * @author <a href="mailto:d_jencks@users.sourceforge.net">David Jencks</a>
044: * @author <a href="mailto:adrian@jboss.com">Adrian Brock</a>
045: * @version $Revision: 57189 $
046: */
047: public class WrappedCallableStatement extends WrappedPreparedStatement
048: implements CallableStatement {
049: private final CallableStatement cs;
050:
051: public WrappedCallableStatement(final WrappedConnection lc,
052: final CallableStatement cs) {
053: super (lc, cs);
054: this .cs = cs;
055: }
056:
057: public Object getObject(int parameterIndex) throws SQLException {
058: checkState();
059: try {
060: return cs.getObject(parameterIndex);
061: } catch (Throwable t) {
062: throw checkException(t);
063: }
064: }
065:
066: public Object getObject(int parameterIndex, Map typeMap)
067: throws SQLException {
068: checkState();
069: try {
070: return cs.getObject(parameterIndex, typeMap);
071: } catch (Throwable t) {
072: throw checkException(t);
073: }
074: }
075:
076: public Object getObject(String parameterName) throws SQLException {
077: checkState();
078: try {
079: return cs.getObject(parameterName);
080: } catch (Throwable t) {
081: throw checkException(t);
082: }
083: }
084:
085: public Object getObject(String parameterName, Map typeMap)
086: throws SQLException {
087: checkState();
088: try {
089: return cs.getObject(parameterName, typeMap);
090: } catch (Throwable t) {
091: throw checkException(t);
092: }
093: }
094:
095: public boolean getBoolean(int parameterIndex) throws SQLException {
096: checkState();
097: try {
098: return cs.getBoolean(parameterIndex);
099: } catch (Throwable t) {
100: throw checkException(t);
101: }
102: }
103:
104: public boolean getBoolean(String parameterName) throws SQLException {
105: checkState();
106: try {
107: return cs.getBoolean(parameterName);
108: } catch (Throwable t) {
109: throw checkException(t);
110: }
111: }
112:
113: public byte getByte(int parameterIndex) throws SQLException {
114: checkState();
115: try {
116: return cs.getByte(parameterIndex);
117: } catch (Throwable t) {
118: throw checkException(t);
119: }
120: }
121:
122: public byte getByte(String parameterName) throws SQLException {
123: checkState();
124: try {
125: return cs.getByte(parameterName);
126: } catch (Throwable t) {
127: throw checkException(t);
128: }
129: }
130:
131: public short getShort(int parameterIndex) throws SQLException {
132: checkState();
133: try {
134: return cs.getShort(parameterIndex);
135: } catch (Throwable t) {
136: throw checkException(t);
137: }
138: }
139:
140: public short getShort(String parameterName) throws SQLException {
141: checkState();
142: try {
143: return cs.getShort(parameterName);
144: } catch (Throwable t) {
145: throw checkException(t);
146: }
147: }
148:
149: public int getInt(int parameterIndex) throws SQLException {
150: checkState();
151: try {
152: return cs.getInt(parameterIndex);
153: } catch (Throwable t) {
154: throw checkException(t);
155: }
156: }
157:
158: public int getInt(String parameterName) throws SQLException {
159: checkState();
160: try {
161: return cs.getInt(parameterName);
162: } catch (Throwable t) {
163: throw checkException(t);
164: }
165: }
166:
167: public long getLong(int parameterIndex) throws SQLException {
168: checkState();
169: try {
170: return cs.getLong(parameterIndex);
171: } catch (Throwable t) {
172: throw checkException(t);
173: }
174: }
175:
176: public long getLong(String parameterName) throws SQLException {
177: checkState();
178: try {
179: return cs.getLong(parameterName);
180: } catch (Throwable t) {
181: throw checkException(t);
182: }
183: }
184:
185: public float getFloat(int parameterIndex) throws SQLException {
186: checkState();
187: try {
188: return cs.getFloat(parameterIndex);
189: } catch (Throwable t) {
190: throw checkException(t);
191: }
192: }
193:
194: public float getFloat(String parameterName) throws SQLException {
195: checkState();
196: try {
197: return cs.getFloat(parameterName);
198: } catch (Throwable t) {
199: throw checkException(t);
200: }
201: }
202:
203: public double getDouble(int parameterIndex) throws SQLException {
204: checkState();
205: try {
206: return cs.getDouble(parameterIndex);
207: } catch (Throwable t) {
208: throw checkException(t);
209: }
210: }
211:
212: public double getDouble(String parameterName) throws SQLException {
213: checkState();
214: try {
215: return cs.getDouble(parameterName);
216: } catch (Throwable t) {
217: throw checkException(t);
218: }
219: }
220:
221: public byte[] getBytes(int parameterIndex) throws SQLException {
222: checkState();
223: try {
224: return cs.getBytes(parameterIndex);
225: } catch (Throwable t) {
226: throw checkException(t);
227: }
228: }
229:
230: public byte[] getBytes(String parameterName) throws SQLException {
231: checkState();
232: try {
233: return cs.getBytes(parameterName);
234: } catch (Throwable t) {
235: throw checkException(t);
236: }
237: }
238:
239: public URL getURL(int parameterIndex) throws SQLException {
240: checkState();
241: try {
242: return cs.getURL(parameterIndex);
243: } catch (Throwable t) {
244: throw checkException(t);
245: }
246: }
247:
248: public URL getURL(String parameterName) throws SQLException {
249: checkState();
250: try {
251: return cs.getURL(parameterName);
252: } catch (Throwable t) {
253: throw checkException(t);
254: }
255: }
256:
257: public String getString(int parameterIndex) throws SQLException {
258: checkState();
259: try {
260: return cs.getString(parameterIndex);
261: } catch (Throwable t) {
262: throw checkException(t);
263: }
264: }
265:
266: public String getString(String parameterName) throws SQLException {
267: checkState();
268: try {
269: return cs.getString(parameterName);
270: } catch (Throwable t) {
271: throw checkException(t);
272: }
273: }
274:
275: public Ref getRef(int parameterIndex) throws SQLException {
276: checkState();
277: try {
278: return cs.getRef(parameterIndex);
279: } catch (Throwable t) {
280: throw checkException(t);
281: }
282: }
283:
284: public Ref getRef(String parameterName) throws SQLException {
285: checkState();
286: try {
287: return cs.getRef(parameterName);
288: } catch (Throwable t) {
289: throw checkException(t);
290: }
291: }
292:
293: public Time getTime(int parameterIndex) throws SQLException {
294: checkState();
295: try {
296: return cs.getTime(parameterIndex);
297: } catch (Throwable t) {
298: throw checkException(t);
299: }
300: }
301:
302: public Time getTime(int parameterIndex, Calendar calendar)
303: throws SQLException {
304: checkState();
305: try {
306: return cs.getTime(parameterIndex, calendar);
307: } catch (Throwable t) {
308: throw checkException(t);
309: }
310: }
311:
312: public Time getTime(String parameterName) throws SQLException {
313: checkState();
314: try {
315: return cs.getTime(parameterName);
316: } catch (Throwable t) {
317: throw checkException(t);
318: }
319: }
320:
321: public Time getTime(String parameterName, Calendar calendar)
322: throws SQLException {
323: checkState();
324: try {
325: return cs.getTime(parameterName, calendar);
326: } catch (Throwable t) {
327: throw checkException(t);
328: }
329: }
330:
331: public Date getDate(int parameterIndex) throws SQLException {
332: checkState();
333: try {
334: return cs.getDate(parameterIndex);
335: } catch (Throwable t) {
336: throw checkException(t);
337: }
338: }
339:
340: public Date getDate(int parameterIndex, Calendar calendar)
341: throws SQLException {
342: checkState();
343: try {
344: return cs.getDate(parameterIndex, calendar);
345: } catch (Throwable t) {
346: throw checkException(t);
347: }
348: }
349:
350: public Date getDate(String parameterName) throws SQLException {
351: checkState();
352: try {
353: return cs.getDate(parameterName);
354: } catch (Throwable t) {
355: throw checkException(t);
356: }
357: }
358:
359: public Date getDate(String parameterName, Calendar calendar)
360: throws SQLException {
361: checkState();
362: try {
363: return cs.getDate(parameterName, calendar);
364: } catch (Throwable t) {
365: throw checkException(t);
366: }
367: }
368:
369: public void registerOutParameter(int parameterIndex, int sqlType)
370: throws SQLException {
371: checkState();
372: try {
373: cs.registerOutParameter(parameterIndex, sqlType);
374: } catch (Throwable t) {
375: throw checkException(t);
376: }
377: }
378:
379: public void registerOutParameter(int parameterIndex, int sqlType,
380: int scale) throws SQLException {
381: checkState();
382: try {
383: cs.registerOutParameter(parameterIndex, sqlType, scale);
384: } catch (Throwable t) {
385: throw checkException(t);
386: }
387: }
388:
389: public void registerOutParameter(int parameterIndex, int sqlType,
390: String typeName) throws SQLException {
391: checkState();
392: try {
393: cs.registerOutParameter(parameterIndex, sqlType, typeName);
394: } catch (Throwable t) {
395: throw checkException(t);
396: }
397: }
398:
399: public void registerOutParameter(String parameterName, int sqlType)
400: throws SQLException {
401: checkState();
402: try {
403: cs.registerOutParameter(parameterName, sqlType);
404: } catch (Throwable t) {
405: throw checkException(t);
406: }
407: }
408:
409: public void registerOutParameter(String parameterName, int sqlType,
410: int scale) throws SQLException {
411: checkState();
412: try {
413: cs.registerOutParameter(parameterName, sqlType, scale);
414: } catch (Throwable t) {
415: throw checkException(t);
416: }
417: }
418:
419: public void registerOutParameter(String parameterName, int sqlType,
420: String typeName) throws SQLException {
421: checkState();
422: try {
423: cs.registerOutParameter(parameterName, sqlType, typeName);
424: } catch (Throwable t) {
425: throw checkException(t);
426: }
427: }
428:
429: public boolean wasNull() throws SQLException {
430: checkState();
431: try {
432: return cs.wasNull();
433: } catch (Throwable t) {
434: throw checkException(t);
435: }
436: }
437:
438: /**
439: * @deprecated
440: */
441: public BigDecimal getBigDecimal(int parameterIndex, int scale)
442: throws SQLException {
443: checkState();
444: try {
445: return cs.getBigDecimal(parameterIndex, scale);
446: } catch (Throwable t) {
447: throw checkException(t);
448: }
449: }
450:
451: public BigDecimal getBigDecimal(int parameterIndex)
452: throws SQLException {
453: checkState();
454: try {
455: return cs.getBigDecimal(parameterIndex);
456: } catch (Throwable t) {
457: throw checkException(t);
458: }
459: }
460:
461: public BigDecimal getBigDecimal(String parameterName)
462: throws SQLException {
463: checkState();
464: try {
465: return cs.getBigDecimal(parameterName);
466: } catch (Throwable t) {
467: throw checkException(t);
468: }
469: }
470:
471: public Timestamp getTimestamp(int parameterIndex)
472: throws SQLException {
473: checkState();
474: try {
475: return cs.getTimestamp(parameterIndex);
476: } catch (Throwable t) {
477: throw checkException(t);
478: }
479: }
480:
481: public Timestamp getTimestamp(int parameterIndex, Calendar calendar)
482: throws SQLException {
483: checkState();
484: try {
485: return cs.getTimestamp(parameterIndex, calendar);
486: } catch (Throwable t) {
487: throw checkException(t);
488: }
489: }
490:
491: public Timestamp getTimestamp(String parameterName)
492: throws SQLException {
493: checkState();
494: try {
495: return cs.getTimestamp(parameterName);
496: } catch (Throwable t) {
497: throw checkException(t);
498: }
499: }
500:
501: public Timestamp getTimestamp(String parameterName,
502: Calendar calendar) throws SQLException {
503: checkState();
504: try {
505: return cs.getTimestamp(parameterName, calendar);
506: } catch (Throwable t) {
507: throw checkException(t);
508: }
509: }
510:
511: public Blob getBlob(int parameterIndex) throws SQLException {
512: checkState();
513: try {
514: return cs.getBlob(parameterIndex);
515: } catch (Throwable t) {
516: throw checkException(t);
517: }
518: }
519:
520: public Blob getBlob(String parameterName) throws SQLException {
521: checkState();
522: try {
523: return cs.getBlob(parameterName);
524: } catch (Throwable t) {
525: throw checkException(t);
526: }
527: }
528:
529: public Clob getClob(int parameterIndex) throws SQLException {
530: checkState();
531: try {
532: return cs.getClob(parameterIndex);
533: } catch (Throwable t) {
534: throw checkException(t);
535: }
536: }
537:
538: public Clob getClob(String parameterName) throws SQLException {
539: checkState();
540: try {
541: return cs.getClob(parameterName);
542: } catch (Throwable t) {
543: throw checkException(t);
544: }
545: }
546:
547: public Array getArray(int parameterIndex) throws SQLException {
548: checkState();
549: try {
550: return cs.getArray(parameterIndex);
551: } catch (Throwable t) {
552: throw checkException(t);
553: }
554: }
555:
556: public Array getArray(String parameterName) throws SQLException {
557: checkState();
558: try {
559: return cs.getArray(parameterName);
560: } catch (Throwable t) {
561: throw checkException(t);
562: }
563: }
564:
565: public void setBoolean(String parameterName, boolean value)
566: throws SQLException {
567: checkState();
568: try {
569: cs.setBoolean(parameterName, value);
570: } catch (Throwable t) {
571: throw checkException(t);
572: }
573: }
574:
575: public void setByte(String parameterName, byte value)
576: throws SQLException {
577: checkState();
578: try {
579: cs.setByte(parameterName, value);
580: } catch (Throwable t) {
581: throw checkException(t);
582: }
583: }
584:
585: public void setShort(String parameterName, short value)
586: throws SQLException {
587: checkState();
588: try {
589: cs.setShort(parameterName, value);
590: } catch (Throwable t) {
591: throw checkException(t);
592: }
593: }
594:
595: public void setInt(String parameterName, int value)
596: throws SQLException {
597: checkState();
598: try {
599: cs.setInt(parameterName, value);
600: } catch (Throwable t) {
601: throw checkException(t);
602: }
603: }
604:
605: public void setLong(String parameterName, long value)
606: throws SQLException {
607: checkState();
608: try {
609: cs.setLong(parameterName, value);
610: } catch (Throwable t) {
611: throw checkException(t);
612: }
613: }
614:
615: public void setFloat(String parameterName, float value)
616: throws SQLException {
617: checkState();
618: try {
619: cs.setFloat(parameterName, value);
620: } catch (Throwable t) {
621: throw checkException(t);
622: }
623: }
624:
625: public void setDouble(String parameterName, double value)
626: throws SQLException {
627: checkState();
628: try {
629: cs.setDouble(parameterName, value);
630: } catch (Throwable t) {
631: throw checkException(t);
632: }
633: }
634:
635: public void setURL(String parameterName, URL value)
636: throws SQLException {
637: checkState();
638: try {
639: cs.setURL(parameterName, value);
640: } catch (Throwable t) {
641: throw checkException(t);
642: }
643: }
644:
645: public void setTime(String parameterName, Time value)
646: throws SQLException {
647: checkState();
648: try {
649: cs.setTime(parameterName, value);
650: } catch (Throwable t) {
651: throw checkException(t);
652: }
653: }
654:
655: public void setTime(String parameterName, Time value,
656: Calendar calendar) throws SQLException {
657: checkState();
658: try {
659: cs.setTime(parameterName, value, calendar);
660: } catch (Throwable t) {
661: throw checkException(t);
662: }
663: }
664:
665: public void setNull(String parameterName, int value)
666: throws SQLException {
667: checkState();
668: try {
669: cs.setNull(parameterName, value);
670: } catch (Throwable t) {
671: throw checkException(t);
672: }
673: }
674:
675: public void setNull(String parameterName, int sqlType,
676: String typeName) throws SQLException {
677: checkState();
678: try {
679: cs.setNull(parameterName, sqlType, typeName);
680: } catch (Throwable t) {
681: throw checkException(t);
682: }
683: }
684:
685: public void setBigDecimal(String parameterName, BigDecimal value)
686: throws SQLException {
687: checkState();
688: try {
689: cs.setBigDecimal(parameterName, value);
690: } catch (Throwable t) {
691: throw checkException(t);
692: }
693: }
694:
695: public void setString(String parameterName, String value)
696: throws SQLException {
697: checkState();
698: try {
699: cs.setString(parameterName, value);
700: } catch (Throwable t) {
701: throw checkException(t);
702: }
703: }
704:
705: public void setBytes(String parameterName, byte[] value)
706: throws SQLException {
707: checkState();
708: try {
709: cs.setBytes(parameterName, value);
710: } catch (Throwable t) {
711: throw checkException(t);
712: }
713: }
714:
715: public void setDate(String parameterName, Date value)
716: throws SQLException {
717: checkState();
718: try {
719: cs.setDate(parameterName, value);
720: } catch (Throwable t) {
721: throw checkException(t);
722: }
723: }
724:
725: public void setDate(String parameterName, Date value,
726: Calendar calendar) throws SQLException {
727: checkState();
728: try {
729: cs.setDate(parameterName, value, calendar);
730: } catch (Throwable t) {
731: throw checkException(t);
732: }
733: }
734:
735: public void setTimestamp(String parameterName, Timestamp value)
736: throws SQLException {
737: checkState();
738: try {
739: cs.setTimestamp(parameterName, value);
740: } catch (Throwable t) {
741: throw checkException(t);
742: }
743: }
744:
745: public void setTimestamp(String parameterName, Timestamp value,
746: Calendar calendar) throws SQLException {
747: checkState();
748: try {
749: cs.setTimestamp(parameterName, value, calendar);
750: } catch (Throwable t) {
751: throw checkException(t);
752: }
753: }
754:
755: public void setAsciiStream(String parameterName,
756: InputStream stream, int length) throws SQLException {
757: checkState();
758: try {
759: cs.setAsciiStream(parameterName, stream, length);
760: } catch (Throwable t) {
761: throw checkException(t);
762: }
763: }
764:
765: public void setBinaryStream(String parameterName,
766: InputStream stream, int length) throws SQLException {
767: checkState();
768: try {
769: cs.setBinaryStream(parameterName, stream, length);
770: } catch (Throwable t) {
771: throw checkException(t);
772: }
773: }
774:
775: public void setObject(String parameterName, Object value,
776: int sqlType, int scale) throws SQLException {
777: checkState();
778: try {
779: cs.setObject(parameterName, value, sqlType, scale);
780: } catch (Throwable t) {
781: throw checkException(t);
782: }
783: }
784:
785: public void setObject(String parameterName, Object value,
786: int sqlType) throws SQLException {
787: checkState();
788: try {
789: cs.setObject(parameterName, value, sqlType);
790: } catch (Throwable t) {
791: throw checkException(t);
792: }
793: }
794:
795: public void setObject(String parameterName, Object value)
796: throws SQLException {
797: checkState();
798: try {
799: cs.setObject(parameterName, value);
800: } catch (Throwable t) {
801: throw checkException(t);
802: }
803: }
804:
805: public void setCharacterStream(String parameterName, Reader reader,
806: int length) throws SQLException {
807: checkState();
808: try {
809: cs.setCharacterStream(parameterName, reader, length);
810: } catch (Throwable t) {
811: throw checkException(t);
812: }
813: }
814: }
|