Debian Codegraph @

src/test/java/com/zaxxer/hikari/mocks/StubPreparedStatement.java

raw
1 /*
2 * Copyright (C) 2013 Brett Wooldridge
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
17 package com.zaxxer.hikari.mocks;
18
19 import java.io.InputStream;
20 import java.io.Reader;
21 import java.math.BigDecimal;
22 import java.net.URL;
23 import java.sql.Array;
24 import java.sql.Blob;
25 import java.sql.Clob;
26 import java.sql.Connection;
27 import java.sql.Date;
28 import java.sql.NClob;
29 import java.sql.ParameterMetaData;
30 import java.sql.PreparedStatement;
31 import java.sql.Ref;
32 import java.sql.ResultSet;
33 import java.sql.ResultSetMetaData;
34 import java.sql.RowId;
35 import java.sql.SQLException;
36 import java.sql.SQLWarning;
37 import java.sql.SQLXML;
38 import java.sql.Time;
39 import java.sql.Timestamp;
40 import java.util.Calendar;
41
42 /**
43 *
44 * @author Brett Wooldridge
45 */
46 @SuppressWarnings("RedundantThrows")
47 public class StubPreparedStatement extends StubStatement implements PreparedStatement
48 {
49 StubPreparedStatement(Connection connection)
50 {
51 super(connection);
52 }
53
54 /** {@inheritDoc} */
55 @Override
56 public ResultSet executeQuery(String sql) throws SQLException
57 {
58 return new StubResultSet();
59 }
60
61 /** {@inheritDoc} */
62 @Override
63 public int executeUpdate(String sql) throws SQLException
64 {
65 return 0;
66 }
67
68 /** {@inheritDoc} */
69 @Override
70 public int getMaxFieldSize() throws SQLException
71 {
72 throw new SQLException("Simulated disconnection error", "08999");
73 }
74
75 /** {@inheritDoc} */
76 @Override
77 public void setMaxFieldSize(int max) throws SQLException
78 {
79 }
80
81 /** {@inheritDoc} */
82 @Override
83 public int getMaxRows() throws SQLException
84 {
85 return 0;
86 }
87
88 /** {@inheritDoc} */
89 @Override
90 public void setMaxRows(int max) throws SQLException
91 {
92 }
93
94 /** {@inheritDoc} */
95 @Override
96 public void setEscapeProcessing(boolean enable) throws SQLException
97 {
98 }
99
100 /** {@inheritDoc} */
101 @Override
102 public int getQueryTimeout() throws SQLException
103 {
104 return 0;
105 }
106
107 /** {@inheritDoc} */
108 @Override
109 public void setQueryTimeout(int seconds) throws SQLException
110 {
111 }
112
113 /** {@inheritDoc} */
114 @Override
115 public void cancel() throws SQLException
116 {
117 }
118
119 /** {@inheritDoc} */
120 @Override
121 public SQLWarning getWarnings() throws SQLException
122 {
123 return null;
124 }
125
126 /** {@inheritDoc} */
127 @Override
128 public void clearWarnings() throws SQLException
129 {
130 }
131
132 /** {@inheritDoc} */
133 @Override
134 public void setCursorName(String name) throws SQLException
135 {
136 }
137
138 /** {@inheritDoc} */
139 @Override
140 public boolean execute(String sql) throws SQLException
141 {
142 return false;
143 }
144
145 /** {@inheritDoc} */
146 @Override
147 public ResultSet getResultSet() throws SQLException
148 {
149 return new StubResultSet();
150 }
151
152 /** {@inheritDoc} */
153 @Override
154 public int getUpdateCount() throws SQLException
155 {
156 return 0;
157 }
158
159 /** {@inheritDoc} */
160 @Override
161 public boolean getMoreResults() throws SQLException
162 {
163 if (isClosed())
164 {
165 throw new SQLException("Connection is closed");
166 }
167 return false;
168 }
169
170 /** {@inheritDoc} */
171 @Override
172 public void setFetchDirection(int direction) throws SQLException
173 {
174 }
175
176 /** {@inheritDoc} */
177 @Override
178 public int getFetchDirection() throws SQLException
179 {
180 return 0;
181 }
182
183 /** {@inheritDoc} */
184 @Override
185 public void setFetchSize(int rows) throws SQLException
186 {
187 }
188
189 /** {@inheritDoc} */
190 @Override
191 public int getFetchSize() throws SQLException
192 {
193 return 0;
194 }
195
196 /** {@inheritDoc} */
197 @Override
198 public int getResultSetConcurrency() throws SQLException
199 {
200 return 0;
201 }
202
203 /** {@inheritDoc} */
204 @Override
205 public int getResultSetType() throws SQLException
206 {
207 return 0;
208 }
209
210 /** {@inheritDoc} */
211 @Override
212 public void addBatch(String sql) throws SQLException
213 {
214 }
215
216 /** {@inheritDoc} */
217 @Override
218 public void clearBatch() throws SQLException
219 {
220 }
221
222 /** {@inheritDoc} */
223 @Override
224 public int[] executeBatch() throws SQLException
225 {
226 return null;
227 }
228
229 /** {@inheritDoc} */
230 @Override
231 public boolean getMoreResults(int current) throws SQLException
232 {
233 return false;
234 }
235
236 /** {@inheritDoc} */
237 @Override
238 public ResultSet getGeneratedKeys() throws SQLException
239 {
240 return new StubResultSet();
241 }
242
243 /** {@inheritDoc} */
244 @Override
245 public int executeUpdate(String sql, int autoGeneratedKeys) throws SQLException
246 {
247 return 0;
248 }
249
250 /** {@inheritDoc} */
251 @Override
252 public int executeUpdate(String sql, int[] columnIndexes) throws SQLException
253 {
254 return 0;
255 }
256
257 /** {@inheritDoc} */
258 @Override
259 public int executeUpdate(String sql, String[] columnNames) throws SQLException
260 {
261 return 0;
262 }
263
264 /** {@inheritDoc} */
265 @Override
266 public boolean execute(String sql, int autoGeneratedKeys) throws SQLException
267 {
268 return false;
269 }
270
271 /** {@inheritDoc} */
272 @Override
273 public boolean execute(String sql, int[] columnIndexes) throws SQLException
274 {
275 return false;
276 }
277
278 /** {@inheritDoc} */
279 @Override
280 public boolean execute(String sql, String[] columnNames) throws SQLException
281 {
282 return false;
283 }
284
285 /** {@inheritDoc} */
286 @Override
287 public int getResultSetHoldability() throws SQLException
288 {
289 return 0;
290 }
291
292 /** {@inheritDoc} */
293 @Override
294 public void setPoolable(boolean poolable) throws SQLException
295 {
296 }
297
298 /** {@inheritDoc} */
299 @Override
300 public boolean isPoolable() throws SQLException
301 {
302 return false;
303 }
304
305 /** {@inheritDoc} */
306 @Override
307 public void closeOnCompletion() throws SQLException
308 {
309 }
310
311 /** {@inheritDoc} */
312 @Override
313 public boolean isCloseOnCompletion() throws SQLException
314 {
315 return false;
316 }
317
318 /** {@inheritDoc} */
319 @SuppressWarnings("unchecked")
320 @Override
321 public <T> T unwrap(Class<T> iface) throws SQLException
322 {
323 if (iface.isInstance(this)) {
324 return (T) this;
325 }
326
327 throw new SQLException("Wrapped connection is not an instance of " + iface);
328 }
329
330 /** {@inheritDoc} */
331 @Override
332 public boolean isWrapperFor(Class<?> iface) throws SQLException
333 {
334 return false;
335 }
336
337 /** {@inheritDoc} */
338 @Override
339 public ResultSet executeQuery() throws SQLException
340 {
341 return new StubResultSet();
342 }
343
344 /** {@inheritDoc} */
345 @Override
346 public int executeUpdate() throws SQLException
347 {
348 return 0;
349 }
350
351 /** {@inheritDoc} */
352 @Override
353 public void setNull(int parameterIndex, int sqlType) throws SQLException
354 {
355 }
356
357 /** {@inheritDoc} */
358 @Override
359 public void setBoolean(int parameterIndex, boolean x) throws SQLException
360 {
361 }
362
363 /** {@inheritDoc} */
364 @Override
365 public void setByte(int parameterIndex, byte x) throws SQLException
366 {
367 }
368
369 /** {@inheritDoc} */
370 @Override
371 public void setShort(int parameterIndex, short x) throws SQLException
372 {
373 }
374
375 /** {@inheritDoc} */
376 @Override
377 public void setInt(int parameterIndex, int x) throws SQLException
378 {
379 }
380
381 /** {@inheritDoc} */
382 @Override
383 public void setLong(int parameterIndex, long x) throws SQLException
384 {
385 }
386
387 /** {@inheritDoc} */
388 @Override
389 public void setFloat(int parameterIndex, float x) throws SQLException
390 {
391 }
392
393 /** {@inheritDoc} */
394 @Override
395 public void setDouble(int parameterIndex, double x) throws SQLException
396 {
397 }
398
399 /** {@inheritDoc} */
400 @Override
401 public void setBigDecimal(int parameterIndex, BigDecimal x) throws SQLException
402 {
403 }
404
405 /** {@inheritDoc} */
406 @Override
407 public void setString(int parameterIndex, String x) throws SQLException
408 {
409 }
410
411 /** {@inheritDoc} */
412 @Override
413 public void setBytes(int parameterIndex, byte[] x) throws SQLException
414 {
415 }
416
417 /** {@inheritDoc} */
418 @Override
419 public void setDate(int parameterIndex, Date x) throws SQLException
420 {
421 }
422
423 /** {@inheritDoc} */
424 @Override
425 public void setTime(int parameterIndex, Time x) throws SQLException
426 {
427 }
428
429 /** {@inheritDoc} */
430 @Override
431 public void setTimestamp(int parameterIndex, Timestamp x) throws SQLException
432 {
433 }
434
435 /** {@inheritDoc} */
436 @Override
437 public void setAsciiStream(int parameterIndex, InputStream x, int length) throws SQLException
438 {
439 }
440
441 /** {@inheritDoc} */
442 @Override
443 @SuppressWarnings("deprecation")
444 public void setUnicodeStream(int parameterIndex, InputStream x, int length) throws SQLException
445 {
446 }
447
448 /** {@inheritDoc} */
449 @Override
450 public void setBinaryStream(int parameterIndex, InputStream x, int length) throws SQLException
451 {
452 }
453
454 /** {@inheritDoc} */
455 @Override
456 public void clearParameters() throws SQLException
457 {
458 }
459
460 /** {@inheritDoc} */
461 @Override
462 public void setObject(int parameterIndex, Object x, int targetSqlType) throws SQLException
463 {
464 }
465
466 /** {@inheritDoc} */
467 @Override
468 public void setObject(int parameterIndex, Object x) throws SQLException
469 {
470 }
471
472 /** {@inheritDoc} */
473 @Override
474 public boolean execute() throws SQLException
475 {
476 return false;
477 }
478
479 /** {@inheritDoc} */
480 @Override
481 public void addBatch() throws SQLException
482 {
483 }
484
485 /** {@inheritDoc} */
486 @Override
487 public void setCharacterStream(int parameterIndex, Reader reader, int length) throws SQLException
488 {
489 }
490
491 /** {@inheritDoc} */
492 @Override
493 public void setRef(int parameterIndex, Ref x) throws SQLException
494 {
495 }
496
497 /** {@inheritDoc} */
498 @Override
499 public void setBlob(int parameterIndex, Blob x) throws SQLException
500 {
501 }
502
503 /** {@inheritDoc} */
504 @Override
505 public void setClob(int parameterIndex, Clob x) throws SQLException
506 {
507 }
508
509 /** {@inheritDoc} */
510 @Override
511 public void setArray(int parameterIndex, Array x) throws SQLException
512 {
513 }
514
515 /** {@inheritDoc} */
516 @Override
517 public ResultSetMetaData getMetaData() throws SQLException
518 {
519 return null;
520 }
521
522 /** {@inheritDoc} */
523 @Override
524 public void setDate(int parameterIndex, Date x, Calendar cal) throws SQLException
525 {
526 }
527
528 /** {@inheritDoc} */
529 @Override
530 public void setTime(int parameterIndex, Time x, Calendar cal) throws SQLException
531 {
532 }
533
534 /** {@inheritDoc} */
535 @Override
536 public void setTimestamp(int parameterIndex, Timestamp x, Calendar cal) throws SQLException
537 {
538 }
539
540 /** {@inheritDoc} */
541 @Override
542 public void setNull(int parameterIndex, int sqlType, String typeName) throws SQLException
543 {
544 }
545
546 /** {@inheritDoc} */
547 @Override
548 public void setURL(int parameterIndex, URL x) throws SQLException
549 {
550 }
551
552 /** {@inheritDoc} */
553 @Override
554 public ParameterMetaData getParameterMetaData() throws SQLException
555 {
556 return null;
557 }
558
559 /** {@inheritDoc} */
560 @Override
561 public void setRowId(int parameterIndex, RowId x) throws SQLException
562 {
563 }
564
565 /** {@inheritDoc} */
566 @Override
567 public void setNString(int parameterIndex, String value) throws SQLException
568 {
569 }
570
571 /** {@inheritDoc} */
572 @Override
573 public void setNCharacterStream(int parameterIndex, Reader value, long length) throws SQLException
574 {
575 }
576
577 /** {@inheritDoc} */
578 @Override
579 public void setNClob(int parameterIndex, NClob value) throws SQLException
580 {
581 }
582
583 /** {@inheritDoc} */
584 @Override
585 public void setClob(int parameterIndex, Reader reader, long length) throws SQLException
586 {
587 }
588
589 /** {@inheritDoc} */
590 @Override
591 public void setBlob(int parameterIndex, InputStream inputStream, long length) throws SQLException
592 {
593 }
594
595 /** {@inheritDoc} */
596 @Override
597 public void setNClob(int parameterIndex, Reader reader, long length) throws SQLException
598 {
599 }
600
601 /** {@inheritDoc} */
602 @Override
603 public void setSQLXML(int parameterIndex, SQLXML xmlObject) throws SQLException
604 {
605 }
606
607 /** {@inheritDoc} */
608 @Override
609 public void setObject(int parameterIndex, Object x, int targetSqlType, int scaleOrLength) throws SQLException
610 {
611 }
612
613 /** {@inheritDoc} */
614 @Override
615 public void setAsciiStream(int parameterIndex, InputStream x, long length) throws SQLException
616 {
617 }
618
619 /** {@inheritDoc} */
620 @Override
621 public void setBinaryStream(int parameterIndex, InputStream x, long length) throws SQLException
622 {
623 }
624
625 /** {@inheritDoc} */
626 @Override
627 public void setCharacterStream(int parameterIndex, Reader reader, long length) throws SQLException
628 {
629 }
630
631 /** {@inheritDoc} */
632 @Override
633 public void setAsciiStream(int parameterIndex, InputStream x) throws SQLException
634 {
635 }
636
637 /** {@inheritDoc} */
638 @Override
639 public void setBinaryStream(int parameterIndex, InputStream x) throws SQLException
640 {
641 }
642
643 /** {@inheritDoc} */
644 @Override
645 public void setCharacterStream(int parameterIndex, Reader reader) throws SQLException
646 {
647 }
648
649 /** {@inheritDoc} */
650 @Override
651 public void setNCharacterStream(int parameterIndex, Reader value) throws SQLException
652 {
653 }
654
655 /** {@inheritDoc} */
656 @Override
657 public void setClob(int parameterIndex, Reader reader) throws SQLException
658 {
659 }
660
661 /** {@inheritDoc} */
662 @Override
663 public void setBlob(int parameterIndex, InputStream inputStream) throws SQLException
664 {
665 }
666
667 /** {@inheritDoc} */
668 @Override
669 public void setNClob(int parameterIndex, Reader reader) throws SQLException
670 {
671 }
672
673 }