001: /*
002: * Copyright (c) 1998-2008 Caucho Technology -- all rights reserved
003: *
004: * This file is part of Resin(R) Open Source
005: *
006: * Each copy or derived work must preserve the copyright notice and this
007: * notice unmodified.
008: *
009: * Resin Open Source is free software; you can redistribute it and/or modify
010: * it under the terms of the GNU General Public License as published by
011: * the Free Software Foundation; either version 2 of the License, or
012: * (at your option) any later version.
013: *
014: * Resin Open Source is distributed in the hope that it will be useful,
015: * but WITHOUT ANY WARRANTY; without even the implied warranty of
016: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE, or any warranty
017: * of NON-INFRINGEMENT. See the GNU General Public License for more
018: * details.
019: *
020: * You should have received a copy of the GNU General Public License
021: * along with Resin Open Source; if not, write to the
022: * Free SoftwareFoundation, Inc.
023: * 59 Temple Place, Suite 330
024: * Boston, MA 02111-1307 USA
025: *
026: * @author Scott Ferguson
027: */
028:
029: package com.caucho.sql;
030:
031: import com.caucho.log.Log;
032: import com.caucho.util.L10N;
033:
034: import java.io.InputStream;
035: import java.io.Reader;
036: import java.math.BigDecimal;
037: import java.net.URL;
038: import java.sql.*;
039: import java.util.Calendar;
040: import java.util.Map;
041: import java.util.logging.Logger;
042:
043: /**
044: * User-view of prepared statements
045: */
046: public class UserCallableStatement extends UserPreparedStatement
047: implements CallableStatement {
048: protected final static Logger log = Log
049: .open(UserCallableStatement.class);
050: protected static L10N L = new L10N(UserCallableStatement.class);
051:
052: protected CallableStatement _cstmt;
053: private boolean _isClosed;
054:
055: UserCallableStatement(UserConnection conn, CallableStatement cStmt) {
056: super (conn, cStmt);
057:
058: _cstmt = cStmt;
059:
060: if (cStmt == null)
061: throw new NullPointerException();
062: }
063:
064: /**
065: * The array value
066: */
067: public Array getArray(int i) throws SQLException {
068: return _cstmt.getArray(i);
069: }
070:
071: /**
072: * The array value
073: */
074: public Array getArray(String name) throws SQLException {
075: return _cstmt.getArray(name);
076: }
077:
078: /**
079: * The big decimal value
080: */
081: public BigDecimal getBigDecimal(int i) throws SQLException {
082: return _cstmt.getBigDecimal(i);
083: }
084:
085: /**
086: * The bigDecimal value
087: */
088: public BigDecimal getBigDecimal(String name) throws SQLException {
089: return _cstmt.getBigDecimal(name);
090: }
091:
092: /**
093: * The big decimal value
094: */
095: public BigDecimal getBigDecimal(int i, int scale)
096: throws SQLException {
097: return _cstmt.getBigDecimal(i, scale);
098: }
099:
100: /**
101: * The blob value
102: */
103: public Blob getBlob(int i) throws SQLException {
104: return _cstmt.getBlob(i);
105: }
106:
107: /**
108: * The blob value
109: */
110: public Blob getBlob(String name) throws SQLException {
111: return _cstmt.getBlob(name);
112: }
113:
114: /**
115: * The boolean value
116: */
117: public boolean getBoolean(int i) throws SQLException {
118: return _cstmt.getBoolean(i);
119: }
120:
121: /**
122: * The boolean value
123: */
124: public boolean getBoolean(String name) throws SQLException {
125: return _cstmt.getBoolean(name);
126: }
127:
128: /**
129: * The byte value
130: */
131: public byte getByte(int i) throws SQLException {
132: return _cstmt.getByte(i);
133: }
134:
135: /**
136: * The byte value
137: */
138: public byte getByte(String name) throws SQLException {
139: return _cstmt.getByte(name);
140: }
141:
142: /**
143: * The bytes value
144: */
145: public byte[] getBytes(int i) throws SQLException {
146: return _cstmt.getBytes(i);
147: }
148:
149: /**
150: * The bytes value
151: */
152: public byte[] getBytes(String name) throws SQLException {
153: return _cstmt.getBytes(name);
154: }
155:
156: /**
157: * The clob value
158: */
159: public Clob getClob(int i) throws SQLException {
160: return _cstmt.getClob(i);
161: }
162:
163: /**
164: * The clob value
165: */
166: public Clob getClob(String name) throws SQLException {
167: return _cstmt.getClob(name);
168: }
169:
170: /**
171: * The date value
172: */
173: public Date getDate(int i) throws SQLException {
174: return _cstmt.getDate(i);
175: }
176:
177: /**
178: * The date value
179: */
180: public Date getDate(String name) throws SQLException {
181: return _cstmt.getDate(name);
182: }
183:
184: /**
185: * The date value
186: */
187: public Date getDate(int i, Calendar cal) throws SQLException {
188: return _cstmt.getDate(i, cal);
189: }
190:
191: /**
192: * The date value
193: */
194: public Date getDate(String name, Calendar cal) throws SQLException {
195: return _cstmt.getDate(name);
196: }
197:
198: /**
199: * The double value
200: */
201: public double getDouble(int i) throws SQLException {
202: return _cstmt.getDouble(i);
203: }
204:
205: /**
206: * The double value
207: */
208: public double getDouble(String name) throws SQLException {
209: return _cstmt.getDouble(name);
210: }
211:
212: /**
213: * The float value
214: */
215: public float getFloat(int i) throws SQLException {
216: return _cstmt.getFloat(i);
217: }
218:
219: /**
220: * The float value
221: */
222: public float getFloat(String name) throws SQLException {
223: return _cstmt.getFloat(name);
224: }
225:
226: /**
227: * The int value
228: */
229: public int getInt(int i) throws SQLException {
230: return _cstmt.getInt(i);
231: }
232:
233: /**
234: * The int value
235: */
236: public int getInt(String name) throws SQLException {
237: return _cstmt.getInt(name);
238: }
239:
240: /**
241: * The long value
242: */
243: public long getLong(int i) throws SQLException {
244: return _cstmt.getLong(i);
245: }
246:
247: /**
248: * The long value
249: */
250: public long getLong(String name) throws SQLException {
251: return _cstmt.getLong(name);
252: }
253:
254: /**
255: * The object value
256: */
257: public Object getObject(int i) throws SQLException {
258: return _cstmt.getObject(i);
259: }
260:
261: /**
262: * The object value
263: */
264: public Object getObject(String name) throws SQLException {
265: return _cstmt.getObject(name);
266: }
267:
268: /**
269: * The object value
270: */
271: public Object getObject(int i, Map<String, Class<?>> map)
272: throws SQLException {
273: return _cstmt.getObject(i);
274: }
275:
276: /**
277: * The object value
278: */
279: public Object getObject(String name, Map<String, Class<?>> map)
280: throws SQLException {
281: return _cstmt.getObject(name);
282: }
283:
284: /**
285: * The ref value
286: */
287: public Ref getRef(int i) throws SQLException {
288: return _cstmt.getRef(i);
289: }
290:
291: /**
292: * The ref value
293: */
294: public Ref getRef(String name) throws SQLException {
295: return _cstmt.getRef(name);
296: }
297:
298: /**
299: * The short value
300: */
301: public short getShort(int i) throws SQLException {
302: return _cstmt.getShort(i);
303: }
304:
305: /**
306: * The short value
307: */
308: public short getShort(String name) throws SQLException {
309: return _cstmt.getShort(name);
310: }
311:
312: /**
313: * The string value
314: */
315: public String getString(int i) throws SQLException {
316: return _cstmt.getString(i);
317: }
318:
319: /**
320: * The string value
321: */
322: public String getString(String name) throws SQLException {
323: return _cstmt.getString(name);
324: }
325:
326: /**
327: * The time value
328: */
329: public Time getTime(int i) throws SQLException {
330: return _cstmt.getTime(i);
331: }
332:
333: /**
334: * The time value
335: */
336: public Time getTime(String name) throws SQLException {
337: return _cstmt.getTime(name);
338: }
339:
340: /**
341: * The time value
342: */
343: public Time getTime(int i, Calendar cal) throws SQLException {
344: return _cstmt.getTime(i, cal);
345: }
346:
347: /**
348: * The time value
349: */
350: public Time getTime(String name, Calendar cal) throws SQLException {
351: return _cstmt.getTime(name);
352: }
353:
354: /**
355: * The timestamp value
356: */
357: public Timestamp getTimestamp(int i) throws SQLException {
358: return _cstmt.getTimestamp(i);
359: }
360:
361: /**
362: * The timestamp value
363: */
364: public Timestamp getTimestamp(String name) throws SQLException {
365: return _cstmt.getTimestamp(name);
366: }
367:
368: /**
369: * The timestamp value
370: */
371: public Timestamp getTimestamp(int i, Calendar cal)
372: throws SQLException {
373: return _cstmt.getTimestamp(i, cal);
374: }
375:
376: /**
377: * The timestamp value
378: */
379: public Timestamp getTimestamp(String name, Calendar cal)
380: throws SQLException {
381: return _cstmt.getTimestamp(name);
382: }
383:
384: /**
385: * The URL value
386: */
387: public URL getURL(int i) throws SQLException {
388: return _cstmt.getURL(i);
389: }
390:
391: /**
392: * The URL value
393: */
394: public URL getURL(String name) throws SQLException {
395: return _cstmt.getURL(name);
396: }
397:
398: /**
399: * Registers the out parameter.
400: */
401: public void registerOutParameter(int parameterIndex, int sqlType)
402: throws SQLException {
403: _cstmt.registerOutParameter(parameterIndex, sqlType);
404: }
405:
406: /**
407: * Registers the out parameter.
408: */
409: public void registerOutParameter(int parameterIndex, int sqlType,
410: int scale) throws SQLException {
411: _cstmt.registerOutParameter(parameterIndex, sqlType, scale);
412: }
413:
414: /**
415: * Registers the out parameter.
416: */
417: public void registerOutParameter(int parameterIndex, int sqlType,
418: String typeName) throws SQLException {
419: _cstmt.registerOutParameter(parameterIndex, sqlType, typeName);
420: }
421:
422: /**
423: * Registers the out parameter.
424: */
425: public void registerOutParameter(String parameterName, int sqlType)
426: throws SQLException {
427: _cstmt.registerOutParameter(parameterName, sqlType);
428: }
429:
430: /**
431: * Registers the out parameter.
432: */
433: public void registerOutParameter(String parameterName, int sqlType,
434: int scale) throws SQLException {
435: _cstmt.registerOutParameter(parameterName, sqlType, scale);
436: }
437:
438: /**
439: * Registers the out parameter.
440: */
441: public void registerOutParameter(String parameterName, int sqlType,
442: String typeName) throws SQLException {
443: _cstmt.registerOutParameter(parameterName, sqlType, typeName);
444: }
445:
446: /**
447: * Sets the asciiStream
448: */
449: public void setAsciiStream(String parameterName, InputStream x,
450: int length) throws SQLException {
451: _cstmt.setAsciiStream(parameterName, x, length);
452: }
453:
454: /**
455: * Sets the bigDecimal
456: */
457: public void setBigDecimal(String parameterName, BigDecimal x)
458: throws SQLException {
459: _cstmt.setBigDecimal(parameterName, x);
460: }
461:
462: /**
463: * Sets the binaryStream
464: */
465: public void setBinaryStream(String parameterName, InputStream x,
466: int length) throws SQLException {
467: _cstmt.setBinaryStream(parameterName, x, length);
468: }
469:
470: /**
471: * Sets the boolean
472: */
473: public void setBoolean(String parameterName, boolean x)
474: throws SQLException {
475: _cstmt.setBoolean(parameterName, x);
476: }
477:
478: /**
479: * Sets the byte
480: */
481: public void setByte(String parameterName, byte x)
482: throws SQLException {
483: _cstmt.setByte(parameterName, x);
484: }
485:
486: /**
487: * Sets the bytes
488: */
489: public void setBytes(String parameterName, byte[] x)
490: throws SQLException {
491: _cstmt.setBytes(parameterName, x);
492: }
493:
494: /**
495: * Sets the character stream
496: */
497: public void setCharacterStream(String parameterName, Reader reader,
498: int length) throws SQLException {
499: _cstmt.setCharacterStream(parameterName, reader, length);
500: }
501:
502: /**
503: * Sets the date
504: */
505: public void setDate(String parameterName, Date x)
506: throws SQLException {
507: _cstmt.setDate(parameterName, x);
508: }
509:
510: /**
511: * Sets the date
512: */
513: public void setDate(String parameterName, Date x, Calendar cal)
514: throws SQLException {
515: _cstmt.setDate(parameterName, x, cal);
516: }
517:
518: /**
519: * Sets the double
520: */
521: public void setDouble(String parameterName, double x)
522: throws SQLException {
523: _cstmt.setDouble(parameterName, x);
524: }
525:
526: /**
527: * Sets the float
528: */
529: public void setFloat(String parameterName, float x)
530: throws SQLException {
531: _cstmt.setFloat(parameterName, x);
532: }
533:
534: /**
535: * Sets the int
536: */
537: public void setInt(String parameterName, int x) throws SQLException {
538: _cstmt.setInt(parameterName, x);
539: }
540:
541: /**
542: * Sets the long
543: */
544: public void setLong(String parameterName, long x)
545: throws SQLException {
546: _cstmt.setLong(parameterName, x);
547: }
548:
549: /**
550: * Sets the null
551: */
552: public void setNull(String parameterName, int sqlType)
553: throws SQLException {
554: _cstmt.setNull(parameterName, sqlType);
555: }
556:
557: /**
558: * Sets the null
559: */
560: public void setNull(String parameterName, int sqlType,
561: String typeName) throws SQLException {
562: _cstmt.setNull(parameterName, sqlType, typeName);
563: }
564:
565: /**
566: * Sets the object
567: */
568: public void setObject(String parameterName, Object x)
569: throws SQLException {
570: _cstmt.setObject(parameterName, x);
571: }
572:
573: /**
574: * Sets the object
575: */
576: public void setObject(String parameterName, Object x, int type)
577: throws SQLException {
578: _cstmt.setObject(parameterName, x, type);
579: }
580:
581: /**
582: * Sets the object
583: */
584: public void setObject(String parameterName, Object x, int type,
585: int scale) throws SQLException {
586: _cstmt.setObject(parameterName, x, type, scale);
587: }
588:
589: /**
590: * Sets the short
591: */
592: public void setShort(String parameterName, short x)
593: throws SQLException {
594: _cstmt.setShort(parameterName, x);
595: }
596:
597: /**
598: * Sets the string
599: */
600: public void setString(String parameterName, String x)
601: throws SQLException {
602: _cstmt.setString(parameterName, x);
603: }
604:
605: /**
606: * Sets the time
607: */
608: public void setTime(String parameterName, Time x)
609: throws SQLException {
610: _cstmt.setTime(parameterName, x);
611: }
612:
613: /**
614: * Sets the time
615: */
616: public void setTime(String parameterName, Time x, Calendar cal)
617: throws SQLException {
618: _cstmt.setTime(parameterName, x, cal);
619: }
620:
621: /**
622: * Sets the timestamp
623: */
624: public void setTimestamp(String parameterName, Timestamp x)
625: throws SQLException {
626: _cstmt.setTimestamp(parameterName, x);
627: }
628:
629: /**
630: * Sets the timestamp
631: */
632: public void setTimestamp(String parameterName, Timestamp x,
633: Calendar cal) throws SQLException {
634: _cstmt.setTimestamp(parameterName, x, cal);
635: }
636:
637: /**
638: * Sets the URL
639: */
640: public void setURL(String parameterName, URL x) throws SQLException {
641: _cstmt.setURL(parameterName, x);
642: }
643:
644: /**
645: * Returns true if the last out parameter was null.
646: */
647: public boolean wasNull() throws SQLException {
648: return _cstmt.wasNull();
649: }
650:
651: /**
652: * Closes the prepared statement.
653: */
654: public void close() throws SQLException {
655: synchronized (this ) {
656: if (_isClosed)
657: return;
658: _isClosed = true;
659: }
660:
661: super .close();
662: }
663:
664: public boolean isClosed() throws SQLException {
665: throw new UnsupportedOperationException("Not supported yet.");
666: }
667:
668: public void setPoolable(boolean poolable) throws SQLException {
669: throw new UnsupportedOperationException("Not supported yet.");
670: }
671:
672: public boolean isPoolable() throws SQLException {
673: throw new UnsupportedOperationException("Not supported yet.");
674: }
675:
676: public <T> T unwrap(Class<T> iface) throws SQLException {
677: throw new UnsupportedOperationException("Not supported yet.");
678: }
679:
680: public boolean isWrapperFor(Class<?> iface) throws SQLException {
681: throw new UnsupportedOperationException("Not supported yet.");
682: }
683:
684: public void setRowId(int parameterIndex, RowId x)
685: throws SQLException {
686: throw new UnsupportedOperationException("Not supported yet.");
687: }
688:
689: public void setNString(int parameterIndex, String value)
690: throws SQLException {
691: throw new UnsupportedOperationException("Not supported yet.");
692: }
693:
694: public void setNCharacterStream(int parameterIndex, Reader value,
695: long length) throws SQLException {
696: throw new UnsupportedOperationException("Not supported yet.");
697: }
698:
699: public void setNClob(int parameterIndex, NClob value)
700: throws SQLException {
701: throw new UnsupportedOperationException("Not supported yet.");
702: }
703:
704: public void setClob(int parameterIndex, Reader reader, long length)
705: throws SQLException {
706: throw new UnsupportedOperationException("Not supported yet.");
707: }
708:
709: public void setBlob(int parameterIndex, InputStream inputStream,
710: long length) throws SQLException {
711: throw new UnsupportedOperationException("Not supported yet.");
712: }
713:
714: public void setNClob(int parameterIndex, Reader reader, long length)
715: throws SQLException {
716: throw new UnsupportedOperationException("Not supported yet.");
717: }
718:
719: public void setSQLXML(int parameterIndex, SQLXML xmlObject)
720: throws SQLException {
721: throw new UnsupportedOperationException("Not supported yet.");
722: }
723:
724: public void setAsciiStream(int parameterIndex, InputStream x,
725: long length) throws SQLException {
726: throw new UnsupportedOperationException("Not supported yet.");
727: }
728:
729: public void setBinaryStream(int parameterIndex, InputStream x,
730: long length) throws SQLException {
731: throw new UnsupportedOperationException("Not supported yet.");
732: }
733:
734: public void setCharacterStream(int parameterIndex, Reader reader,
735: long length) throws SQLException {
736: throw new UnsupportedOperationException("Not supported yet.");
737: }
738:
739: public void setAsciiStream(int parameterIndex, InputStream x)
740: throws SQLException {
741: throw new UnsupportedOperationException("Not supported yet.");
742: }
743:
744: public void setBinaryStream(int parameterIndex, InputStream x)
745: throws SQLException {
746: throw new UnsupportedOperationException("Not supported yet.");
747: }
748:
749: public void setCharacterStream(int parameterIndex, Reader reader)
750: throws SQLException {
751: throw new UnsupportedOperationException("Not supported yet.");
752: }
753:
754: public void setNCharacterStream(int parameterIndex, Reader value)
755: throws SQLException {
756: throw new UnsupportedOperationException("Not supported yet.");
757: }
758:
759: public void setClob(int parameterIndex, Reader reader)
760: throws SQLException {
761: throw new UnsupportedOperationException("Not supported yet.");
762: }
763:
764: public void setBlob(int parameterIndex, InputStream inputStream)
765: throws SQLException {
766: throw new UnsupportedOperationException("Not supported yet.");
767: }
768:
769: public void setNClob(int parameterIndex, Reader reader)
770: throws SQLException {
771: throw new UnsupportedOperationException("Not supported yet.");
772: }
773:
774: public RowId getRowId(int parameterIndex) throws SQLException {
775: throw new UnsupportedOperationException("Not supported yet.");
776: }
777:
778: public RowId getRowId(String parameterName) throws SQLException {
779: throw new UnsupportedOperationException("Not supported yet.");
780: }
781:
782: public void setRowId(String parameterName, RowId x)
783: throws SQLException {
784: throw new UnsupportedOperationException("Not supported yet.");
785: }
786:
787: public void setNString(String parameterName, String value)
788: throws SQLException {
789: throw new UnsupportedOperationException("Not supported yet.");
790: }
791:
792: public void setNCharacterStream(String parameterName, Reader value,
793: long length) throws SQLException {
794: throw new UnsupportedOperationException("Not supported yet.");
795: }
796:
797: public void setNClob(String parameterName, NClob value)
798: throws SQLException {
799: throw new UnsupportedOperationException("Not supported yet.");
800: }
801:
802: public void setClob(String parameterName, Reader reader, long length)
803: throws SQLException {
804: throw new UnsupportedOperationException("Not supported yet.");
805: }
806:
807: public void setBlob(String parameterName, InputStream inputStream,
808: long length) throws SQLException {
809: throw new UnsupportedOperationException("Not supported yet.");
810: }
811:
812: public void setNClob(String parameterName, Reader reader,
813: long length) throws SQLException {
814: throw new UnsupportedOperationException("Not supported yet.");
815: }
816:
817: public NClob getNClob(int parameterIndex) throws SQLException {
818: throw new UnsupportedOperationException("Not supported yet.");
819: }
820:
821: public NClob getNClob(String parameterName) throws SQLException {
822: throw new UnsupportedOperationException("Not supported yet.");
823: }
824:
825: public void setSQLXML(String parameterName, SQLXML xmlObject)
826: throws SQLException {
827: throw new UnsupportedOperationException("Not supported yet.");
828: }
829:
830: public SQLXML getSQLXML(int parameterIndex) throws SQLException {
831: throw new UnsupportedOperationException("Not supported yet.");
832: }
833:
834: public SQLXML getSQLXML(String parameterName) throws SQLException {
835: throw new UnsupportedOperationException("Not supported yet.");
836: }
837:
838: public String getNString(int parameterIndex) throws SQLException {
839: throw new UnsupportedOperationException("Not supported yet.");
840: }
841:
842: public String getNString(String parameterName) throws SQLException {
843: throw new UnsupportedOperationException("Not supported yet.");
844: }
845:
846: public Reader getNCharacterStream(int parameterIndex)
847: throws SQLException {
848: throw new UnsupportedOperationException("Not supported yet.");
849: }
850:
851: public Reader getNCharacterStream(String parameterName)
852: throws SQLException {
853: throw new UnsupportedOperationException("Not supported yet.");
854: }
855:
856: public Reader getCharacterStream(int parameterIndex)
857: throws SQLException {
858: throw new UnsupportedOperationException("Not supported yet.");
859: }
860:
861: public Reader getCharacterStream(String parameterName)
862: throws SQLException {
863: throw new UnsupportedOperationException("Not supported yet.");
864: }
865:
866: public void setBlob(String parameterName, Blob x)
867: throws SQLException {
868: throw new UnsupportedOperationException("Not supported yet.");
869: }
870:
871: public void setClob(String parameterName, Clob x)
872: throws SQLException {
873: throw new UnsupportedOperationException("Not supported yet.");
874: }
875:
876: public void setAsciiStream(String parameterName, InputStream x,
877: long length) throws SQLException {
878: throw new UnsupportedOperationException("Not supported yet.");
879: }
880:
881: public void setBinaryStream(String parameterName, InputStream x,
882: long length) throws SQLException {
883: throw new UnsupportedOperationException("Not supported yet.");
884: }
885:
886: public void setCharacterStream(String parameterName, Reader reader,
887: long length) throws SQLException {
888: throw new UnsupportedOperationException("Not supported yet.");
889: }
890:
891: public void setAsciiStream(String parameterName, InputStream x)
892: throws SQLException {
893: throw new UnsupportedOperationException("Not supported yet.");
894: }
895:
896: public void setBinaryStream(String parameterName, InputStream x)
897: throws SQLException {
898: throw new UnsupportedOperationException("Not supported yet.");
899: }
900:
901: public void setCharacterStream(String parameterName, Reader reader)
902: throws SQLException {
903: throw new UnsupportedOperationException("Not supported yet.");
904: }
905:
906: public void setNCharacterStream(String parameterName, Reader value)
907: throws SQLException {
908: throw new UnsupportedOperationException("Not supported yet.");
909: }
910:
911: public void setClob(String parameterName, Reader reader)
912: throws SQLException {
913: throw new UnsupportedOperationException("Not supported yet.");
914: }
915:
916: public void setBlob(String parameterName, InputStream inputStream)
917: throws SQLException {
918: throw new UnsupportedOperationException("Not supported yet.");
919: }
920:
921: public void setNClob(String parameterName, Reader reader)
922: throws SQLException {
923: throw new UnsupportedOperationException("Not supported yet.");
924: }
925: }
|