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