1 | /* |
---|
2 | Copyright (c) 2009, 2010, Oracle and/or its affiliates. All rights reserved., Inc. All rights reserved. |
---|
3 | U.S. Government Rights - Commercial software. Government users are subject |
---|
4 | to the Sun Microsystems, Inc. standard license agreement and applicable |
---|
5 | provisions of the FAR and its supplements. Use is subject to license terms. |
---|
6 | This distribution may include materials developed by third parties.Sun, |
---|
7 | Sun Microsystems, the Sun logo and MySQL Enterprise Monitor are |
---|
8 | trademarks or registered trademarks of Sun Microsystems, Inc. in the U.S. |
---|
9 | and other countries. |
---|
10 | |
---|
11 | Copyright (c) 2009, 2010, Oracle and/or its affiliates. All rights reserved., Inc. Tous droits réservés. |
---|
12 | L'utilisation est soumise aux termes du contrat de licence.Cette |
---|
13 | distribution peut comprendre des composants développés par des tierces |
---|
14 | parties.Sun, Sun Microsystems,  le logo Sun et  MySQL Enterprise Monitor sont |
---|
15 | des marques de fabrique ou des marques déposées de Sun Microsystems, Inc. |
---|
16 | aux Etats-Unis et dans du'autres pays. |
---|
17 | |
---|
18 | */ |
---|
19 | |
---|
20 | package com.mysql.jdbc; |
---|
21 | |
---|
22 | import java.sql.SQLException; |
---|
23 | import java.util.Properties; |
---|
24 | |
---|
25 | /** |
---|
26 | * Wraps statement interceptors during driver startup so that they don't produce |
---|
27 | * different result sets than we expect. |
---|
28 | */ |
---|
29 | public class NoSubInterceptorWrapper implements StatementInterceptorV2 { |
---|
30 | |
---|
31 | private final StatementInterceptorV2 underlyingInterceptor; |
---|
32 | |
---|
33 | public NoSubInterceptorWrapper(StatementInterceptorV2 underlyingInterceptor) { |
---|
34 | if (underlyingInterceptor == null) { |
---|
35 | throw new RuntimeException("Interceptor to be wrapped can not be NULL"); |
---|
36 | } |
---|
37 | |
---|
38 | this.underlyingInterceptor = underlyingInterceptor; |
---|
39 | } |
---|
40 | |
---|
41 | public void destroy() { |
---|
42 | underlyingInterceptor.destroy(); |
---|
43 | } |
---|
44 | |
---|
45 | public boolean executeTopLevelOnly() { |
---|
46 | return underlyingInterceptor.executeTopLevelOnly(); |
---|
47 | } |
---|
48 | |
---|
49 | public void init(Connection conn, Properties props) throws SQLException { |
---|
50 | underlyingInterceptor.init(conn, props); |
---|
51 | } |
---|
52 | |
---|
53 | public ResultSetInternalMethods postProcess(String sql, |
---|
54 | Statement interceptedStatement, |
---|
55 | ResultSetInternalMethods originalResultSet, Connection connection, |
---|
56 | int warningCount, boolean noIndexUsed, boolean noGoodIndexUsed, |
---|
57 | SQLException statementException) throws SQLException { |
---|
58 | underlyingInterceptor.postProcess(sql, interceptedStatement, originalResultSet, |
---|
59 | connection, warningCount, noIndexUsed, noGoodIndexUsed, statementException); |
---|
60 | |
---|
61 | return null; // don't allow result set substitution |
---|
62 | } |
---|
63 | |
---|
64 | public ResultSetInternalMethods preProcess(String sql, |
---|
65 | Statement interceptedStatement, Connection connection) |
---|
66 | throws SQLException { |
---|
67 | underlyingInterceptor.preProcess(sql, interceptedStatement, connection); |
---|
68 | |
---|
69 | return null; // don't allow result set substitution |
---|
70 | } |
---|
71 | |
---|
72 | public StatementInterceptorV2 getUnderlyingInterceptor() { |
---|
73 | return underlyingInterceptor; |
---|
74 | } |
---|
75 | } |
---|