KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > smartlib > pool > core > SmartCallableStatement


1 /*
2  * @(#) SmartCallableStatement 1.0 02/08/01
3  */

4
5 package org.smartlib.pool.core;
6
7
8 import java.sql.*;
9 import java.sql.Date JavaDoc;
10 import java.util.*;
11 import java.math.*;
12 import java.io.InputStream JavaDoc;
13 import java.io.Reader JavaDoc;
14 import java.net.URL JavaDoc;
15
16 /**
17  * This class encapsulates a CallableStatement.
18  * Dont expect me to document this class. If you want refer Sun's Documentation.
19  *
20  * @author Sachin Shekar Shetty
21  * @version 1.0, 02/08/01
22  */

23
24
25 public class SmartCallableStatement extends SmartPreparedStatement
26             implements Close , CallableStatement {
27
28     private CallableStatement cstmt;
29     private SmartConnection sConn;
30     private boolean isClosed = false;
31     Debugger debug =
32                 new Debugger("org.smartlib.pool.core.SmartCallableStatement", true);
33
34     SmartCallableStatement(CallableStatement cstmt
35             , SmartConnection sConn) {
36
37         super(cstmt,sConn);
38         this.cstmt = cstmt;
39         this.sConn = sConn;
40
41     }
42
43     private void preProcess() throws SQLException {
44
45         if (isClosed())
46             throw new SQLException("Prepared Statement already closed");
47         sConn.setLastAccessedTime();
48
49     }
50
51     public void registerOutParameter(int p0, int p1) throws SQLException {
52
53         preProcess();
54         cstmt.registerOutParameter(p0,p1);
55
56     }
57
58     public void registerOutParameter(int p0, int p1, int p2)
59             throws SQLException {
60
61         preProcess();
62         cstmt.registerOutParameter(p0,p1,p2);
63
64     }
65
66     public boolean wasNull() throws SQLException {
67
68         preProcess();
69         return cstmt.wasNull();
70
71     }
72
73     public String JavaDoc getString(int p0) throws SQLException {
74
75         preProcess();
76         return cstmt.getString(p0);
77
78     }
79
80     public boolean getBoolean(int p0) throws SQLException {
81
82         preProcess();
83         return cstmt.getBoolean(p0);
84
85     }
86
87     public byte getByte(int p0) throws SQLException {
88
89         preProcess();
90         return cstmt.getByte(p0);
91
92     }
93
94     public short getShort(int p0) throws SQLException {
95
96         preProcess();
97         return cstmt.getShort(p0);
98
99     }
100
101     public int getInt(int p0) throws SQLException {
102
103         preProcess();
104         return cstmt.getInt(p0);
105
106     }
107
108     public long getLong(int p0) throws SQLException {
109
110         preProcess();
111         return cstmt.getLong(p0);
112
113     }
114
115     public float getFloat(int p0) throws SQLException {
116
117         preProcess();
118         return cstmt.getFloat(p0);
119
120     }
121
122     public double getDouble(int p0) throws SQLException {
123
124         preProcess();
125         return getDouble(p0);
126
127     }
128
129     public BigDecimal getBigDecimal(int p0, int p1) throws SQLException {
130
131         preProcess();
132         return getBigDecimal(p0,p1);
133
134     }
135
136     public byte[] getBytes(int p0) throws SQLException {
137
138         preProcess();
139         return getBytes(p0);
140
141     }
142
143     public java.sql.Date JavaDoc getDate(int p0) throws SQLException {
144
145         preProcess();
146         return cstmt.getDate(p0);
147
148     }
149
150     public Time getTime(int p0) throws SQLException {
151
152         preProcess();
153         return cstmt.getTime(p0);
154
155     }
156
157     public Timestamp getTimestamp(int p0) throws SQLException {
158
159         preProcess();
160         return cstmt.getTimestamp(p0);
161
162     }
163
164     public Object JavaDoc getObject(int p0) throws SQLException {
165
166         preProcess();
167         return cstmt.getObject(p0);
168
169     }
170
171     public BigDecimal getBigDecimal(int p0) throws SQLException {
172
173         preProcess();
174         return cstmt.getBigDecimal(p0);
175
176     }
177
178     public Object JavaDoc getObject(int i, Map<String JavaDoc, Class JavaDoc<?>> map) throws SQLException {
179         return null; //To change body of implemented methods use File | Settings | File Templates.
180
}
181
182
183     public Ref getRef(int p0) throws SQLException {
184
185         preProcess();
186         return cstmt.getRef(p0);
187
188     }
189
190     public Blob getBlob(int p0) throws SQLException {
191
192         preProcess();
193         return cstmt.getBlob(p0);
194
195     }
196
197     public Clob getClob(int p0) throws SQLException {
198
199         preProcess();
200         return cstmt.getClob(p0);
201
202     }
203
204     public Array getArray(int p0) throws SQLException {
205
206         preProcess();
207         return cstmt.getArray(p0);
208
209     }
210
211     public java.sql.Date JavaDoc getDate(int p0, Calendar p1) throws SQLException {
212
213         preProcess();
214         return cstmt.getDate(p0,p1);
215
216     }
217
218     public Time getTime(int p0, Calendar p1) throws SQLException {
219
220         preProcess();
221         return cstmt.getTime(p0,p1);
222
223     }
224
225     public Timestamp getTimestamp(int p0, Calendar p1) throws SQLException {
226
227         preProcess();
228         return cstmt.getTimestamp(p0,p1);
229
230     }
231
232     public void registerOutParameter(int p0, int p1, String JavaDoc p2)
233         throws SQLException {
234
235         preProcess();
236         cstmt.registerOutParameter(p0,p1,p2);
237
238     }
239
240     public void registerOutParameter(String JavaDoc parameterName, int sqlType) throws SQLException {
241         //To change body of implemented methods use File | Settings | File Templates.
242
}
243
244     public void registerOutParameter(String JavaDoc parameterName, int sqlType, int scale) throws SQLException {
245         //To change body of implemented methods use File | Settings | File Templates.
246
}
247
248     public void registerOutParameter(String JavaDoc parameterName, int sqlType, String JavaDoc typeName) throws SQLException {
249         //To change body of implemented methods use File | Settings | File Templates.
250
}
251
252     public URL JavaDoc getURL(int parameterIndex) throws SQLException {
253         return null; //To change body of implemented methods use File | Settings | File Templates.
254
}
255
256     public void setURL(String JavaDoc parameterName, URL JavaDoc val) throws SQLException {
257         //To change body of implemented methods use File | Settings | File Templates.
258
}
259
260     public void setNull(String JavaDoc parameterName, int sqlType) throws SQLException {
261         //To change body of implemented methods use File | Settings | File Templates.
262
}
263
264     public void setBoolean(String JavaDoc parameterName, boolean x) throws SQLException {
265         //To change body of implemented methods use File | Settings | File Templates.
266
}
267
268     public void setByte(String JavaDoc parameterName, byte x) throws SQLException {
269         //To change body of implemented methods use File | Settings | File Templates.
270
}
271
272     public void setShort(String JavaDoc parameterName, short x) throws SQLException {
273         //To change body of implemented methods use File | Settings | File Templates.
274
}
275
276     public void setInt(String JavaDoc parameterName, int x) throws SQLException {
277         //To change body of implemented methods use File | Settings | File Templates.
278
}
279
280     public void setLong(String JavaDoc parameterName, long x) throws SQLException {
281         //To change body of implemented methods use File | Settings | File Templates.
282
}
283
284     public void setFloat(String JavaDoc parameterName, float x) throws SQLException {
285         //To change body of implemented methods use File | Settings | File Templates.
286
}
287
288     public void setDouble(String JavaDoc parameterName, double x) throws SQLException {
289         //To change body of implemented methods use File | Settings | File Templates.
290
}
291
292     public void setBigDecimal(String JavaDoc parameterName, BigDecimal x) throws SQLException {
293         //To change body of implemented methods use File | Settings | File Templates.
294
}
295
296     public void setString(String JavaDoc parameterName, String JavaDoc x) throws SQLException {
297         //To change body of implemented methods use File | Settings | File Templates.
298
}
299
300     public void setBytes(String JavaDoc parameterName, byte x[]) throws SQLException {
301         //To change body of implemented methods use File | Settings | File Templates.
302
}
303
304     public void setDate(String JavaDoc parameterName, Date JavaDoc x) throws SQLException {
305         //To change body of implemented methods use File | Settings | File Templates.
306
}
307
308     public void setTime(String JavaDoc parameterName, Time x) throws SQLException {
309         //To change body of implemented methods use File | Settings | File Templates.
310
}
311
312     public void setTimestamp(String JavaDoc parameterName, Timestamp x) throws SQLException {
313         //To change body of implemented methods use File | Settings | File Templates.
314
}
315
316     public void setAsciiStream(String JavaDoc parameterName, InputStream JavaDoc x, int length) throws SQLException {
317         //To change body of implemented methods use File | Settings | File Templates.
318
}
319
320     public void setBinaryStream(String JavaDoc parameterName, InputStream JavaDoc x, int length) throws SQLException {
321         //To change body of implemented methods use File | Settings | File Templates.
322
}
323
324     public void setObject(String JavaDoc parameterName, Object JavaDoc x, int targetSqlType, int scale) throws SQLException {
325         //To change body of implemented methods use File | Settings | File Templates.
326
}
327
328     public void setObject(String JavaDoc parameterName, Object JavaDoc x, int targetSqlType) throws SQLException {
329         //To change body of implemented methods use File | Settings | File Templates.
330
}
331
332     public void setObject(String JavaDoc parameterName, Object JavaDoc x) throws SQLException {
333         //To change body of implemented methods use File | Settings | File Templates.
334
}
335
336     public void setCharacterStream(String JavaDoc parameterName, Reader JavaDoc reader, int length) throws SQLException {
337         //To change body of implemented methods use File | Settings | File Templates.
338
}
339
340     public void setDate(String JavaDoc parameterName, Date JavaDoc x, Calendar cal) throws SQLException {
341         //To change body of implemented methods use File | Settings | File Templates.
342
}
343
344     public void setTime(String JavaDoc parameterName, Time x, Calendar cal) throws SQLException {
345         //To change body of implemented methods use File | Settings | File Templates.
346
}
347
348     public void setTimestamp(String JavaDoc parameterName, Timestamp x, Calendar cal) throws SQLException {
349         //To change body of implemented methods use File | Settings | File Templates.
350
}
351
352     public void setNull(String JavaDoc parameterName, int sqlType, String JavaDoc typeName) throws SQLException {
353         //To change body of implemented methods use File | Settings | File Templates.
354
}
355
356     public String JavaDoc getString(String JavaDoc parameterName) throws SQLException {
357         return null; //To change body of implemented methods use File | Settings | File Templates.
358
}
359
360     public boolean getBoolean(String JavaDoc parameterName) throws SQLException {
361         return false; //To change body of implemented methods use File | Settings | File Templates.
362
}
363
364     public byte getByte(String JavaDoc parameterName) throws SQLException {
365         return 0; //To change body of implemented methods use File | Settings | File Templates.
366
}
367
368     public short getShort(String JavaDoc parameterName) throws SQLException {
369         return 0; //To change body of implemented methods use File | Settings | File Templates.
370
}
371
372     public int getInt(String JavaDoc parameterName) throws SQLException {
373         return 0; //To change body of implemented methods use File | Settings | File Templates.
374
}
375
376     public long getLong(String JavaDoc parameterName) throws SQLException {
377         return 0; //To change body of implemented methods use File | Settings | File Templates.
378
}
379
380     public float getFloat(String JavaDoc parameterName) throws SQLException {
381         return 0; //To change body of implemented methods use File | Settings | File Templates.
382
}
383
384     public double getDouble(String JavaDoc parameterName) throws SQLException {
385         return 0; //To change body of implemented methods use File | Settings | File Templates.
386
}
387
388     public byte[] getBytes(String JavaDoc parameterName) throws SQLException {
389         return new byte[0]; //To change body of implemented methods use File | Settings | File Templates.
390
}
391
392     public Date JavaDoc getDate(String JavaDoc parameterName) throws SQLException {
393         return null; //To change body of implemented methods use File | Settings | File Templates.
394
}
395
396     public Time getTime(String JavaDoc parameterName) throws SQLException {
397         return null; //To change body of implemented methods use File | Settings | File Templates.
398
}
399
400     public Timestamp getTimestamp(String JavaDoc parameterName) throws SQLException {
401         return null; //To change body of implemented methods use File | Settings | File Templates.
402
}
403
404     public Object JavaDoc getObject(String JavaDoc parameterName) throws SQLException {
405         return null; //To change body of implemented methods use File | Settings | File Templates.
406
}
407
408     public BigDecimal getBigDecimal(String JavaDoc parameterName) throws SQLException {
409         return null; //To change body of implemented methods use File | Settings | File Templates.
410
}
411
412     public Object JavaDoc getObject(String JavaDoc parameterName, Map<String JavaDoc, Class JavaDoc<?>> map) throws SQLException {
413         return null; //To change body of implemented methods use File | Settings | File Templates.
414
}
415
416     public Ref getRef(String JavaDoc parameterName) throws SQLException {
417         return null; //To change body of implemented methods use File | Settings | File Templates.
418
}
419
420     public Blob getBlob(String JavaDoc parameterName) throws SQLException {
421         return null; //To change body of implemented methods use File | Settings | File Templates.
422
}
423
424     public Clob getClob(String JavaDoc parameterName) throws SQLException {
425         return null; //To change body of implemented methods use File | Settings | File Templates.
426
}
427
428     public Array getArray(String JavaDoc parameterName) throws SQLException {
429         return null; //To change body of implemented methods use File | Settings | File Templates.
430
}
431
432     public Date JavaDoc getDate(String JavaDoc parameterName, Calendar cal) throws SQLException {
433         return null; //To change body of implemented methods use File | Settings | File Templates.
434
}
435
436     public Time getTime(String JavaDoc parameterName, Calendar cal) throws SQLException {
437         return null; //To change body of implemented methods use File | Settings | File Templates.
438
}
439
440     public Timestamp getTimestamp(String JavaDoc parameterName, Calendar cal) throws SQLException {
441         return null; //To change body of implemented methods use File | Settings | File Templates.
442
}
443
444     public URL JavaDoc getURL(String JavaDoc parameterName) throws SQLException {
445         return null; //To change body of implemented methods use File | Settings | File Templates.
446
}
447
448     public boolean isClosed() {
449
450         return isClosed;
451
452     }
453
454     public String JavaDoc toString() {
455
456         return cstmt.toString();
457
458     }
459
460     public void close() throws SQLException {
461
462         if (isClosed)
463             throw new SQLException("CallableStatement already closed");
464         cstmt.close();
465         debug.print("CallableStatement Closed for:" + sConn.getOwner());
466         isClosed=true;
467
468     }
469
470
471 }
472
Popular Tags