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