001: /*
002: DBPool - JDBC Connection Pool Manager
003: Copyright (c) Giles Winstanley
004: */
005: package snaq.db;
006:
007: import java.io.*;
008: import java.math.*;
009: import java.net.*;
010: import java.sql.*;
011: import java.util.Calendar;
012: import java.util.Map;
013:
014: /**
015: * CallableStatement wrapper that provides caching support.
016: * @author Giles Winstanley
017: */
018: public final class CachedCallableStatement extends
019: CachedPreparedStatement implements CallableStatement {
020: /**
021: * Creates a new CachedCallableStatement object, using the supplied CallableStatement.
022: */
023: public CachedCallableStatement(String query, CallableStatement st) {
024: super (query, st);
025: }
026:
027: /**
028: * Overridden to provide caching support.
029: */
030: public void release() throws SQLException {
031: st.close();
032: }
033:
034: //*************************************
035: // CallableStatement interface methods
036: //*************************************
037:
038: public String getString(int parameterIndex) throws SQLException {
039: return ((CallableStatement) st).getString(parameterIndex);
040: }
041:
042: public boolean getBoolean(int parameterIndex) throws SQLException {
043: return ((CallableStatement) st).getBoolean(parameterIndex);
044: }
045:
046: public byte getByte(int parameterIndex) throws SQLException {
047: return ((CallableStatement) st).getByte(parameterIndex);
048: }
049:
050: public short getShort(int parameterIndex) throws SQLException {
051: return ((CallableStatement) st).getShort(parameterIndex);
052: }
053:
054: public int getInt(int parameterIndex) throws SQLException {
055: return ((CallableStatement) st).getInt(parameterIndex);
056: }
057:
058: public long getLong(int parameterIndex) throws SQLException {
059: return ((CallableStatement) st).getLong(parameterIndex);
060: }
061:
062: public float getFloat(int parameterIndex) throws SQLException {
063: return ((CallableStatement) st).getFloat(parameterIndex);
064: }
065:
066: public double getDouble(int parameterIndex) throws SQLException {
067: return ((CallableStatement) st).getDouble(parameterIndex);
068: }
069:
070: public BigDecimal getBigDecimal(int parameterIndex, int scale)
071: throws SQLException {
072: return ((CallableStatement) st).getBigDecimal(parameterIndex,
073: scale);
074: }
075:
076: public byte[] getBytes(int parameterIndex) throws SQLException {
077: return ((CallableStatement) st).getBytes(parameterIndex);
078: }
079:
080: public Date getDate(int parameterIndex) throws SQLException {
081: return ((CallableStatement) st).getDate(parameterIndex);
082: }
083:
084: public Time getTime(int parameterIndex) throws SQLException {
085: return ((CallableStatement) st).getTime(parameterIndex);
086: }
087:
088: public Timestamp getTimestamp(int parameterIndex)
089: throws SQLException {
090: return ((CallableStatement) st).getTimestamp(parameterIndex);
091: }
092:
093: public Object getObject(int parameterIndex) throws SQLException {
094: return ((CallableStatement) st).getObject(parameterIndex);
095: }
096:
097: public BigDecimal getBigDecimal(int parameterIndex)
098: throws SQLException {
099: return ((CallableStatement) st).getBigDecimal(parameterIndex);
100: }
101:
102: public Object getObject(int i, Map map) throws SQLException {
103: return ((CallableStatement) st).getObject(i, map);
104: }
105:
106: public Ref getRef(int i) throws SQLException {
107: return ((CallableStatement) st).getRef(i);
108: }
109:
110: public Blob getBlob(int i) throws SQLException {
111: return ((CallableStatement) st).getBlob(i);
112: }
113:
114: public Clob getClob(int i) throws SQLException {
115: return ((CallableStatement) st).getClob(i);
116: }
117:
118: public Array getArray(int i) throws SQLException {
119: return ((CallableStatement) st).getArray(i);
120: }
121:
122: public Date getDate(int parameterIndex, Calendar cal)
123: throws SQLException {
124: return ((CallableStatement) st).getDate(parameterIndex, cal);
125: }
126:
127: public Time getTime(int parameterIndex, Calendar cal)
128: throws SQLException {
129: return ((CallableStatement) st).getTime(parameterIndex, cal);
130: }
131:
132: public Timestamp getTimestamp(int parameterIndex, Calendar cal)
133: throws SQLException {
134: return ((CallableStatement) st).getTimestamp(parameterIndex,
135: cal);
136: }
137:
138: public void registerOutParameter(int parameterIndex, int sqlType)
139: throws SQLException {
140: ((CallableStatement) st).registerOutParameter(parameterIndex,
141: sqlType);
142: }
143:
144: public void registerOutParameter(int parameterIndex, int sqlType,
145: int scale) throws SQLException {
146: ((CallableStatement) st).registerOutParameter(parameterIndex,
147: sqlType, scale);
148: }
149:
150: public void registerOutParameter(int paramIndex, int sqlType,
151: String typeName) throws SQLException {
152: ((CallableStatement) st).registerOutParameter(paramIndex,
153: sqlType, typeName);
154: }
155:
156: public boolean wasNull() throws SQLException {
157: return ((CallableStatement) st).wasNull();
158: }
159:
160: //**********************************
161: // Interface methods from JDBC 3.0
162: //**********************************
163:
164: public void registerOutParameter(String parameterName, int sqlType)
165: throws SQLException {
166: ((CallableStatement) st).registerOutParameter(parameterName,
167: sqlType);
168: }
169:
170: public void registerOutParameter(String parameterName, int sqlType,
171: int scale) throws SQLException {
172: ((CallableStatement) st).registerOutParameter(parameterName,
173: sqlType, scale);
174: }
175:
176: public void registerOutParameter(String parameterName, int sqlType,
177: String typeName) throws SQLException {
178: ((CallableStatement) st).registerOutParameter(parameterName,
179: sqlType, typeName);
180: }
181:
182: public URL getURL(int parameterIndex) throws SQLException {
183: return ((CallableStatement) st).getURL(parameterIndex);
184: }
185:
186: public void setURL(String parameterName, URL val)
187: throws SQLException {
188: ((CallableStatement) st).setURL(parameterName, val);
189: }
190:
191: public void setNull(String parameterName, int sqlType)
192: throws SQLException {
193: ((CallableStatement) st).setNull(parameterName, sqlType);
194: }
195:
196: public void setBoolean(String parameterName, boolean x)
197: throws SQLException {
198: ((CallableStatement) st).setBoolean(parameterName, x);
199: }
200:
201: public void setByte(String parameterName, byte x)
202: throws SQLException {
203: ((CallableStatement) st).setByte(parameterName, x);
204: }
205:
206: public void setShort(String parameterName, short x)
207: throws SQLException {
208: ((CallableStatement) st).setShort(parameterName, x);
209: }
210:
211: public void setDouble(String parameterName, double x)
212: throws SQLException {
213: ((CallableStatement) st).setDouble(parameterName, x);
214: }
215:
216: public void setFloat(String parameterName, float x)
217: throws SQLException {
218: ((CallableStatement) st).setFloat(parameterName, x);
219: }
220:
221: public void setInt(String parameterName, int x) throws SQLException {
222: ((CallableStatement) st).setInt(parameterName, x);
223: }
224:
225: public void setLong(String parameterName, long x)
226: throws SQLException {
227: ((CallableStatement) st).setLong(parameterName, x);
228: }
229:
230: public void setBigDecimal(String parameterName, BigDecimal x)
231: throws SQLException {
232: ((CallableStatement) st).setBigDecimal(parameterName, x);
233: }
234:
235: public void setString(String parameterName, String x)
236: throws SQLException {
237: ((CallableStatement) st).setString(parameterName, x);
238: }
239:
240: public void setBytes(String parameterName, byte[] x)
241: throws SQLException {
242: ((CallableStatement) st).setBytes(parameterName, x);
243: }
244:
245: public void setDate(String parameterName, Date x)
246: throws SQLException {
247: ((CallableStatement) st).setDate(parameterName, x);
248: }
249:
250: public void setTime(String parameterName, Time x)
251: throws SQLException {
252: ((CallableStatement) st).setTime(parameterName, x);
253: }
254:
255: public void setTimestamp(String parameterName, Timestamp x)
256: throws SQLException {
257: ((CallableStatement) st).setTimestamp(parameterName, x);
258: }
259:
260: public void setAsciiStream(String parameterName, InputStream x,
261: int length) throws SQLException {
262: ((CallableStatement) st).setAsciiStream(parameterName, x,
263: length);
264: }
265:
266: public void setBinaryStream(String parameterName, InputStream x,
267: int length) throws SQLException {
268: ((CallableStatement) st).setBinaryStream(parameterName, x,
269: length);
270: }
271:
272: public void setObject(String parameterName, Object x)
273: throws SQLException {
274: ((CallableStatement) st).setObject(parameterName, x);
275: }
276:
277: public void setObject(String parameterName, Object x,
278: int targetSqlType) throws SQLException {
279: ((CallableStatement) st).setObject(parameterName, x,
280: targetSqlType);
281: }
282:
283: public void setObject(String parameterName, Object x,
284: int targetSqlType, int scale) throws SQLException {
285: ((CallableStatement) st).setObject(parameterName, x,
286: targetSqlType, scale);
287: }
288:
289: public void setCharacterStream(String parameterName, Reader reader,
290: int length) throws SQLException {
291: ((CallableStatement) st).setCharacterStream(parameterName,
292: reader, length);
293: }
294:
295: public void setDate(String parameterName, Date x, Calendar cal)
296: throws SQLException {
297: ((CallableStatement) st).setDate(parameterName, x, cal);
298: }
299:
300: public void setTime(String parameterName, Time x, Calendar cal)
301: throws SQLException {
302: ((CallableStatement) st).setTime(parameterName, x, cal);
303: }
304:
305: public void setTimestamp(String parameterName, Timestamp x,
306: Calendar cal) throws SQLException {
307: ((CallableStatement) st).setTimestamp(parameterName, x, cal);
308: }
309:
310: public void setNull(String parameterName, int sqlType,
311: String typeName) throws SQLException {
312: ((CallableStatement) st).setNull(parameterName, sqlType,
313: typeName);
314: }
315:
316: public String getString(String parameterName) throws SQLException {
317: return ((CallableStatement) st).getString(parameterName);
318: }
319:
320: public boolean getBoolean(String parameterName) throws SQLException {
321: return ((CallableStatement) st).getBoolean(parameterName);
322: }
323:
324: public byte getByte(String parameterName) throws SQLException {
325: return ((CallableStatement) st).getByte(parameterName);
326: }
327:
328: public short getShort(String parameterName) throws SQLException {
329: return ((CallableStatement) st).getShort(parameterName);
330: }
331:
332: public int getInt(String parameterName) throws SQLException {
333: return ((CallableStatement) st).getInt(parameterName);
334: }
335:
336: public long getLong(String parameterName) throws SQLException {
337: return ((CallableStatement) st).getLong(parameterName);
338: }
339:
340: public float getFloat(String parameterName) throws SQLException {
341: return ((CallableStatement) st).getFloat(parameterName);
342: }
343:
344: public double getDouble(String parameterName) throws SQLException {
345: return ((CallableStatement) st).getDouble(parameterName);
346: }
347:
348: public byte[] getBytes(String parameterName) throws SQLException {
349: return ((CallableStatement) st).getBytes(parameterName);
350: }
351:
352: public Date getDate(String parameterName) throws SQLException {
353: return ((CallableStatement) st).getDate(parameterName);
354: }
355:
356: public Time getTime(String parameterName) throws SQLException {
357: return ((CallableStatement) st).getTime(parameterName);
358: }
359:
360: public Timestamp getTimestamp(String parameterName)
361: throws SQLException {
362: return ((CallableStatement) st).getTimestamp(parameterName);
363: }
364:
365: public Object getObject(String parameterName) throws SQLException {
366: return ((CallableStatement) st).getObject(parameterName);
367: }
368:
369: public BigDecimal getBigDecimal(String parameterName)
370: throws SQLException {
371: return ((CallableStatement) st).getBigDecimal(parameterName);
372: }
373:
374: public Object getObject(String parameterName, Map map)
375: throws SQLException {
376: return ((CallableStatement) st).getObject(parameterName, map);
377: }
378:
379: public Ref getRef(String parameterName) throws SQLException {
380: return ((CallableStatement) st).getRef(parameterName);
381: }
382:
383: public Blob getBlob(String parameterName) throws SQLException {
384: return ((CallableStatement) st).getBlob(parameterName);
385: }
386:
387: public Clob getClob(String parameterName) throws SQLException {
388: return ((CallableStatement) st).getClob(parameterName);
389: }
390:
391: public Array getArray(String parameterName) throws SQLException {
392: return ((CallableStatement) st).getArray(parameterName);
393: }
394:
395: public Date getDate(String parameterName, Calendar cal)
396: throws SQLException {
397: return ((CallableStatement) st).getDate(parameterName, cal);
398: }
399:
400: public Time getTime(String parameterName, Calendar cal)
401: throws SQLException {
402: return ((CallableStatement) st).getTime(parameterName, cal);
403: }
404:
405: public Timestamp getTimestamp(String parameterName, Calendar cal)
406: throws SQLException {
407: return ((CallableStatement) st)
408: .getTimestamp(parameterName, cal);
409: }
410:
411: public URL getURL(String parameterName) throws SQLException {
412: return ((CallableStatement) st).getURL(parameterName);
413: }
414: }
|