001: package net.sourceforge.squirrel_sql.jdbcproxy;
002:
003: /*
004: * Copyright (C) 2006 Rob Manning
005: * manningr@users.sourceforge.net
006: *
007: * This library is free software; you can redistribute it and/or
008: * modify it under the terms of the GNU Lesser General Public
009: * License as published by the Free Software Foundation; either
010: * version 2.1 of the License, or (at your option) any later version.
011: *
012: * This library is distributed in the hope that it will be useful,
013: * but WITHOUT ANY WARRANTY; without even the implied warranty of
014: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
015: * Lesser General Public License for more details.
016: *
017: * You should have received a copy of the GNU Lesser General Public
018: * License along with this library; if not, write to the Free Software
019: * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
020: */
021:
022: import java.sql.Connection;
023: import java.sql.ResultSet;
024: import java.sql.SQLException;
025: import java.sql.SQLWarning;
026: import java.sql.Statement;
027:
028: public class ProxyStatement implements Statement {
029:
030: Statement _stmt = null;
031: ProxyConnection _con = null;
032:
033: protected ProxyStatement() {
034: }
035:
036: public ProxyStatement(ProxyConnection con, Statement stmt) {
037: _stmt = stmt;
038: _con = con;
039: }
040:
041: public int getFetchDirection() throws SQLException {
042: ProxyMethodManager.check("ProxyStatement", "getFetchDirection");
043: return _stmt.getFetchDirection();
044: }
045:
046: public int getFetchSize() throws SQLException {
047: ProxyMethodManager.check("ProxyStatement", "getFetchSize");
048: return _stmt.getFetchSize();
049: }
050:
051: public int getMaxFieldSize() throws SQLException {
052: ProxyMethodManager.check("ProxyStatement", "getMaxFieldSize");
053: return _stmt.getMaxFieldSize();
054: }
055:
056: public int getMaxRows() throws SQLException {
057: ProxyMethodManager.check("ProxyStatement", "getMaxRows");
058: return _stmt.getMaxRows();
059: }
060:
061: public int getQueryTimeout() throws SQLException {
062: ProxyMethodManager.check("ProxyStatement", "getQueryTimeout");
063: return _stmt.getQueryTimeout();
064: }
065:
066: public int getResultSetConcurrency() throws SQLException {
067: ProxyMethodManager.check("ProxyStatement",
068: "getResultSetConcurrency");
069: return _stmt.getResultSetConcurrency();
070: }
071:
072: public int getResultSetHoldability() throws SQLException {
073: ProxyMethodManager.check("ProxyStatement",
074: "getResultSetHoldability");
075: return _stmt.getResultSetHoldability();
076: }
077:
078: public int getResultSetType() throws SQLException {
079: ProxyMethodManager.check("ProxyStatement", "getResultSetType");
080: return _stmt.getResultSetType();
081: }
082:
083: public int getUpdateCount() throws SQLException {
084: ProxyMethodManager.check("ProxyStatement", "getUpdateCount");
085: return _stmt.getUpdateCount();
086: }
087:
088: public void cancel() throws SQLException {
089: ProxyMethodManager.check("ProxyStatement", "cancel");
090: _stmt.cancel();
091: }
092:
093: public void clearBatch() throws SQLException {
094: ProxyMethodManager.check("ProxyStatement", "clearBatch");
095: _stmt.clearBatch();
096: }
097:
098: public void clearWarnings() throws SQLException {
099: ProxyMethodManager.check("ProxyStatement", "clearWarnings");
100: _stmt.clearWarnings();
101: }
102:
103: public void close() throws SQLException {
104: ProxyMethodManager.check("ProxyStatement", "close");
105: _stmt.close();
106: }
107:
108: public boolean getMoreResults() throws SQLException {
109: ProxyMethodManager.check("ProxyStatement", "getMoreResults");
110: return _stmt.getMoreResults();
111: }
112:
113: public int[] executeBatch() throws SQLException {
114: ProxyMethodManager.check("ProxyStatement", "executeBatch");
115: return _stmt.executeBatch();
116: }
117:
118: public void setFetchDirection(int direction) throws SQLException {
119: ProxyMethodManager.check("ProxyStatement", "setFetchDirection");
120: _stmt.setFetchDirection(direction);
121: }
122:
123: public void setFetchSize(int rows) throws SQLException {
124: ProxyMethodManager.check("ProxyStatement", "setFetchSize");
125: _stmt.setFetchSize(rows);
126: }
127:
128: public void setMaxFieldSize(int max) throws SQLException {
129: ProxyMethodManager.check("ProxyStatement", "setMaxFieldSize");
130: _stmt.setMaxFieldSize(max);
131: }
132:
133: public void setMaxRows(int max) throws SQLException {
134: ProxyMethodManager.check("ProxyStatement", "setMaxRows");
135: _stmt.setMaxRows(max);
136: }
137:
138: public void setQueryTimeout(int seconds) throws SQLException {
139: ProxyMethodManager.check("ProxyStatement", "setQueryTimeout");
140: _stmt.setQueryTimeout(seconds);
141: }
142:
143: public boolean getMoreResults(int current) throws SQLException {
144: ProxyMethodManager.check("ProxyStatement", "getMoreResults");
145: return _stmt.getMoreResults(current);
146: }
147:
148: public void setEscapeProcessing(boolean enable) throws SQLException {
149: ProxyMethodManager.check("ProxyStatement",
150: "setEscapeProcessing");
151: _stmt.setEscapeProcessing(enable);
152: }
153:
154: public int executeUpdate(String sql) throws SQLException {
155: ProxyMethodManager.check("ProxyStatement", "executeUpdate");
156: return _stmt.executeUpdate(sql);
157: }
158:
159: public void addBatch(String sql) throws SQLException {
160: ProxyMethodManager.check("ProxyStatement", "addBatch");
161: _stmt.addBatch(sql);
162: }
163:
164: public void setCursorName(String name) throws SQLException {
165: ProxyMethodManager.check("ProxyStatement", "setCursorName");
166: _stmt.setCursorName(name);
167: }
168:
169: public boolean execute(String sql) throws SQLException {
170: ProxyMethodManager.check("ProxyStatement", "execute");
171: return _stmt.execute(sql);
172: }
173:
174: public int executeUpdate(String sql, int autoGeneratedKeys)
175: throws SQLException {
176: ProxyMethodManager.check("ProxyStatement", "executeUpdate");
177: return _stmt.executeUpdate(sql, autoGeneratedKeys);
178: }
179:
180: public boolean execute(String sql, int autoGeneratedKeys)
181: throws SQLException {
182: ProxyMethodManager.check("ProxyStatement", "execute");
183: return _stmt.execute(sql, autoGeneratedKeys);
184: }
185:
186: public int executeUpdate(String sql, int[] columnIndexes)
187: throws SQLException {
188: ProxyMethodManager.check("ProxyStatement", "executeUpdate");
189: return _stmt.executeUpdate(sql, columnIndexes);
190: }
191:
192: public boolean execute(String sql, int[] columnIndexes)
193: throws SQLException {
194: ProxyMethodManager.check("ProxyStatement", "execute");
195: return _stmt.execute(sql, columnIndexes);
196: }
197:
198: public Connection getConnection() throws SQLException {
199: ProxyMethodManager.check("ProxyStatement", "getConnection");
200: return _con;
201: }
202:
203: public ResultSet getGeneratedKeys() throws SQLException {
204: ProxyMethodManager.check("ProxyStatement", "getGeneratedKeys");
205: return new ProxyResultSet(this , _stmt.getGeneratedKeys());
206: }
207:
208: public ResultSet getResultSet() throws SQLException {
209: ProxyMethodManager.check("ProxyStatement", "getResultSet");
210: return new ProxyResultSet(this , _stmt.getResultSet());
211: }
212:
213: public SQLWarning getWarnings() throws SQLException {
214: ProxyMethodManager.check("ProxyStatement", "getWarnings");
215: return _stmt.getWarnings();
216: }
217:
218: public int executeUpdate(String sql, String[] columnNames)
219: throws SQLException {
220: ProxyMethodManager.check("ProxyStatement", "executeUpdate");
221: return _stmt.executeUpdate(sql, columnNames);
222: }
223:
224: public boolean execute(String sql, String[] columnNames)
225: throws SQLException {
226: ProxyMethodManager.check("ProxyStatement", "execute");
227: return _stmt.execute(sql, columnNames);
228: }
229:
230: public ResultSet executeQuery(String sql) throws SQLException {
231: ProxyMethodManager.check("ProxyStatement", "executeQuery");
232: return new ProxyResultSet(this, _stmt.executeQuery(sql));
233: }
234: }
|