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