View Javadoc
1   /*
2   
3     Licensed to the Apache Software Foundation (ASF) under one or more
4     contributor license agreements.  See the NOTICE file distributed with
5     this work for additional information regarding copyright ownership.
6     The ASF licenses this file to You under the Apache License, Version 2.0
7     (the "License"); you may not use this file except in compliance with
8     the License.  You may obtain a copy of the License at
9   
10        http://www.apache.org/licenses/LICENSE-2.0
11  
12     Unless required by applicable law or agreed to in writing, software
13     distributed under the License is distributed on an "AS IS" BASIS,
14     WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15     See the License for the specific language governing permissions and
16     limitations under the License.
17   */
18  package org.apache.commons.dbcp2;
19  
20  import java.io.InputStream;
21  import java.io.Reader;
22  import java.math.BigDecimal;
23  import java.net.URL;
24  import java.sql.Array;
25  import java.sql.Blob;
26  import java.sql.CallableStatement;
27  import java.sql.Clob;
28  import java.sql.Connection;
29  import java.sql.Date;
30  import java.sql.NClob;
31  import java.sql.Ref;
32  import java.sql.RowId;
33  import java.sql.SQLException;
34  import java.sql.SQLType;
35  import java.sql.SQLXML;
36  import java.sql.Time;
37  import java.sql.Timestamp;
38  import java.util.Calendar;
39  import java.util.Map;
40  
41  /**
42   * Trivial implementation of a CallableStatement to avoid null pointer exceptions in tests.
43   */
44  public class TesterCallableStatement extends TesterPreparedStatement implements CallableStatement {
45  
46      public TesterCallableStatement(final Connection conn) {
47          super(conn);
48      }
49  
50      public TesterCallableStatement(final Connection conn, final String sql) {
51          super(conn, sql);
52      }
53  
54      public TesterCallableStatement(final Connection conn, final String sql, final int resultSetType, final int resultSetConcurrency) {
55          super(conn, sql, resultSetType, resultSetConcurrency);
56      }
57  
58      public TesterCallableStatement(final Connection conn, final String sql, final int resultSetType, final int resultSetConcurrency,
59              final int resultSetHoldability) {
60          super(conn, sql, resultSetType, resultSetConcurrency, resultSetHoldability);
61      }
62  
63      @Override
64      public Array getArray(final int i) throws SQLException {
65          return null;
66      }
67  
68      @Override
69      public Array getArray(final String parameterName) throws SQLException {
70          return null;
71      }
72  
73      @Override
74      public BigDecimal getBigDecimal(final int parameterIndex) throws SQLException {
75          return null;
76      }
77  
78      /**
79       * @deprecated See {@link CallableStatement#getBigDecimal(int,int)}.
80       */
81      @Deprecated
82      @Override
83      public BigDecimal getBigDecimal(final int parameterIndex, final int scale) throws SQLException {
84          return null;
85      }
86  
87      @Override
88      public BigDecimal getBigDecimal(final String parameterName) throws SQLException {
89          return null;
90      }
91  
92      @Override
93      public Blob getBlob(final int i) throws SQLException {
94          return null;
95      }
96  
97      @Override
98      public Blob getBlob(final String parameterName) throws SQLException {
99          return null;
100     }
101 
102     @Override
103     public boolean getBoolean(final int parameterIndex) throws SQLException {
104         return false;
105     }
106 
107     @Override
108     public boolean getBoolean(final String parameterName) throws SQLException {
109         return false;
110     }
111 
112     @Override
113     public byte getByte(final int parameterIndex) throws SQLException {
114         return 0;
115     }
116 
117     @Override
118     public byte getByte(final String parameterName) throws SQLException {
119         return 0;
120     }
121 
122     @Override
123     public byte[] getBytes(final int parameterIndex) throws SQLException {
124         return new byte[0];
125     }
126 
127     @Override
128     public byte[] getBytes(final String parameterName) throws SQLException {
129         return new byte[0];
130     }
131 
132     @Override
133     public Reader getCharacterStream(final int parameterIndex) throws SQLException {
134         return null;
135     }
136 
137     @Override
138     public Reader getCharacterStream(final String parameterName) throws SQLException {
139         return null;
140     }
141 
142     @Override
143     public Clob getClob(final int i) throws SQLException {
144         return null;
145     }
146 
147     @Override
148     public Clob getClob(final String parameterName) throws SQLException {
149         return null;
150     }
151 
152     @Override
153     public Date getDate(final int parameterIndex) throws SQLException {
154         return null;
155     }
156 
157     @Override
158     public Date getDate(final int parameterIndex, final Calendar cal) throws SQLException {
159         return null;
160     }
161 
162     @Override
163     public Date getDate(final String parameterName) throws SQLException {
164         return null;
165     }
166 
167     @Override
168     public Date getDate(final String parameterName, final Calendar cal) throws SQLException {
169         return null;
170     }
171 
172     @Override
173     public double getDouble(final int parameterIndex) throws SQLException {
174         return 0;
175     }
176 
177     @Override
178     public double getDouble(final String parameterName) throws SQLException {
179         return 0;
180     }
181 
182     @Override
183     public float getFloat(final int parameterIndex) throws SQLException {
184         return 0;
185     }
186 
187     @Override
188     public float getFloat(final String parameterName) throws SQLException {
189         return 0;
190     }
191 
192     @Override
193     public int getInt(final int parameterIndex) throws SQLException {
194         return 0;
195     }
196 
197     @Override
198     public int getInt(final String parameterName) throws SQLException {
199         return 0;
200     }
201 
202     @Override
203     public long getLong(final int parameterIndex) throws SQLException {
204         return 0;
205     }
206 
207     @Override
208     public long getLong(final String parameterName) throws SQLException {
209         return 0;
210     }
211 
212     @Override
213     public Reader getNCharacterStream(final int parameterIndex) throws SQLException {
214         return null;
215     }
216 
217     @Override
218     public Reader getNCharacterStream(final String parameterName) throws SQLException {
219         return null;
220     }
221 
222     @Override
223     public NClob getNClob(final int parameterIndex) throws SQLException {
224         return null;
225     }
226 
227     @Override
228     public NClob getNClob(final String parameterName) throws SQLException {
229         return null;
230     }
231 
232     @Override
233     public String getNString(final int parameterIndex) throws SQLException {
234         return null;
235     }
236 
237     @Override
238     public String getNString(final String parameterName) throws SQLException {
239         return null;
240     }
241 
242     @Override
243     public Object getObject(final int parameterIndex) throws SQLException {
244         return null;
245     }
246 
247     @Override
248     public <T> T getObject(final int parameterIndex, final Class<T> type) throws SQLException {
249         return null;
250     }
251 
252     @Override
253     public Object getObject(final int i, final Map<String, Class<?>> map) throws SQLException {
254         return null;
255     }
256 
257     @Override
258     public Object getObject(final String parameterName) throws SQLException {
259         return null;
260     }
261 
262     @Override
263     public <T> T getObject(final String parameterName, final Class<T> type) throws SQLException {
264         return null;
265     }
266 
267     @Override
268     public Object getObject(final String parameterName, final Map<String,Class<?>> map) throws SQLException {
269         return null;
270     }
271 
272     @Override
273     public Ref getRef(final int i) throws SQLException {
274         return null;
275     }
276 
277     @Override
278     public Ref getRef(final String parameterName) throws SQLException {
279         return null;
280     }
281 
282     @Override
283     public RowId getRowId(final int parameterIndex) throws SQLException {
284         return null;
285     }
286 
287     @Override
288     public RowId getRowId(final String parameterName) throws SQLException {
289         return null;
290     }
291 
292     @Override
293     public short getShort(final int parameterIndex) throws SQLException {
294         return 0;
295     }
296 
297     @Override
298     public short getShort(final String parameterName) throws SQLException {
299         return 0;
300     }
301 
302     @Override
303     public SQLXML getSQLXML(final int parameterIndex) throws SQLException {
304         return null;
305     }
306 
307     @Override
308     public SQLXML getSQLXML(final String parameterName) throws SQLException {
309         return null;
310     }
311 
312     @Override
313     public String getString(final int parameterIndex) throws SQLException {
314         return null;
315     }
316 
317     @Override
318     public String getString(final String parameterName) throws SQLException {
319         return null;
320     }
321 
322     @Override
323     public Time getTime(final int parameterIndex) throws SQLException {
324         return null;
325     }
326 
327     @Override
328     public Time getTime(final int parameterIndex, final Calendar cal) throws SQLException {
329         return null;
330     }
331 
332     @Override
333     public Time getTime(final String parameterName) throws SQLException {
334         return null;
335     }
336 
337     @Override
338     public Time getTime(final String parameterName, final Calendar cal) throws SQLException {
339         return null;
340     }
341 
342     @Override
343     public Timestamp getTimestamp(final int parameterIndex) throws SQLException {
344         return null;
345     }
346 
347     @Override
348     public Timestamp getTimestamp(final int parameterIndex, final Calendar cal) throws SQLException {
349         return null;
350     }
351 
352     @Override
353     public Timestamp getTimestamp(final String parameterName) throws SQLException {
354         return null;
355     }
356 
357     @Override
358     public Timestamp getTimestamp(final String parameterName, final Calendar cal) throws SQLException {
359         return null;
360     }
361 
362     @Override
363     public URL getURL(final int parameterIndex) throws SQLException {
364         return null;
365     }
366 
367     @Override
368     public URL getURL(final String parameterName) throws SQLException {
369         return null;
370     }
371 
372     @Override
373     public void registerOutParameter(final int parameterIndex, final int sqlType) throws SQLException {
374     }
375 
376     @Override
377     public void registerOutParameter(final int parameterIndex, final int sqlType, final int scale) throws SQLException {
378     }
379 
380     @Override
381     public void registerOutParameter(final int paramIndex, final int sqlType, final String typeName) throws SQLException {
382     }
383 
384     @Override
385     public void registerOutParameter(final int parameterIndex, final SQLType sqlType) throws SQLException {
386         // Do nothing
387     }
388 
389     @Override
390     public void registerOutParameter(final int parameterIndex, final SQLType sqlType, final int scale) throws SQLException {
391         // Do nothing
392     }
393 
394     @Override
395     public void registerOutParameter(final int parameterIndex, final SQLType sqlType, final String typeName) throws SQLException {
396         // Do nothing
397     }
398 
399     @Override
400     public void registerOutParameter(final String parameterName, final int sqlType) throws SQLException {
401     }
402 
403     @Override
404     public void registerOutParameter(final String parameterName, final int sqlType, final int scale) throws SQLException {
405     }
406 
407     @Override
408     public void registerOutParameter(final String parameterName, final int sqlType, final String typeName) throws SQLException {
409     }
410 
411     @Override
412     public void registerOutParameter(final String parameterName, final SQLType sqlType) throws SQLException {
413         // Do nothing
414     }
415 
416     @Override
417     public void registerOutParameter(final String parameterName, final SQLType sqlType, final int scale) throws SQLException {
418         // Do nothing
419     }
420 
421     @Override
422     public void registerOutParameter(final String parameterName, final SQLType sqlType, final String typeName) throws SQLException {
423         // Do nothing
424     }
425 
426     @Override
427     public void setAsciiStream(final String parameterName, final InputStream inputStream) throws SQLException {
428     }
429 
430     @Override
431     public void setAsciiStream(final String parameterName, final InputStream x, final int length) throws SQLException {
432     }
433 
434     @Override
435     public void setAsciiStream(final String parameterName, final InputStream inputStream, final long length) throws SQLException {
436     }
437 
438     @Override
439     public void setBigDecimal(final String parameterName, final BigDecimal x) throws SQLException {
440     }
441 
442     @Override
443     public void setBinaryStream(final String parameterName, final InputStream inputStream) throws SQLException {
444     }
445 
446     @Override
447     public void setBinaryStream(final String parameterName, final InputStream x, final int length) throws SQLException {
448     }
449 
450     @Override
451     public void setBinaryStream(final String parameterName, final InputStream inputStream, final long length) throws SQLException {
452     }
453 
454     @Override
455     public void setBlob(final String parameterName, final Blob blob) throws SQLException {
456     }
457 
458     @Override
459     public void setBlob(final String parameterName, final InputStream inputStream) throws SQLException {
460     }
461 
462     @Override
463     public void setBlob(final String parameterName, final InputStream inputStream, final long length) throws SQLException {
464     }
465 
466     @Override
467     public void setBoolean(final String parameterName, final boolean x) throws SQLException {
468     }
469 
470     @Override
471     public void setByte(final String parameterName, final byte x) throws SQLException {
472     }
473 
474     @Override
475     public void setBytes(final String parameterName, final byte[] x) throws SQLException {
476     }
477 
478     @Override
479     public void setCharacterStream(final String parameterName, final Reader reader) throws SQLException {
480     }
481 
482     @Override
483     public void setCharacterStream(final String parameterName, final Reader reader, final int length) throws SQLException {
484     }
485 
486     @Override
487     public void setCharacterStream(final String parameterName, final Reader reader, final long length) throws SQLException {
488     }
489 
490     @Override
491     public void setClob(final String parameterName, final Clob clob) throws SQLException {
492     }
493 
494     @Override
495     public void setClob(final String parameterName, final Reader reader) throws SQLException {
496     }
497 
498     @Override
499     public void setClob(final String parameterName, final Reader reader, final long length) throws SQLException {
500     }
501 
502     @Override
503     public void setDate(final String parameterName, final Date x) throws SQLException {
504     }
505 
506     @Override
507     public void setDate(final String parameterName, final Date x, final Calendar cal) throws SQLException {
508     }
509 
510     @Override
511     public void setDouble(final String parameterName, final double x) throws SQLException {
512     }
513 
514     @Override
515     public void setFloat(final String parameterName, final float x) throws SQLException {
516     }
517 
518     @Override
519     public void setInt(final String parameterName, final int x) throws SQLException {
520     }
521 
522     @Override
523     public void setLong(final String parameterName, final long x) throws SQLException {
524     }
525 
526     @Override
527     public void setNCharacterStream(final String parameterName, final Reader reader) throws SQLException {
528     }
529 
530     @Override
531     public void setNCharacterStream(final String parameterName, final Reader reader, final long length) throws SQLException {
532     }
533 
534     @Override
535     public void setNClob(final String parameterName, final NClob value) throws SQLException {
536     }
537 
538     @Override
539     public void setNClob(final String parameterName, final Reader reader) throws SQLException {
540     }
541 
542     @Override
543     public void setNClob(final String parameterName, final Reader reader, final long length) throws SQLException {
544     }
545 
546     @Override
547     public void setNString(final String parameterName, final String value) throws SQLException {
548     }
549 
550     @Override
551     public void setNull(final String parameterName, final int sqlType) throws SQLException {
552     }
553 
554     @Override
555     public void setNull(final String parameterName, final int sqlType, final String typeName) throws SQLException {
556     }
557 
558     @Override
559     public void setObject(final String parameterName, final Object x) throws SQLException {
560     }
561 
562     @Override
563     public void setObject(final String parameterName, final Object x, final int targetSqlType) throws SQLException {
564     }
565 
566     @Override
567     public void setObject(final String parameterName, final Object x, final int targetSqlType, final int scale) throws SQLException {
568     }
569 
570     @Override
571     public void setObject(final String parameterName, final Object x, final SQLType targetSqlType) throws SQLException {
572         // Do nothing
573     }
574 
575     @Override
576     public void setObject(final String parameterName, final Object x, final SQLType targetSqlType, final int scaleOrLength)
577             throws SQLException {
578         // Do nothing
579     }
580 
581     @Override
582     public void setRowId(final String parameterName, final RowId value) throws SQLException {
583     }
584 
585     @Override
586     public void setShort(final String parameterName, final short x) throws SQLException {
587     }
588 
589     @Override
590     public void setSQLXML(final String parameterName, final SQLXML value) throws SQLException {
591     }
592 
593     @Override
594     public void setString(final String parameterName, final String x) throws SQLException {
595     }
596 
597     @Override
598     public void setTime(final String parameterName, final Time x) throws SQLException {
599     }
600 
601     @Override
602     public void setTime(final String parameterName, final Time x, final Calendar cal) throws SQLException {
603     }
604 
605     @Override
606     public void setTimestamp(final String parameterName, final Timestamp x) throws SQLException {
607     }
608 
609     @Override
610     public void setTimestamp(final String parameterName, final Timestamp x, final Calendar cal) throws SQLException {
611     }
612 
613     @Override
614     public void setURL(final String parameterName, final URL val) throws SQLException {
615     }
616 
617     @Override
618     public boolean wasNull() throws SQLException {
619         return false;
620     }
621 }