View Javadoc

1   /*
2    ~ Copyright 2006-2007 Nicolas De Loof.
3    ~
4    ~ Licensed under the Apache License, Version 2.0 (the "License");
5    ~ you may not use this file except in compliance with the License.
6    ~ You may obtain a copy of the License at
7    ~
8    ~      http://www.apache.org/licenses/LICENSE-2.0
9    ~
10   ~ Unless required by applicable law or agreed to in writing, software
11   ~ distributed under the License is distributed on an "AS IS" BASIS,
12   ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13   ~ See the License for the specific language governing permissions and
14   ~ limitations under the License.
15   */
16  package org.jmonit.support.jdbc;
17  
18  import java.io.InputStream;
19  import java.io.Reader;
20  import java.math.BigDecimal;
21  import java.net.URL;
22  import java.sql.Array;
23  import java.sql.Blob;
24  import java.sql.CallableStatement;
25  import java.sql.Clob;
26  import java.sql.Connection;
27  import java.sql.Date;
28  import java.sql.NClob;
29  import java.sql.Ref;
30  import java.sql.RowId;
31  import java.sql.SQLException;
32  import java.sql.SQLXML;
33  import java.sql.Time;
34  import java.sql.Timestamp;
35  import java.util.Calendar;
36  import java.util.Map;
37  
38  import org.jmonit.Monitor;
39  
40  /**
41   * @author <a href="mailto:ndeloof@sourceforge.net">Nicolas De Loof</a>
42   */
43  public class MonitoredCallableStatement
44      extends MonitoredPreparedStatement
45      implements CallableStatement
46  {
47      private CallableStatement statement;
48  
49      /** The monitor for this statement execution */
50      private Monitor monitor;
51  
52      /**
53       * {@inheritDoc}
54       * 
55       * @see org.jmonit.support.jdbc.MonitoredPreparedStatement#getMonitor()
56       */
57      @Override
58      protected Monitor getMonitor()
59      {
60          return monitor;
61      }
62  
63      /**
64       * @param statement target statement
65       * @param sql SQL Query
66       * @param connection monitored connection
67       * @param monitor the JDBC monitor on this connection
68       */
69      public MonitoredCallableStatement( CallableStatement statement, String sql,
70                                         Connection connection, JdbcMonitor monitor )
71      {
72          super( statement, sql, connection, monitor );
73          this.statement = statement;
74          this.monitor = monitor.getCallableStatementMonitor( sql );
75      }
76  
77      public Array getArray( int parameterIndex )
78          throws SQLException
79      {
80          return statement.getArray( parameterIndex );
81      }
82  
83      public Array getArray( String parameterName )
84          throws SQLException
85      {
86          return statement.getArray( parameterName );
87      }
88  
89      public BigDecimal getBigDecimal( int parameterIndex, int scale )
90          throws SQLException
91      {
92          return statement.getBigDecimal( parameterIndex, scale );
93      }
94  
95      public BigDecimal getBigDecimal( int parameterIndex )
96          throws SQLException
97      {
98          return statement.getBigDecimal( parameterIndex );
99      }
100 
101     public BigDecimal getBigDecimal( String parameterName )
102         throws SQLException
103     {
104         return statement.getBigDecimal( parameterName );
105     }
106 
107     public Blob getBlob( int parameterIndex )
108         throws SQLException
109     {
110         return statement.getBlob( parameterIndex );
111     }
112 
113     public Blob getBlob( String parameterName )
114         throws SQLException
115     {
116         return statement.getBlob( parameterName );
117     }
118 
119     public boolean getBoolean( int parameterIndex )
120         throws SQLException
121     {
122         return statement.getBoolean( parameterIndex );
123     }
124 
125     public boolean getBoolean( String parameterName )
126         throws SQLException
127     {
128         return statement.getBoolean( parameterName );
129     }
130 
131     public byte getByte( int parameterIndex )
132         throws SQLException
133     {
134         return statement.getByte( parameterIndex );
135     }
136 
137     public byte getByte( String parameterName )
138         throws SQLException
139     {
140         return statement.getByte( parameterName );
141     }
142 
143     public byte[] getBytes( int parameterIndex )
144         throws SQLException
145     {
146         return statement.getBytes( parameterIndex );
147     }
148 
149     public byte[] getBytes( String parameterName )
150         throws SQLException
151     {
152         return statement.getBytes( parameterName );
153     }
154 
155     public Reader getCharacterStream( int parameterIndex )
156         throws SQLException
157     {
158         return statement.getCharacterStream( parameterIndex );
159     }
160 
161     public Reader getCharacterStream( String parameterName )
162         throws SQLException
163     {
164         return statement.getCharacterStream( parameterName );
165     }
166 
167     public Clob getClob( int parameterIndex )
168         throws SQLException
169     {
170         return statement.getClob( parameterIndex );
171     }
172 
173     public Clob getClob( String parameterName )
174         throws SQLException
175     {
176         return statement.getClob( parameterName );
177     }
178 
179     public Date getDate( int parameterIndex, Calendar cal )
180         throws SQLException
181     {
182         return statement.getDate( parameterIndex, cal );
183     }
184 
185     public Date getDate( int parameterIndex )
186         throws SQLException
187     {
188         return statement.getDate( parameterIndex );
189     }
190 
191     public Date getDate( String parameterName, Calendar cal )
192         throws SQLException
193     {
194         return statement.getDate( parameterName, cal );
195     }
196 
197     public Date getDate( String parameterName )
198         throws SQLException
199     {
200         return statement.getDate( parameterName );
201     }
202 
203     public double getDouble( int parameterIndex )
204         throws SQLException
205     {
206         return statement.getDouble( parameterIndex );
207     }
208 
209     public double getDouble( String parameterName )
210         throws SQLException
211     {
212         return statement.getDouble( parameterName );
213     }
214 
215     public float getFloat( int parameterIndex )
216         throws SQLException
217     {
218         return statement.getFloat( parameterIndex );
219     }
220 
221     public float getFloat( String parameterName )
222         throws SQLException
223     {
224         return statement.getFloat( parameterName );
225     }
226 
227     public int getInt( int parameterIndex )
228         throws SQLException
229     {
230         return statement.getInt( parameterIndex );
231     }
232 
233     public int getInt( String parameterName )
234         throws SQLException
235     {
236         return statement.getInt( parameterName );
237     }
238 
239     public long getLong( int parameterIndex )
240         throws SQLException
241     {
242         return statement.getLong( parameterIndex );
243     }
244 
245     public long getLong( String parameterName )
246         throws SQLException
247     {
248         return statement.getLong( parameterName );
249     }
250 
251     public Reader getNCharacterStream( int parameterIndex )
252         throws SQLException
253     {
254         return statement.getNCharacterStream( parameterIndex );
255     }
256 
257     public Reader getNCharacterStream( String parameterName )
258         throws SQLException
259     {
260         return statement.getNCharacterStream( parameterName );
261     }
262 
263     public NClob getNClob( int parameterIndex )
264         throws SQLException
265     {
266         return statement.getNClob( parameterIndex );
267     }
268 
269     public NClob getNClob( String parameterName )
270         throws SQLException
271     {
272         return statement.getNClob( parameterName );
273     }
274 
275     public String getNString( int parameterIndex )
276         throws SQLException
277     {
278         return statement.getNString( parameterIndex );
279     }
280 
281     public String getNString( String parameterName )
282         throws SQLException
283     {
284         return statement.getNString( parameterName );
285     }
286 
287     public Object getObject( int parameterIndex )
288         throws SQLException
289     {
290         return statement.getObject( parameterIndex );
291     }
292 
293     public Object getObject( String parameterName )
294         throws SQLException
295     {
296         return statement.getObject( parameterName );
297     }
298 
299     public Ref getRef( int parameterIndex )
300         throws SQLException
301     {
302         return statement.getRef( parameterIndex );
303     }
304 
305     public Ref getRef( String parameterName )
306         throws SQLException
307     {
308         return statement.getRef( parameterName );
309     }
310 
311     public RowId getRowId( int parameterIndex )
312         throws SQLException
313     {
314         return statement.getRowId( parameterIndex );
315     }
316 
317     public RowId getRowId( String parameterName )
318         throws SQLException
319     {
320         return statement.getRowId( parameterName );
321     }
322 
323     public short getShort( int parameterIndex )
324         throws SQLException
325     {
326         return statement.getShort( parameterIndex );
327     }
328 
329     public short getShort( String parameterName )
330         throws SQLException
331     {
332         return statement.getShort( parameterName );
333     }
334 
335     public SQLXML getSQLXML( int parameterIndex )
336         throws SQLException
337     {
338         return statement.getSQLXML( parameterIndex );
339     }
340 
341     public SQLXML getSQLXML( String parameterName )
342         throws SQLException
343     {
344         return statement.getSQLXML( parameterName );
345     }
346 
347     public String getString( int parameterIndex )
348         throws SQLException
349     {
350         return statement.getString( parameterIndex );
351     }
352 
353     public String getString( String parameterName )
354         throws SQLException
355     {
356         return statement.getString( parameterName );
357     }
358 
359     public Time getTime( int parameterIndex, Calendar cal )
360         throws SQLException
361     {
362         return statement.getTime( parameterIndex, cal );
363     }
364 
365     public Time getTime( int parameterIndex )
366         throws SQLException
367     {
368         return statement.getTime( parameterIndex );
369     }
370 
371     public Time getTime( String parameterName, Calendar cal )
372         throws SQLException
373     {
374         return statement.getTime( parameterName, cal );
375     }
376 
377     public Time getTime( String parameterName )
378         throws SQLException
379     {
380         return statement.getTime( parameterName );
381     }
382 
383     public Timestamp getTimestamp( int parameterIndex, Calendar cal )
384         throws SQLException
385     {
386         return statement.getTimestamp( parameterIndex, cal );
387     }
388 
389     public Timestamp getTimestamp( int parameterIndex )
390         throws SQLException
391     {
392         return statement.getTimestamp( parameterIndex );
393     }
394 
395     public Timestamp getTimestamp( String parameterName, Calendar cal )
396         throws SQLException
397     {
398         return statement.getTimestamp( parameterName, cal );
399     }
400 
401     public Timestamp getTimestamp( String parameterName )
402         throws SQLException
403     {
404         return statement.getTimestamp( parameterName );
405     }
406 
407     public URL getURL( int parameterIndex )
408         throws SQLException
409     {
410         return statement.getURL( parameterIndex );
411     }
412 
413     public URL getURL( String parameterName )
414         throws SQLException
415     {
416         return statement.getURL( parameterName );
417     }
418 
419     public void registerOutParameter( int parameterIndex, int sqlType, int scale )
420         throws SQLException
421     {
422         statement.registerOutParameter( parameterIndex, sqlType, scale );
423     }
424 
425     public void registerOutParameter( int parameterIndex, int sqlType, String typeName )
426         throws SQLException
427     {
428         statement.registerOutParameter( parameterIndex, sqlType, typeName );
429     }
430 
431     public void registerOutParameter( int parameterIndex, int sqlType )
432         throws SQLException
433     {
434         statement.registerOutParameter( parameterIndex, sqlType );
435     }
436 
437     public void registerOutParameter( String parameterName, int sqlType, int scale )
438         throws SQLException
439     {
440         statement.registerOutParameter( parameterName, sqlType, scale );
441     }
442 
443     public void registerOutParameter( String parameterName, int sqlType, String typeName )
444         throws SQLException
445     {
446         statement.registerOutParameter( parameterName, sqlType, typeName );
447     }
448 
449     public void registerOutParameter( String parameterName, int sqlType )
450         throws SQLException
451     {
452         statement.registerOutParameter( parameterName, sqlType );
453     }
454 
455     public void setAsciiStream( String parameterName, InputStream x, int length )
456         throws SQLException
457     {
458         statement.setAsciiStream( parameterName, x, length );
459     }
460 
461     public void setAsciiStream( String parameterName, InputStream x, long length )
462         throws SQLException
463     {
464         statement.setAsciiStream( parameterName, x, length );
465     }
466 
467     public void setAsciiStream( String parameterName, InputStream x )
468         throws SQLException
469     {
470         statement.setAsciiStream( parameterName, x );
471     }
472 
473     public void setBigDecimal( String parameterName, BigDecimal x )
474         throws SQLException
475     {
476         statement.setBigDecimal( parameterName, x );
477     }
478 
479     public void setBinaryStream( String parameterName, InputStream x, int length )
480         throws SQLException
481     {
482         statement.setBinaryStream( parameterName, x, length );
483     }
484 
485     public void setBinaryStream( String parameterName, InputStream x, long length )
486         throws SQLException
487     {
488         statement.setBinaryStream( parameterName, x, length );
489     }
490 
491     public void setBinaryStream( String parameterName, InputStream x )
492         throws SQLException
493     {
494         statement.setBinaryStream( parameterName, x );
495     }
496 
497     public void setBlob( String parameterName, Blob x )
498         throws SQLException
499     {
500         statement.setBlob( parameterName, x );
501     }
502 
503     public void setBlob( String parameterName, InputStream inputStream, long length )
504         throws SQLException
505     {
506         statement.setBlob( parameterName, inputStream, length );
507     }
508 
509     public void setBlob( String parameterName, InputStream inputStream )
510         throws SQLException
511     {
512         statement.setBlob( parameterName, inputStream );
513     }
514 
515     public void setBoolean( String parameterName, boolean x )
516         throws SQLException
517     {
518         statement.setBoolean( parameterName, x );
519     }
520 
521     public void setByte( String parameterName, byte x )
522         throws SQLException
523     {
524         statement.setByte( parameterName, x );
525     }
526 
527     public void setBytes( String parameterName, byte[] x )
528         throws SQLException
529     {
530         statement.setBytes( parameterName, x );
531     }
532 
533     public void setCharacterStream( String parameterName, Reader reader, int length )
534         throws SQLException
535     {
536         statement.setCharacterStream( parameterName, reader, length );
537     }
538 
539     public void setCharacterStream( String parameterName, Reader reader, long length )
540         throws SQLException
541     {
542         statement.setCharacterStream( parameterName, reader, length );
543     }
544 
545     public void setCharacterStream( String parameterName, Reader reader )
546         throws SQLException
547     {
548         statement.setCharacterStream( parameterName, reader );
549     }
550 
551     public void setClob( String parameterName, Clob x )
552         throws SQLException
553     {
554         statement.setClob( parameterName, x );
555     }
556 
557     public void setClob( String parameterName, Reader reader, long length )
558         throws SQLException
559     {
560         statement.setClob( parameterName, reader, length );
561     }
562 
563     public void setClob( String parameterName, Reader reader )
564         throws SQLException
565     {
566         statement.setClob( parameterName, reader );
567     }
568 
569     public void setDate( String parameterName, Date x, Calendar cal )
570         throws SQLException
571     {
572         statement.setDate( parameterName, x, cal );
573     }
574 
575     public void setDate( String parameterName, Date x )
576         throws SQLException
577     {
578         statement.setDate( parameterName, x );
579     }
580 
581     public void setDouble( String parameterName, double x )
582         throws SQLException
583     {
584         statement.setDouble( parameterName, x );
585     }
586 
587     public void setFloat( String parameterName, float x )
588         throws SQLException
589     {
590         statement.setFloat( parameterName, x );
591     }
592 
593     public void setInt( String parameterName, int x )
594         throws SQLException
595     {
596         statement.setInt( parameterName, x );
597     }
598 
599     public void setLong( String parameterName, long x )
600         throws SQLException
601     {
602         statement.setLong( parameterName, x );
603     }
604 
605     public void setNCharacterStream( String parameterName, Reader value, long length )
606         throws SQLException
607     {
608         statement.setNCharacterStream( parameterName, value, length );
609     }
610 
611     public void setNCharacterStream( String parameterName, Reader value )
612         throws SQLException
613     {
614         statement.setNCharacterStream( parameterName, value );
615     }
616 
617     public void setNClob( String parameterName, NClob value )
618         throws SQLException
619     {
620         statement.setNClob( parameterName, value );
621     }
622 
623     public void setNClob( String parameterName, Reader reader, long length )
624         throws SQLException
625     {
626         statement.setNClob( parameterName, reader, length );
627     }
628 
629     public void setNClob( String parameterName, Reader reader )
630         throws SQLException
631     {
632         statement.setNClob( parameterName, reader );
633     }
634 
635     public void setNString( String parameterName, String value )
636         throws SQLException
637     {
638         statement.setNString( parameterName, value );
639     }
640 
641     public void setNull( String parameterName, int sqlType, String typeName )
642         throws SQLException
643     {
644         statement.setNull( parameterName, sqlType, typeName );
645     }
646 
647     public void setNull( String parameterName, int sqlType )
648         throws SQLException
649     {
650         statement.setNull( parameterName, sqlType );
651     }
652 
653     public void setObject( String parameterName, Object x, int targetSqlType, int scale )
654         throws SQLException
655     {
656         statement.setObject( parameterName, x, targetSqlType, scale );
657     }
658 
659     public void setObject( String parameterName, Object x, int targetSqlType )
660         throws SQLException
661     {
662         statement.setObject( parameterName, x, targetSqlType );
663     }
664 
665     public void setObject( String parameterName, Object x )
666         throws SQLException
667     {
668         statement.setObject( parameterName, x );
669     }
670 
671     public void setRowId( String parameterName, RowId x )
672         throws SQLException
673     {
674         statement.setRowId( parameterName, x );
675     }
676 
677     public void setShort( String parameterName, short x )
678         throws SQLException
679     {
680         statement.setShort( parameterName, x );
681     }
682 
683     public void setSQLXML( String parameterName, SQLXML xmlObject )
684         throws SQLException
685     {
686         statement.setSQLXML( parameterName, xmlObject );
687     }
688 
689     public void setString( String parameterName, String x )
690         throws SQLException
691     {
692         statement.setString( parameterName, x );
693     }
694 
695     public void setTime( String parameterName, Time x, Calendar cal )
696         throws SQLException
697     {
698         statement.setTime( parameterName, x, cal );
699     }
700 
701     public void setTime( String parameterName, Time x )
702         throws SQLException
703     {
704         statement.setTime( parameterName, x );
705     }
706 
707     public void setTimestamp( String parameterName, Timestamp x, Calendar cal )
708         throws SQLException
709     {
710         statement.setTimestamp( parameterName, x, cal );
711     }
712 
713     public void setTimestamp( String parameterName, Timestamp x )
714         throws SQLException
715     {
716         statement.setTimestamp( parameterName, x );
717     }
718 
719     public void setURL( String parameterName, URL val )
720         throws SQLException
721     {
722         statement.setURL( parameterName, val );
723     }
724 
725     public boolean wasNull()
726         throws SQLException
727     {
728         return statement.wasNull();
729     }
730 
731     public Object getObject( int parameterIndex, Map<String, Class<?>> map )
732         throws SQLException
733     {
734         return statement.getObject( parameterIndex, map );
735     }
736 
737     public Object getObject( String parameterName, Map<String, Class<?>> map )
738         throws SQLException
739     {
740         return statement.getObject( parameterName, map );
741     }
742 
743 }