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