001: /*
002: * @(#) SmartCallableStatement 1.0 02/08/01
003: */
004:
005: package org.smartlib.pool.core;
006:
007: import java.sql.*;
008: import java.sql.Date;
009: import java.util.*;
010: import java.math.*;
011: import java.io.InputStream;
012: import java.io.Reader;
013: import java.net.URL;
014:
015: /**
016: * This class encapsulates a CallableStatement.
017: * Dont expect me to document this class. If you want refer Sun's Documentation.
018: *
019: * @author Sachin Shekar Shetty
020: * @version 1.0, 02/08/01
021: */
022:
023: public class SmartCallableStatement extends SmartPreparedStatement
024: implements Close, CallableStatement {
025:
026: private CallableStatement cstmt;
027: private SmartConnection sConn;
028: private boolean isClosed = false;
029: Debugger debug = new Debugger(
030: "org.smartlib.pool.core.SmartCallableStatement", true);
031:
032: SmartCallableStatement(CallableStatement cstmt,
033: SmartConnection sConn) {
034:
035: super (cstmt, sConn);
036: this .cstmt = cstmt;
037: this .sConn = sConn;
038:
039: }
040:
041: private void preProcess() throws SQLException {
042:
043: if (isClosed())
044: throw new SQLException("Prepared Statement already closed");
045: sConn.setLastAccessedTime();
046:
047: }
048:
049: public void registerOutParameter(int p0, int p1)
050: throws SQLException {
051:
052: preProcess();
053: cstmt.registerOutParameter(p0, p1);
054:
055: }
056:
057: public void registerOutParameter(int p0, int p1, int p2)
058: throws SQLException {
059:
060: preProcess();
061: cstmt.registerOutParameter(p0, p1, p2);
062:
063: }
064:
065: public boolean wasNull() throws SQLException {
066:
067: preProcess();
068: return cstmt.wasNull();
069:
070: }
071:
072: public String getString(int p0) throws SQLException {
073:
074: preProcess();
075: return cstmt.getString(p0);
076:
077: }
078:
079: public boolean getBoolean(int p0) throws SQLException {
080:
081: preProcess();
082: return cstmt.getBoolean(p0);
083:
084: }
085:
086: public byte getByte(int p0) throws SQLException {
087:
088: preProcess();
089: return cstmt.getByte(p0);
090:
091: }
092:
093: public short getShort(int p0) throws SQLException {
094:
095: preProcess();
096: return cstmt.getShort(p0);
097:
098: }
099:
100: public int getInt(int p0) throws SQLException {
101:
102: preProcess();
103: return cstmt.getInt(p0);
104:
105: }
106:
107: public long getLong(int p0) throws SQLException {
108:
109: preProcess();
110: return cstmt.getLong(p0);
111:
112: }
113:
114: public float getFloat(int p0) throws SQLException {
115:
116: preProcess();
117: return cstmt.getFloat(p0);
118:
119: }
120:
121: public double getDouble(int p0) throws SQLException {
122:
123: preProcess();
124: return getDouble(p0);
125:
126: }
127:
128: public BigDecimal getBigDecimal(int p0, int p1) throws SQLException {
129:
130: preProcess();
131: return getBigDecimal(p0, p1);
132:
133: }
134:
135: public byte[] getBytes(int p0) throws SQLException {
136:
137: preProcess();
138: return getBytes(p0);
139:
140: }
141:
142: public java.sql.Date getDate(int p0) throws SQLException {
143:
144: preProcess();
145: return cstmt.getDate(p0);
146:
147: }
148:
149: public Time getTime(int p0) throws SQLException {
150:
151: preProcess();
152: return cstmt.getTime(p0);
153:
154: }
155:
156: public Timestamp getTimestamp(int p0) throws SQLException {
157:
158: preProcess();
159: return cstmt.getTimestamp(p0);
160:
161: }
162:
163: public Object getObject(int p0) throws SQLException {
164:
165: preProcess();
166: return cstmt.getObject(p0);
167:
168: }
169:
170: public BigDecimal getBigDecimal(int p0) throws SQLException {
171:
172: preProcess();
173: return cstmt.getBigDecimal(p0);
174:
175: }
176:
177: public Object getObject(int i, Map<String, Class<?>> map)
178: throws SQLException {
179: return null; //To change body of implemented methods use File | Settings | File Templates.
180: }
181:
182: public Ref getRef(int p0) throws SQLException {
183:
184: preProcess();
185: return cstmt.getRef(p0);
186:
187: }
188:
189: public Blob getBlob(int p0) throws SQLException {
190:
191: preProcess();
192: return cstmt.getBlob(p0);
193:
194: }
195:
196: public Clob getClob(int p0) throws SQLException {
197:
198: preProcess();
199: return cstmt.getClob(p0);
200:
201: }
202:
203: public Array getArray(int p0) throws SQLException {
204:
205: preProcess();
206: return cstmt.getArray(p0);
207:
208: }
209:
210: public java.sql.Date getDate(int p0, Calendar p1)
211: 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)
226: throws SQLException {
227:
228: preProcess();
229: return cstmt.getTimestamp(p0, p1);
230:
231: }
232:
233: public void registerOutParameter(int p0, int p1, String p2)
234: throws SQLException {
235:
236: preProcess();
237: cstmt.registerOutParameter(p0, p1, p2);
238:
239: }
240:
241: public void registerOutParameter(String parameterName, int sqlType)
242: throws SQLException {
243: //To change body of implemented methods use File | Settings | File Templates.
244: }
245:
246: public void registerOutParameter(String parameterName, int sqlType,
247: int scale) throws SQLException {
248: //To change body of implemented methods use File | Settings | File Templates.
249: }
250:
251: public void registerOutParameter(String parameterName, int sqlType,
252: String typeName) throws SQLException {
253: //To change body of implemented methods use File | Settings | File Templates.
254: }
255:
256: public URL getURL(int parameterIndex) throws SQLException {
257: return null; //To change body of implemented methods use File | Settings | File Templates.
258: }
259:
260: public void setURL(String parameterName, URL val)
261: throws SQLException {
262: //To change body of implemented methods use File | Settings | File Templates.
263: }
264:
265: public void setNull(String parameterName, int sqlType)
266: throws SQLException {
267: //To change body of implemented methods use File | Settings | File Templates.
268: }
269:
270: public void setBoolean(String parameterName, boolean x)
271: throws SQLException {
272: //To change body of implemented methods use File | Settings | File Templates.
273: }
274:
275: public void setByte(String parameterName, byte x)
276: throws SQLException {
277: //To change body of implemented methods use File | Settings | File Templates.
278: }
279:
280: public void setShort(String parameterName, short x)
281: throws SQLException {
282: //To change body of implemented methods use File | Settings | File Templates.
283: }
284:
285: public void setInt(String parameterName, int x) throws SQLException {
286: //To change body of implemented methods use File | Settings | File Templates.
287: }
288:
289: public void setLong(String parameterName, long x)
290: throws SQLException {
291: //To change body of implemented methods use File | Settings | File Templates.
292: }
293:
294: public void setFloat(String parameterName, float x)
295: throws SQLException {
296: //To change body of implemented methods use File | Settings | File Templates.
297: }
298:
299: public void setDouble(String parameterName, double x)
300: throws SQLException {
301: //To change body of implemented methods use File | Settings | File Templates.
302: }
303:
304: public void setBigDecimal(String parameterName, BigDecimal x)
305: throws SQLException {
306: //To change body of implemented methods use File | Settings | File Templates.
307: }
308:
309: public void setString(String parameterName, String x)
310: throws SQLException {
311: //To change body of implemented methods use File | Settings | File Templates.
312: }
313:
314: public void setBytes(String parameterName, byte x[])
315: throws SQLException {
316: //To change body of implemented methods use File | Settings | File Templates.
317: }
318:
319: public void setDate(String parameterName, Date x)
320: throws SQLException {
321: //To change body of implemented methods use File | Settings | File Templates.
322: }
323:
324: public void setTime(String parameterName, Time x)
325: throws SQLException {
326: //To change body of implemented methods use File | Settings | File Templates.
327: }
328:
329: public void setTimestamp(String parameterName, Timestamp x)
330: throws SQLException {
331: //To change body of implemented methods use File | Settings | File Templates.
332: }
333:
334: public void setAsciiStream(String parameterName, InputStream x,
335: int length) throws SQLException {
336: //To change body of implemented methods use File | Settings | File Templates.
337: }
338:
339: public void setBinaryStream(String parameterName, InputStream x,
340: int length) throws SQLException {
341: //To change body of implemented methods use File | Settings | File Templates.
342: }
343:
344: public void setObject(String parameterName, Object x,
345: int targetSqlType, int scale) throws SQLException {
346: //To change body of implemented methods use File | Settings | File Templates.
347: }
348:
349: public void setObject(String parameterName, Object x,
350: int targetSqlType) throws SQLException {
351: //To change body of implemented methods use File | Settings | File Templates.
352: }
353:
354: public void setObject(String parameterName, Object x)
355: throws SQLException {
356: //To change body of implemented methods use File | Settings | File Templates.
357: }
358:
359: public void setCharacterStream(String parameterName, Reader reader,
360: int length) throws SQLException {
361: //To change body of implemented methods use File | Settings | File Templates.
362: }
363:
364: public void setDate(String parameterName, Date x, Calendar cal)
365: throws SQLException {
366: //To change body of implemented methods use File | Settings | File Templates.
367: }
368:
369: public void setTime(String parameterName, Time x, Calendar cal)
370: throws SQLException {
371: //To change body of implemented methods use File | Settings | File Templates.
372: }
373:
374: public void setTimestamp(String parameterName, Timestamp x,
375: Calendar cal) throws SQLException {
376: //To change body of implemented methods use File | Settings | File Templates.
377: }
378:
379: public void setNull(String parameterName, int sqlType,
380: String typeName) throws SQLException {
381: //To change body of implemented methods use File | Settings | File Templates.
382: }
383:
384: public String getString(String parameterName) throws SQLException {
385: return null; //To change body of implemented methods use File | Settings | File Templates.
386: }
387:
388: public boolean getBoolean(String parameterName) throws SQLException {
389: return false; //To change body of implemented methods use File | Settings | File Templates.
390: }
391:
392: public byte getByte(String parameterName) throws SQLException {
393: return 0; //To change body of implemented methods use File | Settings | File Templates.
394: }
395:
396: public short getShort(String parameterName) throws SQLException {
397: return 0; //To change body of implemented methods use File | Settings | File Templates.
398: }
399:
400: public int getInt(String parameterName) throws SQLException {
401: return 0; //To change body of implemented methods use File | Settings | File Templates.
402: }
403:
404: public long getLong(String parameterName) throws SQLException {
405: return 0; //To change body of implemented methods use File | Settings | File Templates.
406: }
407:
408: public float getFloat(String parameterName) throws SQLException {
409: return 0; //To change body of implemented methods use File | Settings | File Templates.
410: }
411:
412: public double getDouble(String parameterName) throws SQLException {
413: return 0; //To change body of implemented methods use File | Settings | File Templates.
414: }
415:
416: public byte[] getBytes(String parameterName) throws SQLException {
417: return new byte[0]; //To change body of implemented methods use File | Settings | File Templates.
418: }
419:
420: public Date getDate(String parameterName) throws SQLException {
421: return null; //To change body of implemented methods use File | Settings | File Templates.
422: }
423:
424: public Time getTime(String parameterName) throws SQLException {
425: return null; //To change body of implemented methods use File | Settings | File Templates.
426: }
427:
428: public Timestamp getTimestamp(String parameterName)
429: throws SQLException {
430: return null; //To change body of implemented methods use File | Settings | File Templates.
431: }
432:
433: public Object getObject(String parameterName) throws SQLException {
434: return null; //To change body of implemented methods use File | Settings | File Templates.
435: }
436:
437: public BigDecimal getBigDecimal(String parameterName)
438: throws SQLException {
439: return null; //To change body of implemented methods use File | Settings | File Templates.
440: }
441:
442: public Object getObject(String parameterName,
443: Map<String, Class<?>> map) throws SQLException {
444: return null; //To change body of implemented methods use File | Settings | File Templates.
445: }
446:
447: public Ref getRef(String parameterName) throws SQLException {
448: return null; //To change body of implemented methods use File | Settings | File Templates.
449: }
450:
451: public Blob getBlob(String parameterName) throws SQLException {
452: return null; //To change body of implemented methods use File | Settings | File Templates.
453: }
454:
455: public Clob getClob(String parameterName) throws SQLException {
456: return null; //To change body of implemented methods use File | Settings | File Templates.
457: }
458:
459: public Array getArray(String parameterName) throws SQLException {
460: return null; //To change body of implemented methods use File | Settings | File Templates.
461: }
462:
463: public Date getDate(String parameterName, Calendar cal)
464: throws SQLException {
465: return null; //To change body of implemented methods use File | Settings | File Templates.
466: }
467:
468: public Time getTime(String parameterName, Calendar cal)
469: throws SQLException {
470: return null; //To change body of implemented methods use File | Settings | File Templates.
471: }
472:
473: public Timestamp getTimestamp(String parameterName, Calendar cal)
474: throws SQLException {
475: return null; //To change body of implemented methods use File | Settings | File Templates.
476: }
477:
478: public URL getURL(String parameterName) throws SQLException {
479: return null; //To change body of implemented methods use File | Settings | File Templates.
480: }
481:
482: public boolean isClosed() {
483:
484: return isClosed;
485:
486: }
487:
488: public String toString() {
489:
490: return cstmt.toString();
491:
492: }
493:
494: public void close() throws SQLException {
495:
496: if (isClosed)
497: throw new SQLException("CallableStatement already closed");
498: cstmt.close();
499: debug.print("CallableStatement Closed for:" + sConn.getOwner());
500: isClosed = true;
501:
502: }
503:
504: }
|