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.io.InputStream;
023: import java.io.Reader;
024: import java.math.BigDecimal;
025: import java.net.URL;
026: import java.sql.Array;
027: import java.sql.Blob;
028: import java.sql.Clob;
029: import java.sql.Date;
030: import java.sql.ParameterMetaData;
031: import java.sql.PreparedStatement;
032: import java.sql.Ref;
033: import java.sql.ResultSet;
034: import java.sql.ResultSetMetaData;
035: import java.sql.SQLException;
036: import java.sql.Time;
037: import java.sql.Timestamp;
038: import java.util.Calendar;
039:
040: public class ProxyPreparedStatement extends ProxyStatement implements
041: PreparedStatement {
042:
043: private PreparedStatement _pstmt = null;
044:
045: public ProxyPreparedStatement(ProxyConnection con,
046: PreparedStatement stmt) {
047: super (con, stmt);
048: _pstmt = stmt;
049: }
050:
051: public int executeUpdate() throws SQLException {
052: ProxyMethodManager.check("ProxyPreparedStatement",
053: "executeUpdate");
054: return _pstmt.executeUpdate();
055: }
056:
057: public void addBatch() throws SQLException {
058: ProxyMethodManager.check("ProxyPreparedStatement", "addBatch");
059: _pstmt.addBatch();
060: }
061:
062: public void clearParameters() throws SQLException {
063: ProxyMethodManager.check("ProxyPreparedStatement",
064: "clearParameters");
065: _pstmt.clearParameters();
066: }
067:
068: public boolean execute() throws SQLException {
069: ProxyMethodManager.check("ProxyPreparedStatement", "execute");
070: return _pstmt.execute();
071: }
072:
073: public void setByte(int parameterIndex, byte x) throws SQLException {
074: ProxyMethodManager.check("ProxyPreparedStatement", "setByte");
075: _pstmt.setByte(parameterIndex, x);
076: }
077:
078: public void setDouble(int parameterIndex, double x)
079: throws SQLException {
080: ProxyMethodManager.check("ProxyPreparedStatement", "setDouble");
081: _pstmt.setDouble(parameterIndex, x);
082: }
083:
084: public void setFloat(int parameterIndex, float x)
085: throws SQLException {
086: ProxyMethodManager.check("ProxyPreparedStatement", "setFloat");
087: _pstmt.setFloat(parameterIndex, x);
088: }
089:
090: public void setInt(int parameterIndex, int x) throws SQLException {
091: ProxyMethodManager.check("ProxyPreparedStatement", "setInt");
092: _pstmt.setInt(parameterIndex, x);
093: }
094:
095: public void setNull(int parameterIndex, int sqlType)
096: throws SQLException {
097: ProxyMethodManager.check("ProxyPreparedStatement", "setNull");
098: _pstmt.setNull(parameterIndex, sqlType);
099: }
100:
101: public void setLong(int parameterIndex, long x) throws SQLException {
102: ProxyMethodManager.check("ProxyPreparedStatement", "setLong");
103: _pstmt.setLong(parameterIndex, x);
104: }
105:
106: public void setShort(int parameterIndex, short x)
107: throws SQLException {
108: ProxyMethodManager.check("ProxyPreparedStatement", "setShort");
109: _pstmt.setShort(parameterIndex, x);
110: }
111:
112: public void setBoolean(int parameterIndex, boolean x)
113: throws SQLException {
114: ProxyMethodManager
115: .check("ProxyPreparedStatement", "setBoolean");
116: _pstmt.setBoolean(parameterIndex, x);
117: }
118:
119: public void setBytes(int parameterIndex, byte[] x)
120: throws SQLException {
121: ProxyMethodManager.check("ProxyPreparedStatement", "setBytes");
122: _pstmt.setBytes(parameterIndex, x);
123: }
124:
125: public void setAsciiStream(int parameterIndex, InputStream x,
126: int length) throws SQLException {
127: ProxyMethodManager.check("ProxyPreparedStatement",
128: "setAsciiStream");
129: _pstmt.setAsciiStream(parameterIndex, x, length);
130: }
131:
132: public void setBinaryStream(int parameterIndex, InputStream x,
133: int length) throws SQLException {
134: ProxyMethodManager.check("ProxyPreparedStatement",
135: "setBinaryStream");
136: _pstmt.setBinaryStream(parameterIndex, x, length);
137: }
138:
139: @SuppressWarnings("deprecation")
140: public void setUnicodeStream(int parameterIndex, InputStream x,
141: int length) throws SQLException {
142: ProxyMethodManager.check("ProxyPreparedStatement",
143: "setUnicodeStream");
144: _pstmt.setUnicodeStream(parameterIndex, x, length);
145: }
146:
147: public void setCharacterStream(int parameterIndex, Reader reader,
148: int length) throws SQLException {
149: ProxyMethodManager.check("ProxyPreparedStatement",
150: "setCharacterStream");
151: _pstmt.setCharacterStream(parameterIndex, reader, length);
152: }
153:
154: public void setObject(int parameterIndex, Object x)
155: throws SQLException {
156: ProxyMethodManager.check("ProxyPreparedStatement", "setObject");
157: _pstmt.setObject(parameterIndex, x);
158: }
159:
160: public void setObject(int parameterIndex, Object x,
161: int targetSqlType) throws SQLException {
162: ProxyMethodManager.check("ProxyPreparedStatement", "setObject");
163: _pstmt.setObject(parameterIndex, x, targetSqlType,
164: targetSqlType);
165: }
166:
167: public void setObject(int parameterIndex, Object x,
168: int targetSqlType, int scale) throws SQLException {
169: ProxyMethodManager.check("ProxyPreparedStatement", "setObject");
170: _pstmt.setObject(parameterIndex, x, targetSqlType, scale);
171: }
172:
173: public void setNull(int paramIndex, int sqlType, String typeName)
174: throws SQLException {
175: ProxyMethodManager.check("ProxyPreparedStatement", "setNull");
176: _pstmt.setNull(paramIndex, sqlType, typeName);
177: }
178:
179: public void setString(int parameterIndex, String x)
180: throws SQLException {
181: ProxyMethodManager.check("ProxyPreparedStatement", "setString");
182: _pstmt.setString(parameterIndex, x);
183: }
184:
185: public void setBigDecimal(int parameterIndex, BigDecimal x)
186: throws SQLException {
187: ProxyMethodManager.check("ProxyPreparedStatement",
188: "setBigDecimal");
189: _pstmt.setBigDecimal(parameterIndex, x);
190: }
191:
192: public void setURL(int parameterIndex, URL x) throws SQLException {
193: ProxyMethodManager.check("ProxyPreparedStatement", "setURL");
194: _pstmt.setURL(parameterIndex, x);
195: }
196:
197: public void setArray(int i, Array x) throws SQLException {
198: ProxyMethodManager.check("ProxyPreparedStatement", "setArray");
199: _pstmt.setArray(i, x);
200: }
201:
202: public void setBlob(int i, Blob x) throws SQLException {
203: ProxyMethodManager.check("ProxyPreparedStatement", "setBlob");
204: _pstmt.setBlob(i, x);
205: }
206:
207: public void setClob(int i, Clob x) throws SQLException {
208: ProxyMethodManager.check("ProxyPreparedStatement", "setClob");
209: _pstmt.setClob(i, x);
210: }
211:
212: public void setDate(int parameterIndex, Date x) throws SQLException {
213: ProxyMethodManager.check("ProxyPreparedStatement", "setDate");
214: _pstmt.setDate(parameterIndex, x);
215: }
216:
217: public ParameterMetaData getParameterMetaData() throws SQLException {
218: ProxyMethodManager.check("ProxyPreparedStatement",
219: "getParameterMetaData");
220: return _pstmt.getParameterMetaData();
221: }
222:
223: public void setRef(int i, Ref x) throws SQLException {
224: ProxyMethodManager.check("ProxyPreparedStatement", "setRef");
225: _pstmt.setRef(i, x);
226: }
227:
228: public ResultSet executeQuery() throws SQLException {
229: ProxyMethodManager.check("ProxyPreparedStatement",
230: "executeQuery");
231: return new ProxyResultSet(this , _pstmt.executeQuery());
232: }
233:
234: public ResultSetMetaData getMetaData() throws SQLException {
235: ProxyMethodManager.check("ProxyPreparedStatement",
236: "getMetaData");
237: return new ProxyResultSetMetaData(_pstmt.getMetaData());
238: }
239:
240: public void setTime(int parameterIndex, Time x) throws SQLException {
241: ProxyMethodManager.check("ProxyPreparedStatement", "setTime");
242: _pstmt.setTime(parameterIndex, x);
243: }
244:
245: public void setTimestamp(int parameterIndex, Timestamp x)
246: throws SQLException {
247: ProxyMethodManager.check("ProxyPreparedStatement",
248: "setTimestamp");
249: _pstmt.setTimestamp(parameterIndex, x);
250: }
251:
252: public void setDate(int parameterIndex, Date x, Calendar cal)
253: throws SQLException {
254: ProxyMethodManager.check("ProxyPreparedStatement", "setDate");
255: _pstmt.setDate(parameterIndex, x);
256: }
257:
258: public void setTime(int parameterIndex, Time x, Calendar cal)
259: throws SQLException {
260: ProxyMethodManager.check("ProxyPreparedStatement", "setTime");
261: _pstmt.setTime(parameterIndex, x);
262: }
263:
264: public void setTimestamp(int parameterIndex, Timestamp x,
265: Calendar cal) throws SQLException {
266: ProxyMethodManager.check("ProxyPreparedStatement",
267: "setTimestamp");
268: _pstmt.setTimestamp(parameterIndex, x);
269: }
270:
271: }
|