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