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