    001/*
    002 * Licensed to the Apache Software Foundation (ASF) under one or more
    003 * contributor license agreements.  See the NOTICE file distributed with
    004 * this work for additional information regarding copyright ownership.
    005 * The ASF licenses this file to You under the Apache License, Version 2.0
    006 * (the "License"); you may not use this file except in compliance with
    007 * the License.  You may obtain a copy of the License at
    008 *
    009 *      http://www.apache.org/licenses/LICENSE-2.0
    010 *
    011 * Unless required by applicable law or agreed to in writing, software
    012 * distributed under the License is distributed on an "AS IS" BASIS,
    013 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    014 * See the License for the specific language governing permissions and
    015 * limitations under the License.
    016 */
    017
    018package org.apache.commons.dbcp2;
    019
    020import java.io.InputStream;
    021import java.io.Reader;
    022import java.math.BigDecimal;
    023import java.net.URL;
    024import java.sql.Array;
    025import java.sql.Blob;
    026import java.sql.CallableStatement;
    027import java.sql.Clob;
    028import java.sql.Date;
    029import java.sql.NClob;
    030import java.sql.Ref;
    031import java.sql.RowId;
    032import java.sql.SQLException;
    033import java.sql.SQLXML;
    034import java.sql.Time;
    035import java.sql.Timestamp;
    036import java.util.Calendar;
    037import java.util.Map;
    038
    039/**
    040 * A base delegating implementation of {@link CallableStatement}.
    041 * <p>
    042 * All of the methods from the {@link CallableStatement} interface
    043 * simply call the corresponding method on the "delegate"
    044 * provided in my constructor.
    045 * <p>
    046 * Extends AbandonedTrace to implement Statement tracking and
    047 * logging of code which created the Statement. Tracking the
    048 * Statement ensures that the Connection which created it can
    049 * close any open Statement's on Connection close.
    050 *
    051 * @author Glenn L. Nielsen
    052 * @author James House
    053 * @author Dirk Verbeeck
    054 * @since 2.0
    055 */
    056public class DelegatingCallableStatement extends DelegatingPreparedStatement
    057        implements CallableStatement {
    058
    059    /**
    060     * Create a wrapper for the Statement which traces this
    061     * Statement to the Connection which created it and the
    062     * code which created it.
    063     *
    064     * @param c the {@link DelegatingConnection} that created this statement
    065     * @param s the {@link CallableStatement} to delegate all calls to
    066     */
    067    public DelegatingCallableStatement(final DelegatingConnection<?> c,
    068                                       final CallableStatement s) {
    069        super(c, s);
    070    }
    071
    072    @Override
    073    public void registerOutParameter(final int parameterIndex, final int sqlType) throws SQLException
    074    { checkOpen(); try { ((CallableStatement)getDelegate()).registerOutParameter( parameterIndex,  sqlType); } catch (final SQLException e) { handleException(e); } }
    075
    076    @Override
    077    public void registerOutParameter(final int parameterIndex, final int sqlType, final int scale) throws SQLException
    078    { checkOpen(); try { ((CallableStatement)getDelegate()).registerOutParameter( parameterIndex,  sqlType,  scale); } catch (final SQLException e) { handleException(e); } }
    079
    080    @Override
    081    public boolean wasNull() throws SQLException
    082    { checkOpen(); try { return ((CallableStatement)getDelegate()).wasNull(); } catch (final SQLException e) { handleException(e); return false; } }
    083
    084    @Override
    085    public String getString(final int parameterIndex) throws SQLException
    086    { checkOpen(); try { return ((CallableStatement)getDelegate()).getString( parameterIndex); } catch (final SQLException e) { handleException(e); return null; } }
    087
    088    @Override
    089    public boolean getBoolean(final int parameterIndex) throws SQLException
    090    { checkOpen(); try { return ((CallableStatement)getDelegate()).getBoolean( parameterIndex); } catch (final SQLException e) { handleException(e); return false; } }
    091
    092    @Override
    093    public byte getByte(final int parameterIndex) throws SQLException
    094    { checkOpen(); try { return ((CallableStatement)getDelegate()).getByte( parameterIndex); } catch (final SQLException e) { handleException(e); return 0; } }
    095
    096    @Override
    097    public short getShort(final int parameterIndex) throws SQLException
    098    { checkOpen(); try { return ((CallableStatement)getDelegate()).getShort( parameterIndex); } catch (final SQLException e) { handleException(e); return 0; } }
    099
    100    @Override
    101    public int getInt(final int parameterIndex) throws SQLException
    102    { checkOpen(); try { return ((CallableStatement)getDelegate()).getInt( parameterIndex); } catch (final SQLException e) { handleException(e); return 0; } }
    103
    104    @Override
    105    public long getLong(final int parameterIndex) throws SQLException
    106    { checkOpen(); try { return ((CallableStatement)getDelegate()).getLong( parameterIndex); } catch (final SQLException e) { handleException(e); return 0; } }
    107
    108    @Override
    109    public float getFloat(final int parameterIndex) throws SQLException
    110    { checkOpen(); try { return ((CallableStatement)getDelegate()).getFloat( parameterIndex); } catch (final SQLException e) { handleException(e); return 0; } }
    111
    112    @Override
    113    public double getDouble(final int parameterIndex) throws SQLException
    114    { checkOpen(); try { return ((CallableStatement)getDelegate()).getDouble( parameterIndex); } catch (final SQLException e) { handleException(e); return 0; } }
    115
    116    /** @deprecated Use {@link #getBigDecimal(int)} or {@link #getBigDecimal(String)} */
    117    @Override
    118    @Deprecated
    119    public BigDecimal getBigDecimal(final int parameterIndex, final int scale) throws SQLException
    120    { checkOpen(); try { return ((CallableStatement)getDelegate()).getBigDecimal( parameterIndex,  scale); } catch (final SQLException e) { handleException(e); return null; } }
    121
    122    @Override
    123    public byte[] getBytes(final int parameterIndex) throws SQLException
    124    { checkOpen(); try { return ((CallableStatement)getDelegate()).getBytes( parameterIndex); } catch (final SQLException e) { handleException(e); return null; } }
    125
    126    @Override
    127    public Date getDate(final int parameterIndex) throws SQLException
    128    { checkOpen(); try { return ((CallableStatement)getDelegate()).getDate( parameterIndex); } catch (final SQLException e) { handleException(e); return null; } }
    129
    130    @Override
    131    public Time getTime(final int parameterIndex) throws SQLException
    132    { checkOpen(); try { return ((CallableStatement)getDelegate()).getTime( parameterIndex); } catch (final SQLException e) { handleException(e); return null; } }
    133
    134    @Override
    135    public Timestamp getTimestamp(final int parameterIndex) throws SQLException
    136    { checkOpen(); try { return ((CallableStatement)getDelegate()).getTimestamp( parameterIndex); } catch (final SQLException e) { handleException(e); return null; } }
    137
    138    @Override
    139    public Object getObject(final int parameterIndex) throws SQLException
    140    { checkOpen(); try { return ((CallableStatement)getDelegate()).getObject( parameterIndex); } catch (final SQLException e) { handleException(e); return null; } }
    141
    142    @Override
    143    public BigDecimal getBigDecimal(final int parameterIndex) throws SQLException
    144    { checkOpen(); try { return ((CallableStatement)getDelegate()).getBigDecimal( parameterIndex); } catch (final SQLException e) { handleException(e); return null; } }
    145
    146    @Override
    147    public Object getObject(final int i, final Map<String,Class<?>> map) throws SQLException
    148    { checkOpen(); try { return ((CallableStatement)getDelegate()).getObject( i, map); } catch (final SQLException e) { handleException(e); return null; } }
    149
    150    @Override
    151    public Ref getRef(final int i) throws SQLException
    152    { checkOpen(); try { return ((CallableStatement)getDelegate()).getRef( i); } catch (final SQLException e) { handleException(e); return null; } }
    153
    154    @Override
    155    public Blob getBlob(final int i) throws SQLException
    156    { checkOpen(); try { return ((CallableStatement)getDelegate()).getBlob( i); } catch (final SQLException e) { handleException(e); return null; } }
    157
    158    @Override
    159    public Clob getClob(final int i) throws SQLException
    160    { checkOpen(); try { return ((CallableStatement)getDelegate()).getClob( i); } catch (final SQLException e) { handleException(e); return null; } }
    161
    162    @Override
    163    public Array getArray(final int i) throws SQLException
    164    { checkOpen(); try { return ((CallableStatement)getDelegate()).getArray( i); } catch (final SQLException e) { handleException(e); return null; } }
    165
    166    @Override
    167    public Date getDate(final int parameterIndex, final Calendar cal) throws SQLException
    168    { checkOpen(); try { return ((CallableStatement)getDelegate()).getDate( parameterIndex,  cal); } catch (final SQLException e) { handleException(e); return null; } }
    169
    170    @Override
    171    public Time getTime(final int parameterIndex, final Calendar cal) throws SQLException
    172    { checkOpen(); try { return ((CallableStatement)getDelegate()).getTime( parameterIndex,  cal); } catch (final SQLException e) { handleException(e); return null; } }
    173
    174    @Override
    175    public Timestamp getTimestamp(final int parameterIndex, final Calendar cal) throws SQLException
    176    { checkOpen(); try { return ((CallableStatement)getDelegate()).getTimestamp( parameterIndex,  cal); } catch (final SQLException e) { handleException(e); return null; } }
    177
    178    @Override
    179    public void registerOutParameter(final int paramIndex, final int sqlType, final String typeName) throws SQLException
    180    { checkOpen(); try { ((CallableStatement)getDelegate()).registerOutParameter( paramIndex,  sqlType,  typeName); } catch (final SQLException e) { handleException(e); } }
    181
    182    @Override
    183    public void registerOutParameter(final String parameterName, final int sqlType) throws SQLException
    184    { checkOpen(); try { ((CallableStatement)getDelegate()).registerOutParameter(parameterName, sqlType); } catch (final SQLException e) { handleException(e); } }
    185
    186    @Override
    187    public void registerOutParameter(final String parameterName, final int sqlType, final int scale) throws SQLException
    188    { checkOpen(); try { ((CallableStatement)getDelegate()).registerOutParameter(parameterName, sqlType, scale); } catch (final SQLException e) { handleException(e); } }
    189
    190    @Override
    191    public void registerOutParameter(final String parameterName, final int sqlType, final String typeName) throws SQLException
    192    { checkOpen(); try { ((CallableStatement)getDelegate()).registerOutParameter(parameterName, sqlType, typeName); } catch (final SQLException e) { handleException(e); } }
    193
    194    @Override
    195    public URL getURL(final int parameterIndex) throws SQLException
    196    { checkOpen(); try { return ((CallableStatement)getDelegate()).getURL(parameterIndex); } catch (final SQLException e) { handleException(e); return null; } }
    197
    198    @Override
    199    public void setURL(final String parameterName, final URL val) throws SQLException
    200    { checkOpen(); try { ((CallableStatement)getDelegate()).setURL(parameterName, val); } catch (final SQLException e) { handleException(e); } }
    201
    202    @Override
    203    public void setNull(final String parameterName, final int sqlType) throws SQLException
    204    { checkOpen(); try { ((CallableStatement)getDelegate()).setNull(parameterName, sqlType); } catch (final SQLException e) { handleException(e); } }
    205
    206    @Override
    207    public void setBoolean(final String parameterName, final boolean x) throws SQLException
    208    { checkOpen(); try { ((CallableStatement)getDelegate()).setBoolean(parameterName, x); } catch (final SQLException e) { handleException(e); } }
    209
    210    @Override
    211    public void setByte(final String parameterName, final byte x) throws SQLException
    212    { checkOpen(); try { ((CallableStatement)getDelegate()).setByte(parameterName, x); } catch (final SQLException e) { handleException(e); } }
    213
    214    @Override
    215    public void setShort(final String parameterName, final short x) throws SQLException
    216    { checkOpen(); try { ((CallableStatement)getDelegate()).setShort(parameterName, x); } catch (final SQLException e) { handleException(e); } }
    217
    218    @Override
    219    public void setInt(final String parameterName, final int x) throws SQLException
    220    { checkOpen(); try { ((CallableStatement)getDelegate()).setInt(parameterName, x); } catch (final SQLException e) { handleException(e); } }
    221
    222    @Override
    223    public void setLong(final String parameterName, final long x) throws SQLException
    224    { checkOpen(); try { ((CallableStatement)getDelegate()).setLong(parameterName, x); } catch (final SQLException e) { handleException(e); } }
    225
    226    @Override
    227    public void setFloat(final String parameterName, final float x) throws SQLException
    228    { checkOpen(); try { ((CallableStatement)getDelegate()).setFloat(parameterName, x); } catch (final SQLException e) { handleException(e); } }
    229
    230    @Override
    231    public void setDouble(final String parameterName, final double x) throws SQLException
    232    { checkOpen(); try { ((CallableStatement)getDelegate()).setDouble(parameterName, x); } catch (final SQLException e) { handleException(e); } }
    233
    234    @Override
    235    public void setBigDecimal(final String parameterName, final BigDecimal x) throws SQLException
    236    { checkOpen(); try { ((CallableStatement)getDelegate()).setBigDecimal(parameterName, x); } catch (final SQLException e) { handleException(e); } }
    237
    238    @Override
    239    public void setString(final String parameterName, final String x) throws SQLException
    240    { checkOpen(); try { ((CallableStatement)getDelegate()).setString(parameterName, x); } catch (final SQLException e) { handleException(e); } }
    241
    242    @Override
    243    public void setBytes(final String parameterName, final byte [] x) throws SQLException
    244    { checkOpen(); try { ((CallableStatement)getDelegate()).setBytes(parameterName, x); } catch (final SQLException e) { handleException(e); } }
    245
    246    @Override
    247    public void setDate(final String parameterName, final Date x) throws SQLException
    248    { checkOpen(); try { ((CallableStatement)getDelegate()).setDate(parameterName, x); } catch (final SQLException e) { handleException(e); } }
    249
    250    @Override
    251    public void setTime(final String parameterName, final Time x) throws SQLException
    252    { checkOpen(); try { ((CallableStatement)getDelegate()).setTime(parameterName, x); } catch (final SQLException e) { handleException(e); } }
    253
    254    @Override
    255    public void setTimestamp(final String parameterName, final Timestamp x) throws SQLException
    256    { checkOpen(); try { ((CallableStatement)getDelegate()).setTimestamp(parameterName, x); } catch (final SQLException e) { handleException(e); } }
    257
    258    @Override
    259    public void setAsciiStream(final String parameterName, final InputStream x, final int length) throws SQLException
    260    { checkOpen(); try { ((CallableStatement)getDelegate()).setAsciiStream(parameterName, x, length); } catch (final SQLException e) { handleException(e); } }
    261
    262    @Override
    263    public void setBinaryStream(final String parameterName, final InputStream x, final int length) throws SQLException
    264    { checkOpen(); try { ((CallableStatement)getDelegate()).setBinaryStream(parameterName, x, length); } catch (final SQLException e) { handleException(e); } }
    265
    266    @Override
    267    public void setObject(final String parameterName, final Object x, final int targetSqlType, final int scale) throws SQLException
    268    { checkOpen(); try { ((CallableStatement)getDelegate()).setObject(parameterName, x, targetSqlType, scale); } catch (final SQLException e) { handleException(e); } }
    269
    270    @Override
    271    public void setObject(final String parameterName, final Object x, final int targetSqlType) throws SQLException
    272    { checkOpen(); try { ((CallableStatement)getDelegate()).setObject(parameterName, x, targetSqlType); } catch (final SQLException e) { handleException(e); } }
    273
    274    @Override
    275    public void setObject(final String parameterName, final Object x) throws SQLException
    276    { checkOpen(); try { ((CallableStatement)getDelegate()).setObject(parameterName, x); } catch (final SQLException e) { handleException(e); } }
    277
    278    @Override
    279    public void setCharacterStream(final String parameterName, final Reader reader, final int length) throws SQLException
    280    { checkOpen(); ((CallableStatement)getDelegate()).setCharacterStream(parameterName, reader, length); }
    281
    282    @Override
    283    public void setDate(final String parameterName, final Date x, final Calendar cal) throws SQLException
    284    { checkOpen(); try { ((CallableStatement)getDelegate()).setDate(parameterName, x, cal); } catch (final SQLException e) { handleException(e); } }
    285
    286    @Override
    287    public void setTime(final String parameterName, final Time x, final Calendar cal) throws SQLException
    288    { checkOpen(); try { ((CallableStatement)getDelegate()).setTime(parameterName, x, cal); } catch (final SQLException e) { handleException(e); } }
    289
    290    @Override
    291    public void setTimestamp(final String parameterName, final Timestamp x, final Calendar cal) throws SQLException
    292    { checkOpen(); try { ((CallableStatement)getDelegate()).setTimestamp(parameterName, x, cal); } catch (final SQLException e) { handleException(e); } }
    293
    294    @Override
    295    public void setNull(final String parameterName, final int sqlType, final String typeName) throws SQLException
    296    { checkOpen(); try { ((CallableStatement)getDelegate()).setNull(parameterName, sqlType, typeName); } catch (final SQLException e) { handleException(e); } }
    297
    298    @Override
    299    public String getString(final String parameterName) throws SQLException
    300    { checkOpen(); try { return ((CallableStatement)getDelegate()).getString(parameterName); } catch (final SQLException e) { handleException(e); return null; } }
    301
    302    @Override
    303    public boolean getBoolean(final String parameterName) throws SQLException
    304    { checkOpen(); try { return ((CallableStatement)getDelegate()).getBoolean(parameterName); } catch (final SQLException e) { handleException(e); return false; } }
    305
    306    @Override
    307    public byte getByte(final String parameterName) throws SQLException
    308    { checkOpen(); try { return ((CallableStatement)getDelegate()).getByte(parameterName); } catch (final SQLException e) { handleException(e); return 0; } }
    309
    310    @Override
    311    public short getShort(final String parameterName) throws SQLException
    312    { checkOpen(); try { return ((CallableStatement)getDelegate()).getShort(parameterName); } catch (final SQLException e) { handleException(e); return 0; } }
    313
    314    @Override
    315    public int getInt(final String parameterName) throws SQLException
    316    { checkOpen(); try { return ((CallableStatement)getDelegate()).getInt(parameterName); } catch (final SQLException e) { handleException(e); return 0; } }
    317
    318    @Override
    319    public long getLong(final String parameterName) throws SQLException
    320    { checkOpen(); try { return ((CallableStatement)getDelegate()).getLong(parameterName); } catch (final SQLException e) { handleException(e); return 0; } }
    321
    322    @Override
    323    public float getFloat(final String parameterName) throws SQLException
    324    { checkOpen(); try { return ((CallableStatement)getDelegate()).getFloat(parameterName); } catch (final SQLException e) { handleException(e); return 0; } }
    325
    326    @Override
    327    public double getDouble(final String parameterName) throws SQLException
    328    { checkOpen(); try { return ((CallableStatement)getDelegate()).getDouble(parameterName); } catch (final SQLException e) { handleException(e); return 0; } }
    329
    330    @Override
    331    public byte[] getBytes(final String parameterName) throws SQLException
    332    { checkOpen(); try { return ((CallableStatement)getDelegate()).getBytes(parameterName); } catch (final SQLException e) { handleException(e); return null; } }
    333
    334    @Override
    335    public Date getDate(final String parameterName) throws SQLException
    336    { checkOpen(); try { return ((CallableStatement)getDelegate()).getDate(parameterName); } catch (final SQLException e) { handleException(e); return null; } }
    337
    338    @Override
    339    public Time getTime(final String parameterName) throws SQLException
    340    { checkOpen(); try { return ((CallableStatement)getDelegate()).getTime(parameterName); } catch (final SQLException e) { handleException(e); return null; } }
    341
    342    @Override
    343    public Timestamp getTimestamp(final String parameterName) throws SQLException
    344    { checkOpen(); try { return ((CallableStatement)getDelegate()).getTimestamp(parameterName); } catch (final SQLException e) { handleException(e); return null; } }
    345
    346    @Override
    347    public Object getObject(final String parameterName) throws SQLException
    348    { checkOpen(); try { return ((CallableStatement)getDelegate()).getObject(parameterName); } catch (final SQLException e) { handleException(e); return null; } }
    349
    350    @Override
    351    public BigDecimal getBigDecimal(final String parameterName) throws SQLException
    352    { checkOpen(); try { return ((CallableStatement)getDelegate()).getBigDecimal(parameterName); } catch (final SQLException e) { handleException(e); return null; } }
    353
    354    @Override
    355    public Object getObject(final String parameterName, final Map<String,Class<?>> map) throws SQLException
    356    { checkOpen(); try { return ((CallableStatement)getDelegate()).getObject(parameterName, map); } catch (final SQLException e) { handleException(e); return null; } }
    357
    358    @Override
    359    public Ref getRef(final String parameterName) throws SQLException
    360    { checkOpen(); try { return ((CallableStatement)getDelegate()).getRef(parameterName); } catch (final SQLException e) { handleException(e); return null; } }
    361
    362    @Override
    363    public Blob getBlob(final String parameterName) throws SQLException
    364    { checkOpen(); try { return ((CallableStatement)getDelegate()).getBlob(parameterName); } catch (final SQLException e) { handleException(e); return null; } }
    365
    366    @Override
    367    public Clob getClob(final String parameterName) throws SQLException
    368    { checkOpen(); try { return ((CallableStatement)getDelegate()).getClob(parameterName); } catch (final SQLException e) { handleException(e); return null; } }
    369
    370    @Override
    371    public Array getArray(final String parameterName) throws SQLException
    372    { checkOpen(); try { return ((CallableStatement)getDelegate()).getArray(parameterName); } catch (final SQLException e) { handleException(e); return null; } }
    373
    374    @Override
    375    public Date getDate(final String parameterName, final Calendar cal) throws SQLException
    376    { checkOpen(); try { return ((CallableStatement)getDelegate()).getDate(parameterName, cal); } catch (final SQLException e) { handleException(e); return null; } }
    377
    378    @Override
    379    public Time getTime(final String parameterName, final Calendar cal) throws SQLException
    380    { checkOpen(); try { return ((CallableStatement)getDelegate()).getTime(parameterName, cal); } catch (final SQLException e) { handleException(e); return null; } }
    381
    382    @Override
    383    public Timestamp getTimestamp(final String parameterName, final Calendar cal) throws SQLException
    384    { checkOpen(); try { return ((CallableStatement)getDelegate()).getTimestamp(parameterName, cal); } catch (final SQLException e) { handleException(e); return null; } }
    385
    386    @Override
    387    public URL getURL(final String parameterName) throws SQLException
    388    { checkOpen(); try { return ((CallableStatement)getDelegate()).getURL(parameterName); } catch (final SQLException e) { handleException(e); return null; } }
    389
    390
    391    @Override
    392    public RowId getRowId(final int parameterIndex) throws SQLException {
    393        checkOpen();
    394        try {
    395            return ((CallableStatement)getDelegate()).getRowId(parameterIndex);
    396        }
    397        catch (final SQLException e) {
    398            handleException(e);
    399            return null;
    400        }
    401    }
    402
    403    @Override
    404    public RowId getRowId(final String parameterName) throws SQLException {
    405        checkOpen();
    406        try {
    407            return ((CallableStatement)getDelegate()).getRowId(parameterName);
    408        }
    409        catch (final SQLException e) {
    410            handleException(e);
    411            return null;
    412        }
    413    }
    414
    415    @Override
    416    public void setRowId(final String parameterName, final RowId value) throws SQLException {
    417        checkOpen();
    418        try {
    419            ((CallableStatement)getDelegate()).setRowId(parameterName, value);
    420        }
    421        catch (final SQLException e) {
    422            handleException(e);
    423        }
    424    }
    425
    426    @Override
    427    public void setNString(final String parameterName, final String value) throws SQLException {
    428        checkOpen();
    429        try {
    430            ((CallableStatement)getDelegate()).setNString(parameterName, value);
    431        }
    432        catch (final SQLException e) {
    433            handleException(e);
    434        }
    435    }
    436
    437    @Override
    438    public void setNCharacterStream(final String parameterName, final Reader reader, final long length) throws SQLException {
    439        checkOpen();
    440        try {
    441            ((CallableStatement)getDelegate()).setNCharacterStream(parameterName, reader, length);
    442        }
    443        catch (final SQLException e) {
    444            handleException(e);
    445        }
    446    }
    447
    448    @Override
    449    public void setNClob(final String parameterName, final NClob value) throws SQLException {
    450        checkOpen();
    451        try {
    452            ((CallableStatement)getDelegate()).setNClob(parameterName, value);
    453        }
    454        catch (final SQLException e) {
    455            handleException(e);
    456        }
    457    }
    458
    459    @Override
    460    public void setClob(final String parameterName, final Reader reader, final long length) throws SQLException {
    461        checkOpen();
    462        try {
    463            ((CallableStatement)getDelegate()).setClob(parameterName, reader, length);
    464        }
    465        catch (final SQLException e) {
    466            handleException(e);
    467        }
    468    }
    469
    470    @Override
    471    public void setBlob(final String parameterName, final InputStream inputStream, final long length) throws SQLException {
    472        checkOpen();
    473        try {
    474            ((CallableStatement)getDelegate()).setBlob(parameterName, inputStream, length);
    475        }
    476        catch (final SQLException e) {
    477            handleException(e);
    478        }
    479    }
    480
    481    @Override
    482    public void setNClob(final String parameterName, final Reader reader, final long length) throws SQLException {
    483        checkOpen();
    484        try {
    485            ((CallableStatement)getDelegate()).setNClob(parameterName, reader, length);
    486        }
    487        catch (final SQLException e) {
    488            handleException(e);
    489        }
    490    }
    491
    492    @Override
    493    public NClob getNClob(final int parameterIndex) throws SQLException {
    494        checkOpen();
    495        try {
    496            return ((CallableStatement)getDelegate()).getNClob(parameterIndex);
    497        }
    498        catch (final SQLException e) {
    499            handleException(e);
    500            return null;
    501        }
    502    }
    503
    504    @Override
    505    public NClob getNClob(final String parameterName) throws SQLException {
    506        checkOpen();
    507        try {
    508            return ((CallableStatement)getDelegate()).getNClob(parameterName);
    509        }
    510        catch (final SQLException e) {
    511            handleException(e);
    512            return null;
    513        }
    514    }
    515
    516    @Override
    517    public void setSQLXML(final String parameterName, final SQLXML value) throws SQLException {
    518        checkOpen();
    519        try {
    520            ((CallableStatement)getDelegate()).setSQLXML(parameterName, value);
    521        }
    522        catch (final SQLException e) {
    523            handleException(e);
    524        }
    525    }
    526
    527    @Override
    528    public SQLXML getSQLXML(final int parameterIndex) throws SQLException {
    529        checkOpen();
    530        try {
    531            return ((CallableStatement)getDelegate()).getSQLXML(parameterIndex);
    532        }
    533        catch (final SQLException e) {
    534            handleException(e);
    535            return null;
    536        }
    537    }
    538
    539    @Override
    540    public SQLXML getSQLXML(final String parameterName) throws SQLException {
    541        checkOpen();
    542        try {
    543            return ((CallableStatement)getDelegate()).getSQLXML(parameterName);
    544        }
    545        catch (final SQLException e) {
    546            handleException(e);
    547            return null;
    548        }
    549    }
    550
    551    @Override
    552    public String getNString(final int parameterIndex) throws SQLException {
    553        checkOpen();
    554        try {
    555            return ((CallableStatement)getDelegate()).getNString(parameterIndex);
    556        }
    557        catch (final SQLException e) {
    558            handleException(e);
    559            return null;
    560        }
    561    }
    562
    563    @Override
    564    public String getNString(final String parameterName) throws SQLException {
    565        checkOpen();
    566        try {
    567            return ((CallableStatement)getDelegate()).getNString(parameterName);
    568        }
    569        catch (final SQLException e) {
    570            handleException(e);
    571            return null;
    572        }
    573    }
    574
    575    @Override
    576    public Reader getNCharacterStream(final int parameterIndex) throws SQLException {
    577        checkOpen();
    578        try {
    579            return ((CallableStatement)getDelegate()).getNCharacterStream(parameterIndex);
    580        }
    581        catch (final SQLException e) {
    582            handleException(e);
    583            return null;
    584        }
    585    }
    586
    587    @Override
    588    public Reader getNCharacterStream(final String parameterName) throws SQLException {
    589        checkOpen();
    590        try {
    591            return ((CallableStatement)getDelegate()).getNCharacterStream(parameterName);
    592        }
    593        catch (final SQLException e) {
    594            handleException(e);
    595            return null;
    596        }
    597    }
    598
    599    @Override
    600    public Reader getCharacterStream(final int parameterIndex) throws SQLException {
    601        checkOpen();
    602        try {
    603            return ((CallableStatement)getDelegate()).getCharacterStream(parameterIndex);
    604        }
    605        catch (final SQLException e) {
    606            handleException(e);
    607            return null;
    608        }
    609    }
    610
    611    @Override
    612    public Reader getCharacterStream(final String parameterName) throws SQLException {
    613        checkOpen();
    614        try {
    615            return ((CallableStatement)getDelegate()).getCharacterStream(parameterName);
    616        }
    617        catch (final SQLException e) {
    618            handleException(e);
    619            return null;
    620        }
    621    }
    622
    623    @Override
    624    public void setBlob(final String parameterName, final Blob blob) throws SQLException {
    625        checkOpen();
    626        try {
    627            ((CallableStatement)getDelegate()).setBlob(parameterName, blob);
    628        }
    629        catch (final SQLException e) {
    630            handleException(e);
    631        }
    632    }
    633
    634    @Override
    635    public void setClob(final String parameterName, final Clob clob) throws SQLException {
    636        checkOpen();
    637        try {
    638            ((CallableStatement)getDelegate()).setClob(parameterName, clob);
    639        }
    640        catch (final SQLException e) {
    641            handleException(e);
    642        }
    643    }
    644
    645    @Override
    646    public void setAsciiStream(final String parameterName, final InputStream inputStream, final long length) throws SQLException {
    647        checkOpen();
    648        try {
    649            ((CallableStatement)getDelegate()).setAsciiStream(parameterName, inputStream, length);
    650        }
    651        catch (final SQLException e) {
    652            handleException(e);
    653        }
    654    }
    655
    656    @Override
    657    public void setBinaryStream(final String parameterName, final InputStream inputStream, final long length) throws SQLException {
    658        checkOpen();
    659        try {
    660            ((CallableStatement)getDelegate()).setBinaryStream(parameterName, inputStream, length);
    661        }
    662        catch (final SQLException e) {
    663            handleException(e);
    664        }
    665    }
    666
    667    @Override
    668    public void setCharacterStream(final String parameterName, final Reader reader, final long length) throws SQLException {
    669        checkOpen();
    670        try {
    671            ((CallableStatement)getDelegate()).setCharacterStream(parameterName, reader, length);
    672        }
    673        catch (final SQLException e) {
    674            handleException(e);
    675        }
    676    }
    677
    678    @Override
    679    public void setAsciiStream(final String parameterName, final InputStream inputStream) throws SQLException {
    680        checkOpen();
    681        try {
    682            ((CallableStatement)getDelegate()).setAsciiStream(parameterName, inputStream);
    683        }
    684        catch (final SQLException e) {
    685            handleException(e);
    686        }
    687    }
    688
    689    @Override
    690    public void setBinaryStream(final String parameterName, final InputStream inputStream) throws SQLException {
    691        checkOpen();
    692        try {
    693            ((CallableStatement)getDelegate()).setBinaryStream(parameterName, inputStream);
    694        }
    695        catch (final SQLException e) {
    696            handleException(e);
    697        }
    698    }
    699
    700    @Override
    701    public void setCharacterStream(final String parameterName, final Reader reader) throws SQLException {
    702        checkOpen();
    703        try {
    704            ((CallableStatement)getDelegate()).setCharacterStream(parameterName, reader);
    705        }
    706        catch (final SQLException e) {
    707            handleException(e);
    708        }
    709    }
    710
    711    @Override
    712    public void setNCharacterStream(final String parameterName, final Reader reader) throws SQLException {
    713        checkOpen();
    714        try {
    715            ((CallableStatement)getDelegate()).setNCharacterStream(parameterName, reader);
    716        }
    717        catch (final SQLException e) {
    718            handleException(e);
    719        }
    720    }
    721
    722    @Override
    723    public void setClob(final String parameterName, final Reader reader) throws SQLException {
    724        checkOpen();
    725        try {
    726            ((CallableStatement)getDelegate()).setClob(parameterName, reader);
    727        }
    728        catch (final SQLException e) {
    729            handleException(e);
    730        }
    731    }
    732
    733    @Override
    734    public void setBlob(final String parameterName, final InputStream inputStream) throws SQLException {
    735        checkOpen();
    736        try {
    737            ((CallableStatement)getDelegate()).setBlob(parameterName, inputStream);
    738        }
    739        catch (final SQLException e) {
    740            handleException(e);
    741        }
    742    }
    743
    744    @Override
    745    public void setNClob(final String parameterName, final Reader reader) throws SQLException {
    746        checkOpen();
    747        try {
    748            ((CallableStatement)getDelegate()).setNClob(parameterName, reader);
    749        }
    750        catch (final SQLException e) {
    751            handleException(e);
    752        }
    753    }
    754
    755    @Override
    756    public <T> T getObject(final int parameterIndex, final Class<T> type)
    757            throws SQLException {
    758        checkOpen();
    759        try {
    760            return ((CallableStatement)getDelegate()).getObject(parameterIndex, type);
    761}
    762        catch (final SQLException e) {
    763            handleException(e);
    764            return null;
    765        }
    766    }
    767
    768    @Override
    769    public <T> T getObject(final String parameterName, final Class<T> type)
    770            throws SQLException {
    771        checkOpen();
    772        try {
    773            return ((CallableStatement)getDelegate()).getObject(parameterName, type);
    774        }
    775        catch (final SQLException e) {
    776            handleException(e);
    777            return null;
    778        }
    779    }
    780
    781
    782}