KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > caucho > sql > UserCallableStatement


1 /*
2  * Copyright (c) 1998-2006 Caucho Technology -- all rights reserved
3  *
4  * This file is part of Resin(R) Open Source
5  *
6  * Each copy or derived work must preserve the copyright notice and this
7  * notice unmodified.
8  *
9  * Resin Open Source is free software; you can redistribute it and/or modify
10  * it under the terms of the GNU General Public License as published by
11  * the Free Software Foundation; either version 2 of the License, or
12  * (at your option) any later version.
13  *
14  * Resin Open Source is distributed in the hope that it will be useful,
15  * but WITHOUT ANY WARRANTY; without even the implied warranty of
16  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE, or any warranty
17  * of NON-INFRINGEMENT. See the GNU General Public License for more
18  * details.
19  *
20  * You should have received a copy of the GNU General Public License
21  * along with Resin Open Source; if not, write to the
22  * Free SoftwareFoundation, Inc.
23  * 59 Temple Place, Suite 330
24  * Boston, MA 02111-1307 USA
25  *
26  * @author Scott Ferguson
27  */

28
29 package com.caucho.sql;
30
31 import com.caucho.log.Log;
32 import com.caucho.util.L10N;
33
34 import java.io.InputStream JavaDoc;
35 import java.io.Reader JavaDoc;
36 import java.math.BigDecimal JavaDoc;
37 import java.net.URL JavaDoc;
38 import java.sql.*;
39 import java.util.Calendar JavaDoc;
40 import java.util.Map JavaDoc;
41 import java.util.logging.Logger JavaDoc;
42
43 /**
44  * User-view of prepared statements
45  */

46 public class UserCallableStatement extends UserPreparedStatement
47   implements CallableStatement {
48   protected final static Logger JavaDoc log = Log.open(UserCallableStatement.class);
49   protected static L10N L = new L10N(UserCallableStatement.class);
50
51   protected CallableStatement _cstmt;
52   private boolean _isClosed;
53
54   UserCallableStatement(UserConnection conn,
55             CallableStatement cStmt)
56   {
57     super(conn, cStmt);
58     
59     _cstmt = cStmt;
60
61     if (cStmt == null)
62       throw new NullPointerException JavaDoc();
63   }
64
65   /**
66    * The array value
67    */

68   public Array getArray(int i)
69     throws SQLException
70   {
71     return _cstmt.getArray(i);
72   }
73
74   /**
75    * The array value
76    */

77   public Array getArray(String JavaDoc name)
78     throws SQLException
79   {
80     return _cstmt.getArray(name);
81   }
82
83   /**
84    * The big decimal value
85    */

86   public BigDecimal JavaDoc getBigDecimal(int i)
87     throws SQLException
88   {
89     return _cstmt.getBigDecimal(i);
90   }
91
92   /**
93    * The bigDecimal value
94    */

95   public BigDecimal JavaDoc getBigDecimal(String JavaDoc name)
96     throws SQLException
97   {
98     return _cstmt.getBigDecimal(name);
99   }
100
101   /**
102    * The big decimal value
103    */

104   public BigDecimal JavaDoc getBigDecimal(int i, int scale)
105     throws SQLException
106   {
107     return _cstmt.getBigDecimal(i, scale);
108   }
109
110   /**
111    * The blob value
112    */

113   public Blob getBlob(int i)
114     throws SQLException
115   {
116     return _cstmt.getBlob(i);
117   }
118
119   /**
120    * The blob value
121    */

122   public Blob getBlob(String JavaDoc name)
123     throws SQLException
124   {
125     return _cstmt.getBlob(name);
126   }
127
128   /**
129    * The boolean value
130    */

131   public boolean getBoolean(int i)
132     throws SQLException
133   {
134     return _cstmt.getBoolean(i);
135   }
136
137   /**
138    * The boolean value
139    */

140   public boolean getBoolean(String JavaDoc name)
141     throws SQLException
142   {
143     return _cstmt.getBoolean(name);
144   }
145
146   /**
147    * The byte value
148    */

149   public byte getByte(int i)
150     throws SQLException
151   {
152     return _cstmt.getByte(i);
153   }
154
155   /**
156    * The byte value
157    */

158   public byte getByte(String JavaDoc name)
159     throws SQLException
160   {
161     return _cstmt.getByte(name);
162   }
163
164   /**
165    * The bytes value
166    */

167   public byte []getBytes(int i)
168     throws SQLException
169   {
170     return _cstmt.getBytes(i);
171   }
172
173   /**
174    * The bytes value
175    */

176   public byte []getBytes(String JavaDoc name)
177     throws SQLException
178   {
179     return _cstmt.getBytes(name);
180   }
181   
182   /**
183    * The clob value
184    */

185   public Clob getClob(int i)
186     throws SQLException
187   {
188     return _cstmt.getClob(i);
189   }
190
191   /**
192    * The clob value
193    */

194   public Clob getClob(String JavaDoc name)
195     throws SQLException
196   {
197     return _cstmt.getClob(name);
198   }
199   
200   /**
201    * The date value
202    */

203   public Date getDate(int i)
204     throws SQLException
205   {
206     return _cstmt.getDate(i);
207   }
208
209   /**
210    * The date value
211    */

212   public Date getDate(String JavaDoc name)
213     throws SQLException
214   {
215     return _cstmt.getDate(name);
216   }
217   
218   /**
219    * The date value
220    */

221   public Date getDate(int i, Calendar JavaDoc cal)
222     throws SQLException
223   {
224     return _cstmt.getDate(i, cal);
225   }
226
227   /**
228    * The date value
229    */

230   public Date getDate(String JavaDoc name, Calendar JavaDoc cal)
231     throws SQLException
232   {
233     return _cstmt.getDate(name);
234   }
235   
236   /**
237    * The double value
238    */

239   public double getDouble(int i)
240     throws SQLException
241   {
242     return _cstmt.getDouble(i);
243   }
244
245   /**
246    * The double value
247    */

248   public double getDouble(String JavaDoc name)
249     throws SQLException
250   {
251     return _cstmt.getDouble(name);
252   }
253   
254   /**
255    * The float value
256    */

257   public float getFloat(int i)
258     throws SQLException
259   {
260     return _cstmt.getFloat(i);
261   }
262
263   /**
264    * The float value
265    */

266   public float getFloat(String JavaDoc name)
267     throws SQLException
268   {
269     return _cstmt.getFloat(name);
270   }
271   
272   /**
273    * The int value
274    */

275   public int getInt(int i)
276     throws SQLException
277   {
278     return _cstmt.getInt(i);
279   }
280
281   /**
282    * The int value
283    */

284   public int getInt(String JavaDoc name)
285     throws SQLException
286   {
287     return _cstmt.getInt(name);
288   }
289   
290   /**
291    * The long value
292    */

293   public long getLong(int i)
294     throws SQLException
295   {
296     return _cstmt.getLong(i);
297   }
298
299   /**
300    * The long value
301    */

302   public long getLong(String JavaDoc name)
303     throws SQLException
304   {
305     return _cstmt.getLong(name);
306   }
307   
308   /**
309    * The object value
310    */

311   public Object JavaDoc getObject(int i)
312     throws SQLException
313   {
314     return _cstmt.getObject(i);
315   }
316
317   /**
318    * The object value
319    */

320   public Object JavaDoc getObject(String JavaDoc name)
321     throws SQLException
322   {
323     return _cstmt.getObject(name);
324   }
325   
326   /**
327    * The object value
328    */

329   public Object JavaDoc getObject(int i, Map JavaDoc<String JavaDoc,Class JavaDoc<?>> map)
330     throws SQLException
331   {
332     return _cstmt.getObject(i);
333   }
334
335   /**
336    * The object value
337    */

338   public Object JavaDoc getObject(String JavaDoc name, Map JavaDoc<String JavaDoc,Class JavaDoc<?>> map)
339     throws SQLException
340   {
341     return _cstmt.getObject(name);
342   }
343   
344   /**
345    * The ref value
346    */

347   public Ref getRef(int i)
348     throws SQLException
349   {
350     return _cstmt.getRef(i);
351   }
352
353   /**
354    * The ref value
355    */

356   public Ref getRef(String JavaDoc name)
357     throws SQLException
358   {
359     return _cstmt.getRef(name);
360   }
361   
362   /**
363    * The short value
364    */

365   public short getShort(int i)
366     throws SQLException
367   {
368     return _cstmt.getShort(i);
369   }
370
371   /**
372    * The short value
373    */

374   public short getShort(String JavaDoc name)
375     throws SQLException
376   {
377     return _cstmt.getShort(name);
378   }
379   
380   /**
381    * The string value
382    */

383   public String JavaDoc getString(int i)
384     throws SQLException
385   {
386     return _cstmt.getString(i);
387   }
388
389   /**
390    * The string value
391    */

392   public String JavaDoc getString(String JavaDoc name)
393     throws SQLException
394   {
395     return _cstmt.getString(name);
396   }
397   
398   /**
399    * The time value
400    */

401   public Time getTime(int i)
402     throws SQLException
403   {
404     return _cstmt.getTime(i);
405   }
406
407   /**
408    * The time value
409    */

410   public Time getTime(String JavaDoc name)
411     throws SQLException
412   {
413     return _cstmt.getTime(name);
414   }
415   
416   /**
417    * The time value
418    */

419   public Time getTime(int i, Calendar JavaDoc cal)
420     throws SQLException
421   {
422     return _cstmt.getTime(i, cal);
423   }
424
425   /**
426    * The time value
427    */

428   public Time getTime(String JavaDoc name, Calendar JavaDoc cal)
429     throws SQLException
430   {
431     return _cstmt.getTime(name);
432   }
433   
434   /**
435    * The timestamp value
436    */

437   public Timestamp getTimestamp(int i)
438     throws SQLException
439   {
440     return _cstmt.getTimestamp(i);
441   }
442
443   /**
444    * The timestamp value
445    */

446   public Timestamp getTimestamp(String JavaDoc name)
447     throws SQLException
448   {
449     return _cstmt.getTimestamp(name);
450   }
451   
452   /**
453    * The timestamp value
454    */

455   public Timestamp getTimestamp(int i, Calendar JavaDoc cal)
456     throws SQLException
457   {
458     return _cstmt.getTimestamp(i, cal);
459   }
460
461   /**
462    * The timestamp value
463    */

464   public Timestamp getTimestamp(String JavaDoc name, Calendar JavaDoc cal)
465     throws SQLException
466   {
467     return _cstmt.getTimestamp(name);
468   }
469   
470   /**
471    * The URL value
472    */

473   public URL JavaDoc getURL(int i)
474     throws SQLException
475   {
476     return _cstmt.getURL(i);
477   }
478
479   /**
480    * The URL value
481    */

482   public URL JavaDoc getURL(String JavaDoc name)
483     throws SQLException
484   {
485     return _cstmt.getURL(name);
486   }
487
488   /**
489    * Registers the out parameter.
490    */

491   public void registerOutParameter(int parameterIndex, int sqlType)
492     throws SQLException
493   {
494     _cstmt.registerOutParameter(parameterIndex, sqlType);
495   }
496
497   /**
498    * Registers the out parameter.
499    */

500   public void registerOutParameter(int parameterIndex, int sqlType, int scale)
501     throws SQLException
502   {
503     _cstmt.registerOutParameter(parameterIndex, sqlType, scale);
504   }
505
506   /**
507    * Registers the out parameter.
508    */

509   public void registerOutParameter(int parameterIndex, int sqlType,
510                    String JavaDoc typeName)
511     throws SQLException
512   {
513     _cstmt.registerOutParameter(parameterIndex, sqlType, typeName);
514   }
515
516   /**
517    * Registers the out parameter.
518    */

519   public void registerOutParameter(String JavaDoc parameterName, int sqlType)
520     throws SQLException
521   {
522     _cstmt.registerOutParameter(parameterName, sqlType);
523   }
524
525   /**
526    * Registers the out parameter.
527    */

528   public void registerOutParameter(String JavaDoc parameterName, int sqlType, int scale)
529     throws SQLException
530   {
531     _cstmt.registerOutParameter(parameterName, sqlType, scale);
532   }
533
534   /**
535    * Registers the out parameter.
536    */

537   public void registerOutParameter(String JavaDoc parameterName, int sqlType,
538                    String JavaDoc typeName)
539     throws SQLException
540   {
541     _cstmt.registerOutParameter(parameterName, sqlType, typeName);
542   }
543
544   /**
545    * Sets the asciiStream
546    */

547   public void setAsciiStream(String JavaDoc parameterName,
548                  InputStream JavaDoc x,
549                  int length)
550     throws SQLException
551   {
552     _cstmt.setAsciiStream(parameterName, x, length);
553   }
554
555   /**
556    * Sets the bigDecimal
557    */

558   public void setBigDecimal(String JavaDoc parameterName,
559                 BigDecimal JavaDoc x)
560     throws SQLException
561   {
562     _cstmt.setBigDecimal(parameterName, x);
563   }
564
565   /**
566    * Sets the binaryStream
567    */

568   public void setBinaryStream(String JavaDoc parameterName,
569                   InputStream JavaDoc x,
570                   int length)
571     throws SQLException
572   {
573     _cstmt.setBinaryStream(parameterName, x, length);
574   }
575
576   /**
577    * Sets the boolean
578    */

579   public void setBoolean(String JavaDoc parameterName,
580              boolean x)
581     throws SQLException
582   {
583     _cstmt.setBoolean(parameterName, x);
584   }
585
586   /**
587    * Sets the byte
588    */

589   public void setByte(String JavaDoc parameterName,
590               byte x)
591     throws SQLException
592   {
593     _cstmt.setByte(parameterName, x);
594   }
595
596   /**
597    * Sets the bytes
598    */

599   public void setBytes(String JavaDoc parameterName,
600                byte []x)
601     throws SQLException
602   {
603     _cstmt.setBytes(parameterName, x);
604   }
605
606   /**
607    * Sets the character stream
608    */

609   public void setCharacterStream(String JavaDoc parameterName,
610                  Reader JavaDoc reader,
611                  int length)
612     throws SQLException
613   {
614     _cstmt.setCharacterStream(parameterName, reader, length);
615   }
616
617   /**
618    * Sets the date
619    */

620   public void setDate(String JavaDoc parameterName,
621               Date x)
622     throws SQLException
623   {
624     _cstmt.setDate(parameterName, x);
625   }
626
627   /**
628    * Sets the date
629    */

630   public void setDate(String JavaDoc parameterName,
631               Date x,
632               Calendar JavaDoc cal)
633     throws SQLException
634   {
635     _cstmt.setDate(parameterName, x, cal);
636   }
637
638   /**
639    * Sets the double
640    */

641   public void setDouble(String JavaDoc parameterName,
642             double x)
643     throws SQLException
644   {
645     _cstmt.setDouble(parameterName, x);
646   }
647
648   /**
649    * Sets the float
650    */

651   public void setFloat(String JavaDoc parameterName,
652             float x)
653     throws SQLException
654   {
655     _cstmt.setFloat(parameterName, x);
656   }
657
658   /**
659    * Sets the int
660    */

661   public void setInt(String JavaDoc parameterName,
662             int x)
663     throws SQLException
664   {
665     _cstmt.setInt(parameterName, x);
666   }
667
668   /**
669    * Sets the long
670    */

671   public void setLong(String JavaDoc parameterName,
672             long x)
673     throws SQLException
674   {
675     _cstmt.setLong(parameterName, x);
676   }
677
678   /**
679    * Sets the null
680    */

681   public void setNull(String JavaDoc parameterName,
682               int sqlType)
683     throws SQLException
684   {
685     _cstmt.setNull(parameterName, sqlType);
686   }
687
688   /**
689    * Sets the null
690    */

691   public void setNull(String JavaDoc parameterName,
692               int sqlType,
693               String JavaDoc typeName)
694     throws SQLException
695   {
696     _cstmt.setNull(parameterName, sqlType, typeName);
697   }
698
699   /**
700    * Sets the object
701    */

702   public void setObject(String JavaDoc parameterName,
703             Object JavaDoc x)
704     throws SQLException
705   {
706     _cstmt.setObject(parameterName, x);
707   }
708
709   /**
710    * Sets the object
711    */

712   public void setObject(String JavaDoc parameterName,
713             Object JavaDoc x, int type)
714     throws SQLException
715   {
716     _cstmt.setObject(parameterName, x, type);
717   }
718
719   /**
720    * Sets the object
721    */

722   public void setObject(String JavaDoc parameterName,
723             Object JavaDoc x, int type, int scale)
724     throws SQLException
725   {
726     _cstmt.setObject(parameterName, x, type, scale);
727   }
728
729   /**
730    * Sets the short
731    */

732   public void setShort(String JavaDoc parameterName,
733             short x)
734     throws SQLException
735   {
736     _cstmt.setShort(parameterName, x);
737   }
738
739   /**
740    * Sets the string
741    */

742   public void setString(String JavaDoc parameterName,
743             String JavaDoc x)
744     throws SQLException
745   {
746     _cstmt.setString(parameterName, x);
747   }
748
749   /**
750    * Sets the time
751    */

752   public void setTime(String JavaDoc parameterName,
753               Time x)
754     throws SQLException
755   {
756     _cstmt.setTime(parameterName, x);
757   }
758
759   /**
760    * Sets the time
761    */

762   public void setTime(String JavaDoc parameterName,
763               Time x,
764               Calendar JavaDoc cal)
765     throws SQLException
766   {
767     _cstmt.setTime(parameterName, x, cal);
768   }
769
770   /**
771    * Sets the timestamp
772    */

773   public void setTimestamp(String JavaDoc parameterName,
774                Timestamp x)
775     throws SQLException
776   {
777     _cstmt.setTimestamp(parameterName, x);
778   }
779
780   /**
781    * Sets the timestamp
782    */

783   public void setTimestamp(String JavaDoc parameterName,
784               Timestamp x,
785               Calendar JavaDoc cal)
786     throws SQLException
787   {
788     _cstmt.setTimestamp(parameterName, x, cal);
789   }
790
791   /**
792    * Sets the URL
793    */

794   public void setURL(String JavaDoc parameterName,
795                URL JavaDoc x)
796     throws SQLException
797   {
798     _cstmt.setURL(parameterName, x);
799   }
800
801   /**
802    * Returns true if the last out parameter was null.
803    */

804   public boolean wasNull()
805     throws SQLException
806   {
807     return _cstmt.wasNull();
808   }
809   
810   /**
811    * Closes the prepared statement.
812    */

813   public void close()
814     throws SQLException
815   {
816     synchronized (this) {
817       if (_isClosed)
818     return;
819       _isClosed = true;
820     }
821     
822     super.close();
823   }
824 }
825
Popular Tags