001: /**
002: * Library name : Primrose - A Java Database Connection Pool.
003: * Published by Ben Keeping, http://primrose.org.uk .
004: * Copyright (C) 2004 Ben Keeping, primrose.org.uk
005: * Email: Use "Contact Us Form" on website
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: */package uk.org.primrose.pool.core;
021:
022: import java.math.BigDecimal;
023: import java.util.Calendar;
024: import java.sql.*;
025:
026: /**
027: * A wrapper for a vendor specific implementation of CallableStatement.
028: * Allows for complete logging of SQL transactions, aswell as identifying
029: * unclosed statements before Connection close() calls.
030: */
031: public class PoolCallableStatement extends PoolPreparedStatement
032: implements CallableStatement {
033: CallableStatement cs = null;
034:
035: public PoolCallableStatement(CallableStatement cs,
036: ConnectionHolder connHolder) {
037: super (cs, connHolder);
038: this .cs = cs;
039: }
040:
041: public PoolCallableStatement() {
042: super ();
043: }
044:
045: public void registerOutParameter(int parameterIndex, int sqlType)
046: throws SQLException {
047: cs.registerOutParameter(parameterIndex, sqlType);
048: }
049:
050: public void registerOutParameter(int parameterIndex, int sqlType,
051: int scale) throws SQLException {
052: cs.registerOutParameter(parameterIndex, sqlType, scale);
053: }
054:
055: public boolean wasNull() throws SQLException {
056: return cs.wasNull();
057: }
058:
059: public String getString(int parameterIndex) throws SQLException {
060: return cs.getString(parameterIndex);
061: }
062:
063: public boolean getBoolean(int parameterIndex) throws SQLException {
064: return cs.getBoolean(parameterIndex);
065: }
066:
067: public byte getByte(int parameterIndex) throws SQLException {
068: return cs.getByte(parameterIndex);
069: }
070:
071: public short getShort(int parameterIndex) throws SQLException {
072: return cs.getShort(parameterIndex);
073: }
074:
075: public int getInt(int parameterIndex) throws SQLException {
076: return cs.getInt(parameterIndex);
077: }
078:
079: public long getLong(int parameterIndex) throws SQLException {
080: return cs.getLong(parameterIndex);
081: }
082:
083: public float getFloat(int parameterIndex) throws SQLException {
084: return cs.getFloat(parameterIndex);
085: }
086:
087: public double getDouble(int parameterIndex) throws SQLException {
088: return cs.getDouble(parameterIndex);
089: }
090:
091: @SuppressWarnings("deprecation")
092: public BigDecimal getBigDecimal(int parameterIndex, int scale)
093: throws SQLException {
094: return cs.getBigDecimal(parameterIndex, scale);
095: }
096:
097: public byte[] getBytes(int parameterIndex) throws SQLException {
098: return cs.getBytes(parameterIndex);
099: }
100:
101: public java.sql.Date getDate(int parameterIndex)
102: throws SQLException {
103: return cs.getDate(parameterIndex);
104: }
105:
106: public java.sql.Time getTime(int parameterIndex)
107: throws SQLException {
108: return cs.getTime(parameterIndex);
109: }
110:
111: public java.sql.Timestamp getTimestamp(int parameterIndex)
112: throws SQLException {
113: return cs.getTimestamp(parameterIndex);
114: }
115:
116: public Object getObject(int parameterIndex) throws SQLException {
117: return cs.getObject(parameterIndex);
118: }
119:
120: public BigDecimal getBigDecimal(int parameterIndex)
121: throws SQLException {
122: return cs.getBigDecimal(parameterIndex);
123: }
124:
125: public Object getObject(int i,
126: java.util.Map<java.lang.String, java.lang.Class<?>> map)
127: throws SQLException {
128: return cs.getObject(i, map);
129: }
130:
131: public Ref getRef(int i) throws SQLException {
132: return cs.getRef(i);
133: }
134:
135: public Blob getBlob(int i) throws SQLException {
136: return cs.getBlob(i);
137: }
138:
139: public Clob getClob(int i) throws SQLException {
140: return cs.getClob(i);
141: }
142:
143: public Array getArray(int i) throws SQLException {
144: return cs.getArray(i);
145: }
146:
147: public java.sql.Date getDate(int parameterIndex, Calendar cal)
148: throws SQLException {
149: return cs.getDate(parameterIndex, cal);
150: }
151:
152: public java.sql.Time getTime(int parameterIndex, Calendar cal)
153: throws SQLException {
154: return cs.getTime(parameterIndex, cal);
155: }
156:
157: public java.sql.Timestamp getTimestamp(int parameterIndex,
158: Calendar cal) throws SQLException {
159: return cs.getTimestamp(parameterIndex, cal);
160: }
161:
162: public void registerOutParameter(int paramIndex, int sqlType,
163: String typeName) throws SQLException {
164: cs.registerOutParameter(paramIndex, sqlType, typeName);
165: }
166:
167: public void registerOutParameter(String parameterName, int sqlType)
168: throws SQLException {
169: cs.registerOutParameter(parameterName, sqlType);
170: }
171:
172: public void registerOutParameter(String parameterName, int sqlType,
173: int scale) throws SQLException {
174: cs.registerOutParameter(parameterName, sqlType, scale);
175: }
176:
177: public void registerOutParameter(String parameterName, int sqlType,
178: String typeName) throws SQLException {
179: cs.registerOutParameter(parameterName, sqlType, typeName);
180: }
181:
182: public java.net.URL getURL(int parameterIndex) throws SQLException {
183: return cs.getURL(parameterIndex);
184: }
185:
186: public void setURL(String parameterName, java.net.URL val)
187: throws SQLException {
188: connHolder.sql = (connHolder.sql + " " + parameterName + "("
189: + val + ")");
190: cs.setURL(parameterName, val);
191: }
192:
193: public void setNull(String parameterName, int sqlType)
194: throws SQLException {
195: connHolder.sql = (connHolder.sql + " " + parameterName + "("
196: + sqlType + ")");
197: cs.setNull(parameterName, sqlType);
198: }
199:
200: public void setBoolean(String parameterName, boolean x)
201: throws SQLException {
202: connHolder.sql = (connHolder.sql + " " + parameterName + "("
203: + x + ")");
204: cs.setBoolean(parameterName, x);
205: }
206:
207: public void setByte(String parameterName, byte x)
208: throws SQLException {
209: connHolder.sql = (connHolder.sql + " " + parameterName + "("
210: + x + ")");
211: cs.setByte(parameterName, x);
212: }
213:
214: public void setShort(String parameterName, short x)
215: throws SQLException {
216: connHolder.sql = (connHolder.sql + " " + parameterName + "("
217: + x + ")");
218: cs.setShort(parameterName, x);
219: }
220:
221: public void setInt(String parameterName, int x) throws SQLException {
222: connHolder.sql = (connHolder.sql + " " + parameterName + "("
223: + x + ")");
224: cs.setInt(parameterName, x);
225: }
226:
227: public void setLong(String parameterName, long x)
228: throws SQLException {
229: connHolder.sql = (connHolder.sql + " " + parameterName + "("
230: + x + ")");
231: cs.setLong(parameterName, x);
232: }
233:
234: public void setFloat(String parameterName, float x)
235: throws SQLException {
236: connHolder.sql = (connHolder.sql + " " + parameterName + "("
237: + x + ")");
238: cs.setFloat(parameterName, x);
239: }
240:
241: public void setDouble(String parameterName, double x)
242: throws SQLException {
243: connHolder.sql = (connHolder.sql + " " + parameterName + "("
244: + x + ")");
245: cs.setDouble(parameterName, x);
246: }
247:
248: public void setBigDecimal(String parameterName, BigDecimal x)
249: throws SQLException {
250: connHolder.sql = (connHolder.sql + " " + parameterName + "("
251: + x + ")");
252: cs.setBigDecimal(parameterName, x);
253: }
254:
255: public void setString(String parameterName, String x)
256: throws SQLException {
257: connHolder.sql = (connHolder.sql + " " + parameterName + "("
258: + x + ")");
259: cs.setString(parameterName, x);
260: }
261:
262: public void setBytes(String parameterName, byte x[])
263: throws SQLException {
264: connHolder.sql = (connHolder.sql + " " + parameterName + "("
265: + x + ")");
266: cs.setBytes(parameterName, x);
267: }
268:
269: public void setDate(String parameterName, java.sql.Date x)
270: throws SQLException {
271: connHolder.sql = (connHolder.sql + " " + parameterName + "("
272: + x + ")");
273: cs.setDate(parameterName, x);
274: }
275:
276: public void setTime(String parameterName, java.sql.Time x)
277: throws SQLException {
278: connHolder.sql = (connHolder.sql + " " + parameterName + "("
279: + x + ")");
280: cs.setTime(parameterName, x);
281: }
282:
283: public void setTimestamp(String parameterName, java.sql.Timestamp x)
284: throws SQLException {
285: connHolder.sql = (connHolder.sql + " " + parameterName + "("
286: + x + ")");
287: cs.setTimestamp(parameterName, x);
288: }
289:
290: public void setAsciiStream(String parameterName,
291: java.io.InputStream x, int length) throws SQLException {
292: connHolder.sql = (connHolder.sql + " " + parameterName + "("
293: + x + ")");
294: cs.setAsciiStream(parameterName, x, length);
295: }
296:
297: public void setBinaryStream(String parameterName,
298: java.io.InputStream x, int length) throws SQLException {
299: connHolder.sql = (connHolder.sql + " " + parameterName + "("
300: + x + ")");
301: cs.setBinaryStream(parameterName, x, length);
302: }
303:
304: public void setObject(String parameterName, Object x,
305: int targetSqlType, int scale) throws SQLException {
306: connHolder.sql = (connHolder.sql + " " + parameterName + "("
307: + x + ")");
308: cs.setObject(parameterName, x, targetSqlType, scale);
309: }
310:
311: public void setObject(String parameterName, Object x,
312: int targetSqlType) throws SQLException {
313: connHolder.sql = (connHolder.sql + " " + parameterName + "("
314: + x + ")");
315: cs.setObject(parameterName, x, targetSqlType);
316: }
317:
318: public void setObject(String parameterName, Object x)
319: throws SQLException {
320: connHolder.sql = (connHolder.sql + " " + parameterName + "("
321: + x + ")");
322: cs.setObject(parameterName, x);
323: }
324:
325: public void setCharacterStream(String parameterName,
326: java.io.Reader reader, int length) throws SQLException {
327: connHolder.sql = (connHolder.sql + " " + parameterName + "("
328: + reader + ")");
329: cs.setCharacterStream(parameterName, reader, length);
330: }
331:
332: public void setDate(String parameterName, java.sql.Date x,
333: Calendar cal) throws SQLException {
334: connHolder.sql = (connHolder.sql + " " + parameterName + "("
335: + x + ")");
336: cs.setDate(parameterName, x, cal);
337: }
338:
339: public void setTime(String parameterName, java.sql.Time x,
340: Calendar cal) throws SQLException {
341: connHolder.sql = (connHolder.sql + " " + parameterName + "("
342: + x + ")");
343: cs.setTime(parameterName, x, cal);
344: }
345:
346: public void setTimestamp(String parameterName,
347: java.sql.Timestamp x, Calendar cal) throws SQLException {
348: connHolder.sql = (connHolder.sql + " " + parameterName + "("
349: + x + ")");
350: cs.setTimestamp(parameterName, x, cal);
351: }
352:
353: public void setNull(String parameterName, int sqlType,
354: String typeName) throws SQLException {
355: connHolder.sql = (connHolder.sql + " " + parameterName + "("
356: + typeName + ")");
357: cs.setNull(parameterName, sqlType, typeName);
358: }
359:
360: public String getString(String parameterName) throws SQLException {
361: return cs.getString(parameterName);
362: }
363:
364: public boolean getBoolean(String parameterName) throws SQLException {
365: return cs.getBoolean(parameterName);
366: }
367:
368: public byte getByte(String parameterName) throws SQLException {
369: return cs.getByte(parameterName);
370: }
371:
372: public short getShort(String parameterName) throws SQLException {
373: return cs.getShort(parameterName);
374: }
375:
376: public int getInt(String parameterName) throws SQLException {
377: return cs.getInt(parameterName);
378: }
379:
380: public long getLong(String parameterName) throws SQLException {
381: return cs.getLong(parameterName);
382: }
383:
384: public float getFloat(String parameterName) throws SQLException {
385: return cs.getFloat(parameterName);
386: }
387:
388: public double getDouble(String parameterName) throws SQLException {
389: return cs.getDouble(parameterName);
390: }
391:
392: public byte[] getBytes(String parameterName) throws SQLException {
393: return cs.getBytes(parameterName);
394: }
395:
396: public java.sql.Date getDate(String parameterName)
397: throws SQLException {
398: return cs.getDate(parameterName);
399: }
400:
401: public java.sql.Time getTime(String parameterName)
402: throws SQLException {
403: return cs.getTime(parameterName);
404: }
405:
406: public java.sql.Timestamp getTimestamp(String parameterName)
407: throws SQLException {
408: return cs.getTimestamp(parameterName);
409: }
410:
411: public Object getObject(String parameterName) throws SQLException {
412: return cs.getObject(parameterName);
413: }
414:
415: public BigDecimal getBigDecimal(String parameterName)
416: throws SQLException {
417: return cs.getBigDecimal(parameterName);
418: }
419:
420: public Object getObject(String parameterName,
421: java.util.Map<java.lang.String, java.lang.Class<?>> map)
422: throws SQLException {
423: return cs.getObject(parameterName, map);
424: }
425:
426: public Ref getRef(String parameterName) throws SQLException {
427: return cs.getRef(parameterName);
428: }
429:
430: public Blob getBlob(String parameterName) throws SQLException {
431: return cs.getBlob(parameterName);
432: }
433:
434: public Clob getClob(String parameterName) throws SQLException {
435: return cs.getClob(parameterName);
436: }
437:
438: public Array getArray(String parameterName) throws SQLException {
439: return cs.getArray(parameterName);
440: }
441:
442: public java.sql.Date getDate(String parameterName, Calendar cal)
443: throws SQLException {
444: return cs.getDate(parameterName, cal);
445: }
446:
447: public java.sql.Time getTime(String parameterName, Calendar cal)
448: throws SQLException {
449: return cs.getTime(parameterName, cal);
450: }
451:
452: public java.sql.Timestamp getTimestamp(String parameterName,
453: Calendar cal) throws SQLException {
454: return cs.getTimestamp(parameterName, cal);
455: }
456:
457: public java.net.URL getURL(String parameterName)
458: throws SQLException {
459: return cs.getURL(parameterName);
460: }
461:
462: }
|