1 /*
2 * Copyright 2004-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 com.ibatis.sqlmap.engine.impl;
17
18 import com.ibatis.common.util.PaginatedList;
19 import com.ibatis.sqlmap.client.SqlMapClient;
20 import com.ibatis.sqlmap.client.SqlMapSession;
21 import com.ibatis.sqlmap.client.event.RowHandler;
22 import com.ibatis.sqlmap.engine.execution.BatchException;
23 import com.ibatis.sqlmap.engine.execution.SqlExecutor;
24 import com.ibatis.sqlmap.engine.mapping.result.ResultObjectFactory;
25 import com.ibatis.sqlmap.engine.mapping.statement.MappedStatement;
26
27 import java.sql.Connection;
28 import java.sql.SQLException;
29 import java.util.List;
30 import java.util.Map;
31
32 import javax.sql.DataSource;
33
34 /**
35 * The Interface ExtendedSqlMapClient.
36 *
37 * @deprecated - this class is uneccessary and should be removed as soon as possible. Currently spring integration
38 * depends on it.
39 */
40 public interface ExtendedSqlMapClient extends SqlMapClient {
41
42 /**
43 * Insert.
44 *
45 * @param id
46 * the id
47 * @param param
48 * the param
49 *
50 * @return the object
51 *
52 * @throws SQLException
53 * the SQL exception
54 */
55 Object insert(String id, Object param) throws SQLException;
56
57 /**
58 * Insert.
59 *
60 * @param id
61 * the id
62 *
63 * @return the object
64 *
65 * @throws SQLException
66 * the SQL exception
67 */
68 Object insert(String id) throws SQLException;
69
70 /**
71 * Update.
72 *
73 * @param id
74 * the id
75 * @param param
76 * the param
77 *
78 * @return the int
79 *
80 * @throws SQLException
81 * the SQL exception
82 */
83 int update(String id, Object param) throws SQLException;
84
85 /**
86 * Update.
87 *
88 * @param id
89 * the id
90 *
91 * @return the int
92 *
93 * @throws SQLException
94 * the SQL exception
95 */
96 int update(String id) throws SQLException;
97
98 /**
99 * Delete.
100 *
101 * @param id
102 * the id
103 * @param param
104 * the param
105 *
106 * @return the int
107 *
108 * @throws SQLException
109 * the SQL exception
110 */
111 int delete(String id, Object param) throws SQLException;
112
113 /**
114 * Delete.
115 *
116 * @param id
117 * the id
118 *
119 * @return the int
120 *
121 * @throws SQLException
122 * the SQL exception
123 */
124 int delete(String id) throws SQLException;
125
126 /**
127 * Query for object.
128 *
129 * @param id
130 * the id
131 * @param paramObject
132 * the param object
133 *
134 * @return the object
135 *
136 * @throws SQLException
137 * the SQL exception
138 */
139 Object queryForObject(String id, Object paramObject) throws SQLException;
140
141 /**
142 * Query for object.
143 *
144 * @param id
145 * the id
146 *
147 * @return the object
148 *
149 * @throws SQLException
150 * the SQL exception
151 */
152 Object queryForObject(String id) throws SQLException;
153
154 /**
155 * Query for object.
156 *
157 * @param id
158 * the id
159 * @param paramObject
160 * the param object
161 * @param resultObject
162 * the result object
163 *
164 * @return the object
165 *
166 * @throws SQLException
167 * the SQL exception
168 */
169 Object queryForObject(String id, Object paramObject, Object resultObject) throws SQLException;
170
171 /**
172 * Query for list.
173 *
174 * @param id
175 * the id
176 * @param paramObject
177 * the param object
178 *
179 * @return the list
180 *
181 * @throws SQLException
182 * the SQL exception
183 */
184 List queryForList(String id, Object paramObject) throws SQLException;
185
186 /**
187 * Query for list.
188 *
189 * @param id
190 * the id
191 *
192 * @return the list
193 *
194 * @throws SQLException
195 * the SQL exception
196 */
197 List queryForList(String id) throws SQLException;
198
199 /**
200 * Query for list.
201 *
202 * @param id
203 * the id
204 * @param paramObject
205 * the param object
206 * @param skip
207 * the skip
208 * @param max
209 * the max
210 *
211 * @return the list
212 *
213 * @throws SQLException
214 * the SQL exception
215 */
216 List queryForList(String id, Object paramObject, int skip, int max) throws SQLException;
217
218 /**
219 * Query for list.
220 *
221 * @param id
222 * the id
223 * @param skip
224 * the skip
225 * @param max
226 * the max
227 *
228 * @return the list
229 *
230 * @throws SQLException
231 * the SQL exception
232 */
233 List queryForList(String id, int skip, int max) throws SQLException;
234
235 /**
236 * Query for paginated list.
237 *
238 * @param id
239 * the id
240 * @param paramObject
241 * the param object
242 * @param pageSize
243 * the page size
244 *
245 * @return the paginated list
246 *
247 * @throws SQLException
248 * the SQL exception
249 */
250 PaginatedList queryForPaginatedList(String id, Object paramObject, int pageSize) throws SQLException;
251
252 /**
253 * Query for paginated list.
254 *
255 * @param id
256 * the id
257 * @param pageSize
258 * the page size
259 *
260 * @return the paginated list
261 *
262 * @throws SQLException
263 * the SQL exception
264 */
265 PaginatedList queryForPaginatedList(String id, int pageSize) throws SQLException;
266
267 /**
268 * Query for map.
269 *
270 * @param id
271 * the id
272 * @param paramObject
273 * the param object
274 * @param keyProp
275 * the key prop
276 *
277 * @return the map
278 *
279 * @throws SQLException
280 * the SQL exception
281 */
282 Map queryForMap(String id, Object paramObject, String keyProp) throws SQLException;
283
284 /**
285 * Query for map.
286 *
287 * @param id
288 * the id
289 * @param paramObject
290 * the param object
291 * @param keyProp
292 * the key prop
293 * @param valueProp
294 * the value prop
295 *
296 * @return the map
297 *
298 * @throws SQLException
299 * the SQL exception
300 */
301 Map queryForMap(String id, Object paramObject, String keyProp, String valueProp) throws SQLException;
302
303 /**
304 * Query with row handler.
305 *
306 * @param id
307 * the id
308 * @param paramObject
309 * the param object
310 * @param rowHandler
311 * the row handler
312 *
313 * @throws SQLException
314 * the SQL exception
315 */
316 void queryWithRowHandler(String id, Object paramObject, RowHandler rowHandler) throws SQLException;
317
318 /**
319 * Query with row handler.
320 *
321 * @param id
322 * the id
323 * @param rowHandler
324 * the row handler
325 *
326 * @throws SQLException
327 * the SQL exception
328 */
329 void queryWithRowHandler(String id, RowHandler rowHandler) throws SQLException;
330
331 /**
332 * Start transaction.
333 *
334 * @throws SQLException
335 * the SQL exception
336 */
337 void startTransaction() throws SQLException;
338
339 /**
340 * Start transaction.
341 *
342 * @param transactionIsolation
343 * the transaction isolation
344 *
345 * @throws SQLException
346 * the SQL exception
347 */
348 void startTransaction(int transactionIsolation) throws SQLException;
349
350 /**
351 * Commit transaction.
352 *
353 * @throws SQLException
354 * the SQL exception
355 */
356 void commitTransaction() throws SQLException;
357
358 /**
359 * End transaction.
360 *
361 * @throws SQLException
362 * the SQL exception
363 */
364 void endTransaction() throws SQLException;
365
366 /**
367 * Start batch.
368 *
369 * @throws SQLException
370 * the SQL exception
371 */
372 void startBatch() throws SQLException;
373
374 /**
375 * Execute batch.
376 *
377 * @return the int
378 *
379 * @throws SQLException
380 * the SQL exception
381 */
382 int executeBatch() throws SQLException;
383
384 /**
385 * Execute batch detailed.
386 *
387 * @return the list
388 *
389 * @throws SQLException
390 * the SQL exception
391 * @throws BatchException
392 * the batch exception
393 */
394 List executeBatchDetailed() throws SQLException, BatchException;
395
396 /**
397 * Sets the user connection.
398 *
399 * @param connection
400 * the new user connection
401 *
402 * @throws SQLException
403 * the SQL exception
404 */
405 void setUserConnection(Connection connection) throws SQLException;
406
407 /**
408 * Gets the user connection.
409 *
410 * @return the user connection
411 *
412 * @throws SQLException
413 * the SQL exception
414 */
415 Connection getUserConnection() throws SQLException;
416
417 /**
418 * Gets the current connection.
419 *
420 * @return the current connection
421 *
422 * @throws SQLException
423 * the SQL exception
424 */
425 Connection getCurrentConnection() throws SQLException;
426
427 /**
428 * Gets the data source.
429 *
430 * @return the data source
431 */
432 DataSource getDataSource();
433
434 /**
435 * Gets the mapped statement.
436 *
437 * @param id
438 * the id
439 *
440 * @return the mapped statement
441 */
442 MappedStatement getMappedStatement(String id);
443
444 /**
445 * Checks if is lazy loading enabled.
446 *
447 * @return true, if is lazy loading enabled
448 */
449 boolean isLazyLoadingEnabled();
450
451 /**
452 * Checks if is enhancement enabled.
453 *
454 * @return true, if is enhancement enabled
455 */
456 boolean isEnhancementEnabled();
457
458 /**
459 * Gets the sql executor.
460 *
461 * @return the sql executor
462 */
463 SqlExecutor getSqlExecutor();
464
465 /**
466 * Gets the delegate.
467 *
468 * @return the delegate
469 */
470 SqlMapExecutorDelegate getDelegate();
471
472 /**
473 * Open session.
474 *
475 * @return the sql map session
476 */
477 SqlMapSession openSession();
478
479 /**
480 * Open session.
481 *
482 * @param conn
483 * the conn
484 *
485 * @return the sql map session
486 */
487 SqlMapSession openSession(Connection conn);
488
489 /**
490 * Gets the session.
491 *
492 * @return the session
493 */
494 SqlMapSession getSession();
495
496 /**
497 * Flush data cache.
498 */
499 void flushDataCache();
500
501 /**
502 * Flush data cache.
503 *
504 * @param cacheId
505 * the cache id
506 */
507 void flushDataCache(String cacheId);
508
509 /**
510 * Gets the result object factory.
511 *
512 * @return the result object factory
513 */
514 ResultObjectFactory getResultObjectFactory();
515
516 }