KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > snaq > db > CachedCallableStatement


1 /*
2     DBPool - JDBC Connection Pool Manager
3     Copyright (c) Giles Winstanley
4 */

5 package snaq.db;
6
7 import java.io.*;
8 import java.math.*;
9 import java.net.*;
10 import java.sql.*;
11 import java.util.Calendar JavaDoc;
12 import java.util.Map JavaDoc;
13
14 /**
15  * CallableStatement wrapper that provides caching support.
16  * @author Giles Winstanley
17  */

18 public final class CachedCallableStatement extends CachedPreparedStatement implements CallableStatement
19 {
20     /**
21      * Creates a new CachedCallableStatement object, using the supplied CallableStatement.
22      */

23     public CachedCallableStatement(String JavaDoc query, CallableStatement st)
24     {
25         super(query, st);
26     }
27
28     /**
29      * Overridden to provide caching support.
30      */

31     public void release() throws SQLException
32     {
33         st.close();
34     }
35
36     //*************************************
37
// CallableStatement interface methods
38
//*************************************
39

40     public String JavaDoc getString(int parameterIndex) throws SQLException
41     {
42         return ((CallableStatement)st).getString(parameterIndex);
43     }
44
45     public boolean getBoolean(int parameterIndex) throws SQLException
46     {
47         return ((CallableStatement)st).getBoolean(parameterIndex);
48     }
49
50     public byte getByte(int parameterIndex) throws SQLException
51     {
52         return ((CallableStatement)st).getByte(parameterIndex);
53     }
54
55     public short getShort(int parameterIndex) throws SQLException
56     {
57         return ((CallableStatement)st).getShort(parameterIndex);
58     }
59
60     public int getInt(int parameterIndex) throws SQLException
61     {
62         return ((CallableStatement)st).getInt(parameterIndex);
63     }
64
65     public long getLong(int parameterIndex) throws SQLException
66     {
67         return ((CallableStatement)st).getLong(parameterIndex);
68     }
69
70     public float getFloat(int parameterIndex) throws SQLException
71     {
72         return ((CallableStatement)st).getFloat(parameterIndex);
73     }
74
75     public double getDouble(int parameterIndex) throws SQLException
76     {
77         return ((CallableStatement)st).getDouble(parameterIndex);
78     }
79
80     public BigDecimal getBigDecimal(int parameterIndex, int scale) throws SQLException
81     {
82         return ((CallableStatement)st).getBigDecimal(parameterIndex, scale);
83     }
84
85     public byte[] getBytes(int parameterIndex) throws SQLException
86     {
87         return ((CallableStatement)st).getBytes(parameterIndex);
88     }
89
90     public Date getDate(int parameterIndex) throws SQLException
91     {
92         return ((CallableStatement)st).getDate(parameterIndex);
93     }
94
95     public Time getTime(int parameterIndex) throws SQLException
96     {
97         return ((CallableStatement)st).getTime(parameterIndex);
98     }
99
100     public Timestamp getTimestamp(int parameterIndex) throws SQLException
101     {
102         return ((CallableStatement)st).getTimestamp(parameterIndex);
103     }
104
105     public Object JavaDoc getObject(int parameterIndex) throws SQLException
106     {
107         return ((CallableStatement)st).getObject(parameterIndex);
108     }
109
110     public BigDecimal getBigDecimal(int parameterIndex) throws SQLException
111     {
112         return ((CallableStatement)st).getBigDecimal(parameterIndex);
113     }
114
115     public Object JavaDoc getObject(int i, Map JavaDoc map) throws SQLException
116     {
117         return ((CallableStatement)st).getObject(i, map);
118     }
119
120     public Ref getRef(int i) throws SQLException
121     {
122         return ((CallableStatement)st).getRef(i);
123     }
124
125     public Blob getBlob(int i) throws SQLException
126     {
127         return ((CallableStatement)st).getBlob(i);
128     }
129
130     public Clob getClob(int i) throws SQLException
131     {
132         return ((CallableStatement)st).getClob(i);
133     }
134
135     public Array getArray(int i) throws SQLException
136     {
137         return ((CallableStatement)st).getArray(i);
138     }
139
140     public Date getDate(int parameterIndex, Calendar JavaDoc cal) throws SQLException
141     {
142         return ((CallableStatement)st).getDate(parameterIndex, cal);
143     }
144
145     public Time getTime(int parameterIndex, Calendar JavaDoc cal) throws SQLException
146     {
147         return ((CallableStatement)st).getTime(parameterIndex, cal);
148     }
149
150     public Timestamp getTimestamp(int parameterIndex, Calendar JavaDoc cal) throws SQLException
151     {
152         return ((CallableStatement)st).getTimestamp(parameterIndex, cal);
153     }
154
155     public void registerOutParameter(int parameterIndex, int sqlType) throws SQLException
156     {
157         ((CallableStatement)st).registerOutParameter(parameterIndex, sqlType);
158     }
159
160     public void registerOutParameter(int parameterIndex, int sqlType, int scale) throws SQLException
161     {
162         ((CallableStatement)st).registerOutParameter(parameterIndex, sqlType, scale);
163     }
164
165     public void registerOutParameter(int paramIndex, int sqlType, String JavaDoc typeName) throws SQLException
166     {
167         ((CallableStatement)st).registerOutParameter(paramIndex, sqlType, typeName);
168     }
169
170     public boolean wasNull() throws SQLException
171     {
172         return ((CallableStatement)st).wasNull();
173     }
174
175     //**********************************
176
// Interface methods from JDBC 3.0
177
//**********************************
178

179     public void registerOutParameter(String JavaDoc parameterName, int sqlType) throws SQLException
180     {
181         ((CallableStatement)st).registerOutParameter(parameterName, sqlType);
182     }
183
184     public void registerOutParameter(String JavaDoc parameterName, int sqlType, int scale) throws SQLException
185     {
186         ((CallableStatement)st).registerOutParameter(parameterName, sqlType, scale);
187     }
188
189     public void registerOutParameter(String JavaDoc parameterName, int sqlType, String JavaDoc typeName) throws SQLException
190     {
191         ((CallableStatement)st).registerOutParameter(parameterName, sqlType, typeName);
192     }
193
194     public URL getURL(int parameterIndex) throws SQLException
195     {
196         return ((CallableStatement)st).getURL(parameterIndex);
197     }
198
199     public void setURL(String JavaDoc parameterName, URL val) throws SQLException
200     {
201         ((CallableStatement)st).setURL(parameterName, val);
202     }
203
204     public void setNull(String JavaDoc parameterName, int sqlType) throws SQLException
205     {
206         ((CallableStatement)st).setNull(parameterName, sqlType);
207     }
208
209     public void setBoolean(String JavaDoc parameterName, boolean x) throws SQLException
210     {
211         ((CallableStatement)st).setBoolean(parameterName, x);
212     }
213
214     public void setByte(String JavaDoc parameterName, byte x) throws SQLException
215     {
216         ((CallableStatement)st).setByte(parameterName, x);
217     }
218
219     public void setShort(String JavaDoc parameterName, short x) throws SQLException
220     {
221         ((CallableStatement)st).setShort(parameterName, x);
222     }
223
224     public void setDouble(String JavaDoc parameterName, double x) throws SQLException
225     {
226         ((CallableStatement)st).setDouble(parameterName, x);
227     }
228
229     public void setFloat(String JavaDoc parameterName, float x) throws SQLException
230     {
231         ((CallableStatement)st).setFloat(parameterName, x);
232     }
233
234     public void setInt(String JavaDoc parameterName, int x) throws SQLException
235     {
236         ((CallableStatement)st).setInt(parameterName, x);
237     }
238
239     public void setLong(String JavaDoc parameterName, long x) throws SQLException
240     {
241         ((CallableStatement)st).setLong(parameterName, x);
242     }
243
244     public void setBigDecimal(String JavaDoc parameterName, BigDecimal x) throws SQLException
245     {
246         ((CallableStatement)st).setBigDecimal(parameterName, x);
247     }
248
249     public void setString(String JavaDoc parameterName, String JavaDoc x) throws SQLException
250     {
251         ((CallableStatement)st).setString(parameterName, x);
252     }
253
254     public void setBytes(String JavaDoc parameterName, byte[] x) throws SQLException
255     {
256         ((CallableStatement)st).setBytes(parameterName, x);
257     }
258
259     public void setDate(String JavaDoc parameterName, Date x) throws SQLException
260     {
261         ((CallableStatement)st).setDate(parameterName, x);
262     }
263
264     public void setTime(String JavaDoc parameterName, Time x) throws SQLException
265     {
266         ((CallableStatement)st).setTime(parameterName, x);
267     }
268
269     public void setTimestamp(String JavaDoc parameterName, Timestamp x) throws SQLException
270     {
271         ((CallableStatement)st).setTimestamp(parameterName, x);
272     }
273
274     public void setAsciiStream(String JavaDoc parameterName, InputStream x, int length) throws SQLException
275     {
276         ((CallableStatement)st).setAsciiStream(parameterName, x, length);
277     }
278
279     public void setBinaryStream(String JavaDoc parameterName, InputStream x, int length) throws SQLException
280     {
281         ((CallableStatement)st).setBinaryStream(parameterName, x, length);
282     }
283
284     public void setObject(String JavaDoc parameterName, Object JavaDoc x) throws SQLException
285     {
286         ((CallableStatement)st).setObject(parameterName, x);
287     }
288
289     public void setObject(String JavaDoc parameterName, Object JavaDoc x, int targetSqlType) throws SQLException
290     {
291         ((CallableStatement)st).setObject(parameterName, x, targetSqlType);
292     }
293
294     public void setObject(String JavaDoc parameterName, Object JavaDoc x, int targetSqlType, int scale) throws SQLException
295     {
296         ((CallableStatement)st).setObject(parameterName, x, targetSqlType, scale);
297     }
298
299     public void setCharacterStream(String JavaDoc parameterName, Reader reader, int length) throws SQLException
300     {
301         ((CallableStatement)st).setCharacterStream(parameterName, reader, length);
302     }
303
304     public void setDate(String JavaDoc parameterName, Date x, Calendar JavaDoc cal) throws SQLException
305     {
306         ((CallableStatement)st).setDate(parameterName, x, cal);
307     }
308
309     public void setTime(String JavaDoc parameterName, Time x, Calendar JavaDoc cal) throws SQLException
310     {
311         ((CallableStatement)st).setTime(parameterName, x, cal);
312     }
313
314     public void setTimestamp(String JavaDoc parameterName, Timestamp x, Calendar JavaDoc cal) throws SQLException
315     {
316         ((CallableStatement)st).setTimestamp(parameterName, x, cal);
317     }
318
319     public void setNull(String JavaDoc parameterName, int sqlType, String JavaDoc typeName) throws SQLException
320     {
321         ((CallableStatement)st).setNull(parameterName, sqlType, typeName);
322     }
323
324     public String JavaDoc getString(String JavaDoc parameterName) throws SQLException
325     {
326         return ((CallableStatement)st).getString(parameterName);
327     }
328
329     public boolean getBoolean(String JavaDoc parameterName) throws SQLException
330     {
331         return ((CallableStatement)st).getBoolean(parameterName);
332     }
333
334     public byte getByte(String JavaDoc parameterName) throws SQLException
335     {
336         return ((CallableStatement)st).getByte(parameterName);
337     }
338
339     public short getShort(String JavaDoc parameterName) throws SQLException
340     {
341         return ((CallableStatement)st).getShort(parameterName);
342     }
343
344     public int getInt(String JavaDoc parameterName) throws SQLException
345     {
346         return ((CallableStatement)st).getInt(parameterName);
347     }
348
349     public long getLong(String JavaDoc parameterName) throws SQLException
350     {
351         return ((CallableStatement)st).getLong(parameterName);
352     }
353
354     public float getFloat(String JavaDoc parameterName) throws SQLException
355     {
356         return ((CallableStatement)st).getFloat(parameterName);
357     }
358
359     public double getDouble(String JavaDoc parameterName) throws SQLException
360     {
361         return ((CallableStatement)st).getDouble(parameterName);
362     }
363
364     public byte[] getBytes(String JavaDoc parameterName) throws SQLException
365     {
366         return ((CallableStatement)st).getBytes(parameterName);
367     }
368
369     public Date getDate(String JavaDoc parameterName) throws SQLException
370     {
371         return ((CallableStatement)st).getDate(parameterName);
372     }
373
374     public Time getTime(String JavaDoc parameterName) throws SQLException
375     {
376         return ((CallableStatement)st).getTime(parameterName);
377     }
378
379     public Timestamp getTimestamp(String JavaDoc parameterName) throws SQLException
380     {
381         return ((CallableStatement)st).getTimestamp(parameterName);
382     }
383
384     public Object JavaDoc getObject(String JavaDoc parameterName) throws SQLException
385     {
386         return ((CallableStatement)st).getObject(parameterName);
387     }
388
389     public BigDecimal getBigDecimal(String JavaDoc parameterName) throws SQLException
390     {
391         return ((CallableStatement)st).getBigDecimal(parameterName);
392     }
393
394     public Object JavaDoc getObject(String JavaDoc parameterName, Map JavaDoc map) throws SQLException
395     {
396         return ((CallableStatement)st).getObject(parameterName, map);
397     }
398
399     public Ref getRef(String JavaDoc parameterName) throws SQLException
400     {
401         return ((CallableStatement)st).getRef(parameterName);
402     }
403
404     public Blob getBlob(String JavaDoc parameterName) throws SQLException
405     {
406         return ((CallableStatement)st).getBlob(parameterName);
407     }
408
409     public Clob getClob(String JavaDoc parameterName) throws SQLException
410     {
411         return ((CallableStatement)st).getClob(parameterName);
412     }
413
414     public Array getArray(String JavaDoc parameterName) throws SQLException
415     {
416         return ((CallableStatement)st).getArray(parameterName);
417     }
418
419     public Date getDate(String JavaDoc parameterName, Calendar JavaDoc cal) throws SQLException
420     {
421         return ((CallableStatement)st).getDate(parameterName, cal);
422     }
423
424     public Time getTime(String JavaDoc parameterName, Calendar JavaDoc cal) throws SQLException
425     {
426         return ((CallableStatement)st).getTime(parameterName, cal);
427     }
428
429     public Timestamp getTimestamp(String JavaDoc parameterName, Calendar JavaDoc cal) throws SQLException
430     {
431         return ((CallableStatement)st).getTimestamp(parameterName, cal);
432     }
433
434     public URL getURL(String JavaDoc parameterName) throws SQLException
435     {
436         return ((CallableStatement)st).getURL(parameterName);
437     }
438 }
Popular Tags