KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > net > sf > hajdbc > sql > MockConnection


1 /*
2  * HA-JDBC: High-Availability JDBC
3  * Copyright (c) 2004-2006 Paul Ferraro
4  *
5  * This library is free software; you can redistribute it and/or modify it
6  * under the terms of the GNU Lesser General Public License as published by the
7  * Free Software Foundation; either version 2.1 of the License, or (at your
8  * option) any later version.
9  *
10  * This library is distributed in the hope that it will be useful, but WITHOUT
11  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12  * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
13  * for more details.
14  *
15  * You should have received a copy of the GNU Lesser General Public License
16  * along with this library; if not, write to the Free Software Foundation,
17  * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18  *
19  * Contact: ferraro@users.sourceforge.net
20  */

21 package net.sf.hajdbc.sql;
22
23 import java.sql.CallableStatement JavaDoc;
24 import java.sql.Connection JavaDoc;
25 import java.sql.DatabaseMetaData JavaDoc;
26 import java.sql.PreparedStatement JavaDoc;
27 import java.sql.ResultSet JavaDoc;
28 import java.sql.SQLException JavaDoc;
29 import java.sql.SQLWarning JavaDoc;
30 import java.sql.Savepoint JavaDoc;
31 import java.sql.Statement JavaDoc;
32 import java.util.Map JavaDoc;
33
34 /**
35  * Mock connection that creates mock statements
36  * @author Paul Ferraro
37  * @since 1.1
38  */

39 public class MockConnection implements Connection
40 {
41     /**
42      * @see java.sql.Connection#createStatement()
43      */

44     public Statement createStatement() throws SQLException JavaDoc
45     {
46         return new MockStatement();
47     }
48
49     /**
50      * @see java.sql.Connection#prepareStatement(java.lang.String)
51      */

52     public PreparedStatement prepareStatement(String JavaDoc arg0) throws SQLException JavaDoc
53     {
54         return null;
55     }
56
57     /**
58      * @see java.sql.Connection#prepareCall(java.lang.String)
59      */

60     public CallableStatement prepareCall(String JavaDoc arg0) throws SQLException JavaDoc
61     {
62         return null;
63     }
64
65     /**
66      * @see java.sql.Connection#nativeSQL(java.lang.String)
67      */

68     public String JavaDoc nativeSQL(String JavaDoc arg0) throws SQLException JavaDoc
69     {
70         return null;
71     }
72
73     /**
74      * @see java.sql.Connection#setAutoCommit(boolean)
75      */

76     public void setAutoCommit(boolean arg0) throws SQLException JavaDoc
77     {
78     }
79
80     /**
81      * @see java.sql.Connection#getAutoCommit()
82      */

83     public boolean getAutoCommit() throws SQLException JavaDoc
84     {
85         return false;
86     }
87
88     /**
89      * @see java.sql.Connection#commit()
90      */

91     public void commit() throws SQLException JavaDoc
92     {
93     }
94
95     /**
96      * @see java.sql.Connection#rollback()
97      */

98     public void rollback() throws SQLException JavaDoc
99     {
100     }
101
102     /**
103      * @see java.sql.Connection#close()
104      */

105     public void close() throws SQLException JavaDoc
106     {
107     }
108
109     /**
110      * @see java.sql.Connection#isClosed()
111      */

112     public boolean isClosed() throws SQLException JavaDoc
113     {
114         return false;
115     }
116
117     /**
118      * @see java.sql.Connection#getMetaData()
119      */

120     public DatabaseMetaData JavaDoc getMetaData() throws SQLException JavaDoc
121     {
122         return null;
123     }
124
125     /**
126      * @see java.sql.Connection#setReadOnly(boolean)
127      */

128     public void setReadOnly(boolean arg0) throws SQLException JavaDoc
129     {
130     }
131
132     /**
133      * @see java.sql.Connection#isReadOnly()
134      */

135     public boolean isReadOnly() throws SQLException JavaDoc
136     {
137         return false;
138     }
139
140     /**
141      * @see java.sql.Connection#setCatalog(java.lang.String)
142      */

143     public void setCatalog(String JavaDoc arg0) throws SQLException JavaDoc
144     {
145     }
146
147     /**
148      * @see java.sql.Connection#getCatalog()
149      */

150     public String JavaDoc getCatalog() throws SQLException JavaDoc
151     {
152         return null;
153     }
154
155     /**
156      * @see java.sql.Connection#setTransactionIsolation(int)
157      */

158     public void setTransactionIsolation(int arg0) throws SQLException JavaDoc
159     {
160     }
161
162     /**
163      * @see java.sql.Connection#getTransactionIsolation()
164      */

165     public int getTransactionIsolation() throws SQLException JavaDoc
166     {
167         return 0;
168     }
169
170     /**
171      * @see java.sql.Connection#getWarnings()
172      */

173     public SQLWarning JavaDoc getWarnings() throws SQLException JavaDoc
174     {
175         return null;
176     }
177
178     /**
179      * @see java.sql.Connection#clearWarnings()
180      */

181     public void clearWarnings() throws SQLException JavaDoc
182     {
183     }
184
185     /**
186      * @see java.sql.Connection#createStatement(int, int)
187      */

188     public Statement createStatement(int arg0, int arg1) throws SQLException JavaDoc
189     {
190         return null;
191     }
192
193     /**
194      * @see java.sql.Connection#prepareStatement(java.lang.String, int, int)
195      */

196     public PreparedStatement prepareStatement(String JavaDoc arg0, int arg1, int arg2) throws SQLException JavaDoc
197     {
198         return null;
199     }
200
201     /**
202      * @see java.sql.Connection#prepareCall(java.lang.String, int, int)
203      */

204     public CallableStatement prepareCall(String JavaDoc arg0, int arg1, int arg2) throws SQLException JavaDoc
205     {
206         return null;
207     }
208
209     /**
210      * @see java.sql.Connection#getTypeMap()
211      */

212     public Map JavaDoc getTypeMap() throws SQLException JavaDoc
213     {
214         return null;
215     }
216
217     /**
218      * @see java.sql.Connection#setTypeMap(java.util.Map)
219      */

220     public void setTypeMap(Map JavaDoc arg0) throws SQLException JavaDoc
221     {
222     }
223
224     /**
225      * @see java.sql.Connection#setHoldability(int)
226      */

227     public void setHoldability(int arg0) throws SQLException JavaDoc
228     {
229     }
230
231     /**
232      * @see java.sql.Connection#getHoldability()
233      */

234     public int getHoldability() throws SQLException JavaDoc
235     {
236         return 0;
237     }
238
239     /**
240      * @see java.sql.Connection#setSavepoint()
241      */

242     public Savepoint setSavepoint() throws SQLException JavaDoc
243     {
244         return null;
245     }
246
247     /**
248      * @see java.sql.Connection#setSavepoint(java.lang.String)
249      */

250     public Savepoint setSavepoint(String JavaDoc arg0) throws SQLException JavaDoc
251     {
252         return null;
253     }
254
255     /**
256      * @see java.sql.Connection#rollback(java.sql.Savepoint)
257      */

258     public void rollback(Savepoint arg0) throws SQLException JavaDoc
259     {
260     }
261
262     /**
263      * @see java.sql.Connection#releaseSavepoint(java.sql.Savepoint)
264      */

265     public void releaseSavepoint(Savepoint arg0) throws SQLException JavaDoc
266     {
267     }
268
269     /**
270      * @see java.sql.Connection#createStatement(int, int, int)
271      */

272     public Statement createStatement(int arg0, int arg1, int arg2) throws SQLException JavaDoc
273     {
274         return null;
275     }
276
277     /**
278      * @see java.sql.Connection#prepareStatement(java.lang.String, int, int, int)
279      */

280     public PreparedStatement prepareStatement(String JavaDoc arg0, int arg1, int arg2, int arg3) throws SQLException JavaDoc
281     {
282         return null;
283     }
284
285     /**
286      * @see java.sql.Connection#prepareCall(java.lang.String, int, int, int)
287      */

288     public CallableStatement prepareCall(String JavaDoc arg0, int arg1, int arg2, int arg3) throws SQLException JavaDoc
289     {
290         return null;
291     }
292
293     /**
294      * @see java.sql.Connection#prepareStatement(java.lang.String, int)
295      */

296     public PreparedStatement prepareStatement(String JavaDoc arg0, int arg1) throws SQLException JavaDoc
297     {
298         return null;
299     }
300
301     /**
302      * @see java.sql.Connection#prepareStatement(java.lang.String, int[])
303      */

304     public PreparedStatement prepareStatement(String JavaDoc arg0, int[] arg1) throws SQLException JavaDoc
305     {
306         return null;
307     }
308
309     /**
310      * @see java.sql.Connection#prepareStatement(java.lang.String, java.lang.String[])
311      */

312     public PreparedStatement prepareStatement(String JavaDoc arg0, String JavaDoc[] arg1) throws SQLException JavaDoc
313     {
314         return null;
315     }
316
317     private class MockStatement implements Statement
318     {
319         /**
320          * @see java.sql.Statement#executeQuery(java.lang.String)
321          */

322         public ResultSet executeQuery(String JavaDoc arg0) throws SQLException JavaDoc
323         {
324             return null;
325         }
326
327         /**
328          * @see java.sql.Statement#executeUpdate(java.lang.String)
329          */

330         public int executeUpdate(String JavaDoc arg0) throws SQLException JavaDoc
331         {
332             return 0;
333         }
334
335         /**
336          * @see java.sql.Statement#close()
337          */

338         public void close() throws SQLException JavaDoc
339         {
340         }
341
342         /**
343          * @see java.sql.Statement#getMaxFieldSize()
344          */

345         public int getMaxFieldSize() throws SQLException JavaDoc
346         {
347             return 0;
348         }
349
350         /**
351          * @see java.sql.Statement#setMaxFieldSize(int)
352          */

353         public void setMaxFieldSize(int arg0) throws SQLException JavaDoc
354         {
355         }
356
357         /**
358          * @see java.sql.Statement#getMaxRows()
359          */

360         public int getMaxRows() throws SQLException JavaDoc
361         {
362             return 0;
363         }
364
365         /**
366          * @see java.sql.Statement#setMaxRows(int)
367          */

368         public void setMaxRows(int arg0) throws SQLException JavaDoc
369         {
370         }
371
372         /**
373          * @see java.sql.Statement#setEscapeProcessing(boolean)
374          */

375         public void setEscapeProcessing(boolean arg0) throws SQLException JavaDoc
376         {
377         }
378
379         /**
380          * @see java.sql.Statement#getQueryTimeout()
381          */

382         public int getQueryTimeout() throws SQLException JavaDoc
383         {
384             return 0;
385         }
386
387         /**
388          * @see java.sql.Statement#setQueryTimeout(int)
389          */

390         public void setQueryTimeout(int arg0) throws SQLException JavaDoc
391         {
392         }
393
394         /**
395          * @see java.sql.Statement#cancel()
396          */

397         public void cancel() throws SQLException JavaDoc
398         {
399         }
400
401         /**
402          * @see java.sql.Statement#getWarnings()
403          */

404         public SQLWarning JavaDoc getWarnings() throws SQLException JavaDoc
405         {
406             return null;
407         }
408
409         /**
410          * @see java.sql.Statement#clearWarnings()
411          */

412         public void clearWarnings() throws SQLException JavaDoc
413         {
414         }
415
416         /**
417          * @see java.sql.Statement#setCursorName(java.lang.String)
418          */

419         public void setCursorName(String JavaDoc arg0) throws SQLException JavaDoc
420         {
421         }
422
423         /**
424          * @see java.sql.Statement#execute(java.lang.String)
425          */

426         public boolean execute(String JavaDoc arg0) throws SQLException JavaDoc
427         {
428             return false;
429         }
430
431         /**
432          * @see java.sql.Statement#getResultSet()
433          */

434         public ResultSet getResultSet() throws SQLException JavaDoc
435         {
436             return null;
437         }
438
439         /**
440          * @see java.sql.Statement#getUpdateCount()
441          */

442         public int getUpdateCount() throws SQLException JavaDoc
443         {
444             return 0;
445         }
446
447         /**
448          * @see java.sql.Statement#getMoreResults()
449          */

450         public boolean getMoreResults() throws SQLException JavaDoc
451         {
452             return false;
453         }
454
455         /**
456          * @see java.sql.Statement#setFetchDirection(int)
457          */

458         public void setFetchDirection(int arg0) throws SQLException JavaDoc
459         {
460         }
461
462         /**
463          * @see java.sql.Statement#getFetchDirection()
464          */

465         public int getFetchDirection() throws SQLException JavaDoc
466         {
467             return 0;
468         }
469
470         /**
471          * @see java.sql.Statement#setFetchSize(int)
472          */

473         public void setFetchSize(int arg0) throws SQLException JavaDoc
474         {
475         }
476
477         /**
478          * @see java.sql.Statement#getFetchSize()
479          */

480         public int getFetchSize() throws SQLException JavaDoc
481         {
482             return 0;
483         }
484
485         /**
486          * @see java.sql.Statement#getResultSetConcurrency()
487          */

488         public int getResultSetConcurrency() throws SQLException JavaDoc
489         {
490             return 0;
491         }
492
493         /**
494          * @see java.sql.Statement#getResultSetType()
495          */

496         public int getResultSetType() throws SQLException JavaDoc
497         {
498             return 0;
499         }
500
501         /**
502          * @see java.sql.Statement#addBatch(java.lang.String)
503          */

504         public void addBatch(String JavaDoc arg0) throws SQLException JavaDoc
505         {
506         }
507
508         /**
509          * @see java.sql.Statement#clearBatch()
510          */

511         public void clearBatch() throws SQLException JavaDoc
512         {
513         }
514
515         /**
516          * @see java.sql.Statement#executeBatch()
517          */

518         public int[] executeBatch() throws SQLException JavaDoc
519         {
520             return null;
521         }
522
523         /**
524          * @see java.sql.Statement#getConnection()
525          */

526         public Connection getConnection() throws SQLException JavaDoc
527         {
528             return null;
529         }
530
531         /**
532          * @see java.sql.Statement#getMoreResults(int)
533          */

534         public boolean getMoreResults(int arg0) throws SQLException JavaDoc
535         {
536             return false;
537         }
538
539         /**
540          * @see java.sql.Statement#getGeneratedKeys()
541          */

542         public ResultSet getGeneratedKeys() throws SQLException JavaDoc
543         {
544             return null;
545         }
546
547         /**
548          * @see java.sql.Statement#executeUpdate(java.lang.String, int)
549          */

550         public int executeUpdate(String JavaDoc arg0, int arg1) throws SQLException JavaDoc
551         {
552             return 0;
553         }
554
555         /**
556          * @see java.sql.Statement#executeUpdate(java.lang.String, int[])
557          */

558         public int executeUpdate(String JavaDoc arg0, int[] arg1) throws SQLException JavaDoc
559         {
560             return 0;
561         }
562
563         /**
564          * @see java.sql.Statement#executeUpdate(java.lang.String, java.lang.String[])
565          */

566         public int executeUpdate(String JavaDoc arg0, String JavaDoc[] arg1) throws SQLException JavaDoc
567         {
568             return 0;
569         }
570
571         /**
572          * @see java.sql.Statement#execute(java.lang.String, int)
573          */

574         public boolean execute(String JavaDoc arg0, int arg1) throws SQLException JavaDoc
575         {
576             return false;
577         }
578
579         /**
580          * @see java.sql.Statement#execute(java.lang.String, int[])
581          */

582         public boolean execute(String JavaDoc arg0, int[] arg1) throws SQLException JavaDoc
583         {
584             return false;
585         }
586
587         /**
588          * @see java.sql.Statement#execute(java.lang.String, java.lang.String[])
589          */

590         public boolean execute(String JavaDoc arg0, String JavaDoc[] arg1) throws SQLException JavaDoc
591         {
592             return false;
593         }
594
595         /**
596          * @see java.sql.Statement#getResultSetHoldability()
597          */

598         public int getResultSetHoldability() throws SQLException JavaDoc
599         {
600             return 0;
601         }
602     }
603 }
604
Popular Tags