View Javadoc
1   /*
2    *    Copyright 2009-2022 the original author or authors.
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.apache.ibatis.transaction.jdbc;
17  
18  import java.sql.Array;
19  import java.sql.Blob;
20  import java.sql.CallableStatement;
21  import java.sql.Clob;
22  import java.sql.Connection;
23  import java.sql.DatabaseMetaData;
24  import java.sql.NClob;
25  import java.sql.PreparedStatement;
26  import java.sql.SQLClientInfoException;
27  import java.sql.SQLException;
28  import java.sql.SQLWarning;
29  import java.sql.SQLXML;
30  import java.sql.Savepoint;
31  import java.sql.Statement;
32  import java.sql.Struct;
33  import java.util.Map;
34  import java.util.Properties;
35  import java.util.concurrent.Executor;
36  
37  class TestConnection implements Connection {
38    private boolean autoCommit;
39  
40    TestConnection(boolean autoCommit) {
41      super();
42      this.autoCommit = autoCommit;
43    }
44  
45    @Override
46    public void setAutoCommit(boolean autoCommit) throws SQLException {
47      this.autoCommit = autoCommit;
48    }
49  
50    @Override
51    public boolean getAutoCommit() throws SQLException {
52      return autoCommit;
53    }
54  
55    @Override
56    public <T> T unwrap(Class<T> iface) throws SQLException {
57      return null;
58    }
59  
60    @Override
61    public boolean isWrapperFor(Class<?> iface) throws SQLException {
62      return false;
63    }
64  
65    @Override
66    public Statement createStatement() throws SQLException {
67      return null;
68    }
69  
70    @Override
71    public PreparedStatement prepareStatement(String sql) throws SQLException {
72      return null;
73    }
74  
75    @Override
76    public CallableStatement prepareCall(String sql) throws SQLException {
77      return null;
78    }
79  
80    @Override
81    public String nativeSQL(String sql) throws SQLException {
82      return null;
83    }
84  
85    @Override
86    public void commit() throws SQLException {
87    }
88  
89    @Override
90    public void rollback() throws SQLException {
91    }
92  
93    @Override
94    public void close() throws SQLException {
95    }
96  
97    @Override
98    public boolean isClosed() throws SQLException {
99      return false;
100   }
101 
102   @Override
103   public DatabaseMetaData getMetaData() throws SQLException {
104     return null;
105   }
106 
107   @Override
108   public void setReadOnly(boolean readOnly) throws SQLException {
109   }
110 
111   @Override
112   public boolean isReadOnly() throws SQLException {
113     return false;
114   }
115 
116   @Override
117   public void setCatalog(String catalog) throws SQLException {
118   }
119 
120   @Override
121   public String getCatalog() throws SQLException {
122     return null;
123   }
124 
125   @Override
126   public void setTransactionIsolation(int level) throws SQLException {
127   }
128 
129   @Override
130   public int getTransactionIsolation() throws SQLException {
131     return 0;
132   }
133 
134   @Override
135   public SQLWarning getWarnings() throws SQLException {
136     return null;
137   }
138 
139   @Override
140   public void clearWarnings() throws SQLException {
141   }
142 
143   @Override
144   public Statement createStatement(int resultSetType, int resultSetConcurrency) throws SQLException {
145     return null;
146   }
147 
148   @Override
149   public PreparedStatement prepareStatement(String sql, int resultSetType, int resultSetConcurrency)
150       throws SQLException {
151     return null;
152   }
153 
154   @Override
155   public CallableStatement prepareCall(String sql, int resultSetType, int resultSetConcurrency) throws SQLException {
156     return null;
157   }
158 
159   @Override
160   public Map<String, Class<?>> getTypeMap() throws SQLException {
161     return null;
162   }
163 
164   @Override
165   public void setTypeMap(Map<String, Class<?>> map) throws SQLException {
166   }
167 
168   @Override
169   public void setHoldability(int holdability) throws SQLException {
170   }
171 
172   @Override
173   public int getHoldability() throws SQLException {
174     return 0;
175   }
176 
177   @Override
178   public Savepoint setSavepoint() throws SQLException {
179     return null;
180   }
181 
182   @Override
183   public Savepoint setSavepoint(String name) throws SQLException {
184     return null;
185   }
186 
187   @Override
188   public void rollback(Savepoint savepoint) throws SQLException {
189   }
190 
191   @Override
192   public void releaseSavepoint(Savepoint savepoint) throws SQLException {
193   }
194 
195   @Override
196   public Statement createStatement(int resultSetType, int resultSetConcurrency, int resultSetHoldability)
197       throws SQLException {
198     return null;
199   }
200 
201   @Override
202   public PreparedStatement prepareStatement(String sql, int resultSetType, int resultSetConcurrency,
203       int resultSetHoldability) throws SQLException {
204     return null;
205   }
206 
207   @Override
208   public CallableStatement prepareCall(String sql, int resultSetType, int resultSetConcurrency,
209       int resultSetHoldability) throws SQLException {
210     return null;
211   }
212 
213   @Override
214   public PreparedStatement prepareStatement(String sql, int autoGeneratedKeys) throws SQLException {
215     return null;
216   }
217 
218   @Override
219   public PreparedStatement prepareStatement(String sql, int[] columnIndexes) throws SQLException {
220     return null;
221   }
222 
223   @Override
224   public PreparedStatement prepareStatement(String sql, String[] columnNames) throws SQLException {
225     return null;
226   }
227 
228   @Override
229   public Clob createClob() throws SQLException {
230     return null;
231   }
232 
233   @Override
234   public Blob createBlob() throws SQLException {
235     return null;
236   }
237 
238   @Override
239   public NClob createNClob() throws SQLException {
240     return null;
241   }
242 
243   @Override
244   public SQLXML createSQLXML() throws SQLException {
245     return null;
246   }
247 
248   @Override
249   public boolean isValid(int timeout) throws SQLException {
250     return false;
251   }
252 
253   @Override
254   public void setClientInfo(String name, String value) throws SQLClientInfoException {
255   }
256 
257   @Override
258   public void setClientInfo(Properties properties) throws SQLClientInfoException {
259   }
260 
261   @Override
262   public String getClientInfo(String name) throws SQLException {
263     return null;
264   }
265 
266   @Override
267   public Properties getClientInfo() throws SQLException {
268     return null;
269   }
270 
271   @Override
272   public Array createArrayOf(String typeName, Object[] elements) throws SQLException {
273     return null;
274   }
275 
276   @Override
277   public Struct createStruct(String typeName, Object[] attributes) throws SQLException {
278     return null;
279   }
280 
281   @Override
282   public void setSchema(String schema) throws SQLException {
283   }
284 
285   @Override
286   public String getSchema() throws SQLException {
287     return null;
288   }
289 
290   @Override
291   public void abort(Executor executor) throws SQLException {
292   }
293 
294   @Override
295   public void setNetworkTimeout(Executor executor, int milliseconds) throws SQLException {
296   }
297 
298   @Override
299   public int getNetworkTimeout() throws SQLException {
300     return 0;
301   }
302 }