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