source: Ballon/out/artifacts/geisa_artifact/WEB-INF/lib/mysql-connector-java-5.1.21/src/com/mysql/jdbc/StatementInterceptorV2.java @ 848

Last change on this file since 848 was 766, checked in by npipsl, 11 years ago
File size: 5.3 KB
Line 
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
20package com.mysql.jdbc;
21
22import java.sql.SQLException;
23import java.util.Properties;
24
25public interface StatementInterceptorV2 extends Extension {
26
27        /**
28         * Called once per connection that wants to use the interceptor
29         *
30         * The properties are the same ones passed in in the URL or arguments to
31         * Driver.connect() or DriverManager.getConnection().
32         *
33         * @param conn the connection for which this interceptor is being created
34         * @param props configuration values as passed to the connection. Note that
35         * in order to support javax.sql.DataSources, configuration properties specific
36         * to an interceptor <strong>must</strong> be passed via setURL() on the
37         * DataSource. StatementInterceptor properties are not exposed via
38         * accessor/mutator methods on DataSources.
39         *
40         * @throws SQLException should be thrown if the the StatementInterceptor
41         * can not initialize itself.
42         */
43       
44        public abstract void init(Connection conn, Properties props) throws SQLException;
45
46        /**
47         * Called before the given statement is going to be sent to the
48         * server for processing.
49         *
50         * Interceptors are free to return a result set (which must implement the
51         * interface com.mysql.jdbc.ResultSetInternalMethods), and if so,
52         * the server will not execute the query, and the given result set will be
53         * returned to the application instead.
54         *
55         * This method will be called while the connection-level mutex is held, so
56         * it will only be called from one thread at a time.
57         *
58         * @param sql the SQL representation of the statement
59         * @param interceptedStatement the actual statement instance being intercepted
60         * @param connection the connection the statement is using (passed in to make
61         * thread-safe implementations straightforward)
62         *
63         * @return a result set that should be returned to the application instead
64         * of results that are created from actual execution of the intercepted
65         * statement.
66         *
67         * @throws SQLException if an error occurs during execution
68         *
69         * @see com.mysql.jdbc.ResultSetInternalMethods
70         */
71
72        public abstract ResultSetInternalMethods preProcess(String sql,
73                        Statement interceptedStatement, Connection connection)
74                        throws SQLException;
75
76        /**
77         * Should the driver execute this interceptor only for the
78         * "original" top-level query, and not put it in the execution
79         * path for queries that may be executed from other interceptors?
80         *
81         * If an interceptor issues queries using the connection it was created for,
82         * and does not return <code>true</code> for this method, it must ensure
83         * that it does not cause infinite recursion.
84         *
85         * @return true if the driver should ensure that this interceptor is only
86         * executed for the top-level "original" query.
87         */
88        public abstract boolean executeTopLevelOnly();
89
90        /**
91         * Called by the driver when this extension should release any resources
92         * it is holding and cleanup internally before the connection is
93         * closed.
94         */
95        public abstract void destroy();
96       
97        /**
98         * Called after the given statement has been sent to the server
99         * for processing, instead of the StatementAware postProcess() of the earlier
100         * api.
101         *
102         * Interceptors are free to inspect the "original" result set, and if a
103         * different result set is returned by the interceptor, it is used in place
104         * of the "original" result set. (the result set returned by the interceptor
105         * must implement the interface
106         * com.mysql.jdbc.ResultSetInternalMethods).
107         *
108         * This method will be called while the connection-level mutex is held, so
109         * it will only be called from one thread at a time.
110         *
111         * @param sql the SQL representation of the statement
112         * @param interceptedStatement the actual statement instance being intercepted
113         * @param connection the connection the statement is using (passed in to make
114         * thread-safe implementations straightforward)
115         *
116         * @return a result set that should be returned to the application instead
117         * of results that are created from actual execution of the intercepted
118         * statement.
119         *
120         * @throws SQLException if an error occurs during execution
121         *
122         * @see com.mysql.jdbc.ResultSetInternalMethods
123         */
124        public abstract ResultSetInternalMethods postProcess(String sql,
125                        Statement interceptedStatement,
126                        ResultSetInternalMethods originalResultSet,
127                        Connection connection, int warningCount, boolean noIndexUsed, boolean noGoodIndexUsed, 
128                        SQLException statementException) throws SQLException;
129}
Note: See TracBrowser for help on using the repository browser.