001: /*
002: * Copyright 2004 Clinton Begin
003: *
004: * Licensed under the Apache License, Version 2.0 (the "License");
005: * you may not use this file except in compliance with the License.
006: * You may obtain a copy of the License at
007: *
008: * http://www.apache.org/licenses/LICENSE-2.0
009: *
010: * Unless required by applicable law or agreed to in writing, software
011: * distributed under the License is distributed on an "AS IS" BASIS,
012: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
013: * See the License for the specific language governing permissions and
014: * limitations under the License.
015: */
016: package com.ibatis.sqlmap.engine.type;
017:
018: import java.io.InputStream;
019: import java.io.Reader;
020: import java.math.BigDecimal;
021: import java.net.URL;
022: import java.sql.*;
023: import java.util.Calendar;
024: import java.util.Map;
025:
026: /**
027: * A way to make a CallableStatement look like a ResultSet
028: */
029: public class CallableStatementResultSet implements ResultSet {
030:
031: private CallableStatement cs;
032:
033: /**
034: * Constructor to stretch a ResultSet interface over a CallableStatement
035: *
036: * @param cs - the CallableStatement
037: */
038: public CallableStatementResultSet(CallableStatement cs) {
039: this .cs = cs;
040: }
041:
042: public boolean absolute(int row) throws SQLException {
043: throw new UnsupportedOperationException(
044: "CallableStatement does not support this method.");
045: }
046:
047: public void afterLast() throws SQLException {
048: throw new UnsupportedOperationException(
049: "CallableStatement does not support this method.");
050: }
051:
052: public void beforeFirst() throws SQLException {
053: throw new UnsupportedOperationException(
054: "CallableStatement does not support this method.");
055: }
056:
057: public void cancelRowUpdates() throws SQLException {
058: throw new UnsupportedOperationException(
059: "CallableStatement does not support this method.");
060: }
061:
062: public void clearWarnings() throws SQLException {
063: throw new UnsupportedOperationException(
064: "CallableStatement does not support this method.");
065: }
066:
067: public void close() throws SQLException {
068: throw new UnsupportedOperationException(
069: "CallableStatement does not support this method.");
070: }
071:
072: public void deleteRow() throws SQLException {
073: throw new UnsupportedOperationException(
074: "CallableStatement does not support this method.");
075: }
076:
077: public int findColumn(String columnName) throws SQLException {
078: throw new UnsupportedOperationException(
079: "CallableStatement does not support this method.");
080: }
081:
082: public boolean first() throws SQLException {
083: throw new UnsupportedOperationException(
084: "CallableStatement does not support this method.");
085: }
086:
087: public Array getArray(String colName) throws SQLException {
088: return cs.getArray(colName);
089: }
090:
091: public Array getArray(int i) throws SQLException {
092: return cs.getArray(i);
093: }
094:
095: public InputStream getAsciiStream(int columnIndex)
096: throws SQLException {
097: throw new UnsupportedOperationException(
098: "CallableStatement does not support this method.");
099: }
100:
101: public InputStream getAsciiStream(String columnName)
102: throws SQLException {
103: throw new UnsupportedOperationException(
104: "CallableStatement does not support this method.");
105: }
106:
107: public BigDecimal getBigDecimal(int columnIndex)
108: throws SQLException {
109: return cs.getBigDecimal(columnIndex);
110: }
111:
112: public BigDecimal getBigDecimal(int columnIndex, int scale)
113: throws SQLException {
114: throw new UnsupportedOperationException(
115: "CallableStatement does not support this method.");
116: }
117:
118: public BigDecimal getBigDecimal(String columnName)
119: throws SQLException {
120: return cs.getBigDecimal(columnName);
121: }
122:
123: public BigDecimal getBigDecimal(String columnName, int scale)
124: throws SQLException {
125: throw new UnsupportedOperationException(
126: "CallableStatement does not support this method.");
127: }
128:
129: public InputStream getBinaryStream(int columnIndex)
130: throws SQLException {
131: throw new UnsupportedOperationException(
132: "CallableStatement does not support this method.");
133: }
134:
135: public InputStream getBinaryStream(String columnName)
136: throws SQLException {
137: throw new UnsupportedOperationException(
138: "CallableStatement does not support this method.");
139: }
140:
141: public Blob getBlob(String colName) throws SQLException {
142: return cs.getBlob(colName);
143: }
144:
145: public Blob getBlob(int i) throws SQLException {
146: return cs.getBlob(i);
147: }
148:
149: public boolean getBoolean(int columnIndex) throws SQLException {
150: return cs.getBoolean(columnIndex);
151: }
152:
153: public boolean getBoolean(String columnName) throws SQLException {
154: return cs.getBoolean(columnName);
155: }
156:
157: public byte getByte(int columnIndex) throws SQLException {
158: return cs.getByte(columnIndex);
159: }
160:
161: public byte getByte(String columnName) throws SQLException {
162: return cs.getByte(columnName);
163: }
164:
165: public byte[] getBytes(int columnIndex) throws SQLException {
166: return cs.getBytes(columnIndex);
167: }
168:
169: public byte[] getBytes(String columnName) throws SQLException {
170: return cs.getBytes(columnName);
171: }
172:
173: public Reader getCharacterStream(int columnIndex)
174: throws SQLException {
175: throw new UnsupportedOperationException(
176: "CallableStatement does not support this method.");
177: }
178:
179: public Reader getCharacterStream(String columnName)
180: throws SQLException {
181: throw new UnsupportedOperationException(
182: "CallableStatement does not support this method.");
183: }
184:
185: public Clob getClob(String colName) throws SQLException {
186: return cs.getClob(colName);
187: }
188:
189: public Clob getClob(int i) throws SQLException {
190: return cs.getClob(i);
191: }
192:
193: public int getConcurrency() throws SQLException {
194: throw new UnsupportedOperationException(
195: "CallableStatement does not support this method.");
196: }
197:
198: public String getCursorName() throws SQLException {
199: throw new UnsupportedOperationException(
200: "CallableStatement does not support this method.");
201: }
202:
203: public Date getDate(int columnIndex) throws SQLException {
204: return cs.getDate(columnIndex);
205: }
206:
207: public Date getDate(int columnIndex, Calendar cal)
208: throws SQLException {
209: return cs.getDate(columnIndex, cal);
210: }
211:
212: public Date getDate(String columnName) throws SQLException {
213: return cs.getDate(columnName);
214: }
215:
216: public Date getDate(String columnName, Calendar cal)
217: throws SQLException {
218: return cs.getDate(columnName, cal);
219: }
220:
221: public double getDouble(int columnIndex) throws SQLException {
222: return cs.getDouble(columnIndex);
223: }
224:
225: public double getDouble(String columnName) throws SQLException {
226: return cs.getDouble(columnName);
227: }
228:
229: public int getFetchDirection() throws SQLException {
230: throw new UnsupportedOperationException(
231: "CallableStatement does not support this method.");
232: }
233:
234: public int getFetchSize() throws SQLException {
235: throw new UnsupportedOperationException(
236: "CallableStatement does not support this method.");
237: }
238:
239: public float getFloat(int columnIndex) throws SQLException {
240: return cs.getFloat(columnIndex);
241: }
242:
243: public float getFloat(String columnName) throws SQLException {
244: return cs.getFloat(columnName);
245: }
246:
247: public int getInt(int columnIndex) throws SQLException {
248: return cs.getInt(columnIndex);
249: }
250:
251: public int getInt(String columnName) throws SQLException {
252: return cs.getInt(columnName);
253: }
254:
255: public long getLong(int columnIndex) throws SQLException {
256: return cs.getLong(columnIndex);
257: }
258:
259: public long getLong(String columnName) throws SQLException {
260: return cs.getLong(columnName);
261: }
262:
263: public ResultSetMetaData getMetaData() throws SQLException {
264: throw new UnsupportedOperationException(
265: "CallableStatement does not support this method.");
266: }
267:
268: public Object getObject(String colName, Map map)
269: throws SQLException {
270: return cs.getObject(colName, map);
271: }
272:
273: public Object getObject(int columnIndex) throws SQLException {
274: return cs.getObject(columnIndex);
275: }
276:
277: public Object getObject(String columnName) throws SQLException {
278: return cs.getObject(columnName);
279: }
280:
281: public Object getObject(int i, Map map) throws SQLException {
282: return cs.getObject(i, map);
283: }
284:
285: public Ref getRef(String colName) throws SQLException {
286: return cs.getRef(colName);
287: }
288:
289: public Ref getRef(int i) throws SQLException {
290: return cs.getRef(i);
291: }
292:
293: public int getRow() throws SQLException {
294: throw new UnsupportedOperationException(
295: "CallableStatement does not support this method.");
296: }
297:
298: public short getShort(int columnIndex) throws SQLException {
299: return cs.getShort(columnIndex);
300: }
301:
302: public short getShort(String columnName) throws SQLException {
303: return cs.getShort(columnName);
304: }
305:
306: public Statement getStatement() throws SQLException {
307: throw new UnsupportedOperationException(
308: "CallableStatement does not support this method.");
309: }
310:
311: public String getString(int columnIndex) throws SQLException {
312: return cs.getString(columnIndex);
313: }
314:
315: public String getString(String columnName) throws SQLException {
316: return cs.getString(columnName);
317: }
318:
319: public Time getTime(int columnIndex) throws SQLException {
320: return cs.getTime(columnIndex);
321: }
322:
323: public Time getTime(int columnIndex, Calendar cal)
324: throws SQLException {
325: return cs.getTime(columnIndex, cal);
326: }
327:
328: public Time getTime(String columnName) throws SQLException {
329: return cs.getTime(columnName);
330: }
331:
332: public Time getTime(String columnName, Calendar cal)
333: throws SQLException {
334: return cs.getTime(columnName, cal);
335: }
336:
337: public Timestamp getTimestamp(int columnIndex) throws SQLException {
338: return cs.getTimestamp(columnIndex);
339: }
340:
341: public Timestamp getTimestamp(int columnIndex, Calendar cal)
342: throws SQLException {
343: return cs.getTimestamp(columnIndex, cal);
344: }
345:
346: public Timestamp getTimestamp(String columnName)
347: throws SQLException {
348: return cs.getTimestamp(columnName);
349: }
350:
351: public Timestamp getTimestamp(String columnName, Calendar cal)
352: throws SQLException {
353: return cs.getTimestamp(columnName, cal);
354: }
355:
356: public int getType() throws SQLException {
357: throw new UnsupportedOperationException(
358: "CallableStatement does not support this method.");
359: }
360:
361: public InputStream getUnicodeStream(int columnIndex)
362: throws SQLException {
363: throw new UnsupportedOperationException(
364: "CallableStatement does not support this method.");
365: }
366:
367: public InputStream getUnicodeStream(String columnName)
368: throws SQLException {
369: throw new UnsupportedOperationException(
370: "CallableStatement does not support this method.");
371: }
372:
373: public URL getURL(int columnIndex) throws SQLException {
374: return cs.getURL(columnIndex);
375: }
376:
377: public URL getURL(String columnName) throws SQLException {
378: return cs.getURL(columnName);
379: }
380:
381: public SQLWarning getWarnings() throws SQLException {
382: throw new UnsupportedOperationException(
383: "CallableStatement does not support this method.");
384: }
385:
386: public void insertRow() throws SQLException {
387: throw new UnsupportedOperationException(
388: "CallableStatement does not support this method.");
389: }
390:
391: public boolean isAfterLast() throws SQLException {
392: throw new UnsupportedOperationException(
393: "CallableStatement does not support this method.");
394: }
395:
396: public boolean isBeforeFirst() throws SQLException {
397: throw new UnsupportedOperationException(
398: "CallableStatement does not support this method.");
399: }
400:
401: public boolean isFirst() throws SQLException {
402: throw new UnsupportedOperationException(
403: "CallableStatement does not support this method.");
404: }
405:
406: public boolean isLast() throws SQLException {
407: throw new UnsupportedOperationException(
408: "CallableStatement does not support this method.");
409: }
410:
411: public boolean last() throws SQLException {
412: throw new UnsupportedOperationException(
413: "CallableStatement does not support this method.");
414: }
415:
416: public void moveToCurrentRow() throws SQLException {
417: throw new UnsupportedOperationException(
418: "CallableStatement does not support this method.");
419: }
420:
421: public void moveToInsertRow() throws SQLException {
422: throw new UnsupportedOperationException(
423: "CallableStatement does not support this method.");
424: }
425:
426: public boolean next() throws SQLException {
427: throw new UnsupportedOperationException(
428: "CallableStatement does not support this method.");
429: }
430:
431: public boolean previous() throws SQLException {
432: throw new UnsupportedOperationException(
433: "CallableStatement does not support this method.");
434: }
435:
436: public void refreshRow() throws SQLException {
437: throw new UnsupportedOperationException(
438: "CallableStatement does not support this method.");
439: }
440:
441: public boolean relative(int rows) throws SQLException {
442: throw new UnsupportedOperationException(
443: "CallableStatement does not support this method.");
444: }
445:
446: public boolean rowDeleted() throws SQLException {
447: throw new UnsupportedOperationException(
448: "CallableStatement does not support this method.");
449: }
450:
451: public boolean rowInserted() throws SQLException {
452: throw new UnsupportedOperationException(
453: "CallableStatement does not support this method.");
454: }
455:
456: public boolean rowUpdated() throws SQLException {
457: throw new UnsupportedOperationException(
458: "CallableStatement does not support this method.");
459: }
460:
461: public void setFetchDirection(int direction) throws SQLException {
462: throw new UnsupportedOperationException(
463: "CallableStatement does not support this method.");
464: }
465:
466: public void setFetchSize(int rows) throws SQLException {
467: throw new UnsupportedOperationException(
468: "CallableStatement does not support this method.");
469: }
470:
471: public void updateArray(int columnIndex, Array x)
472: throws SQLException {
473: throw new UnsupportedOperationException(
474: "CallableStatement does not support this method.");
475: }
476:
477: public void updateArray(String columnName, Array x)
478: throws SQLException {
479: throw new UnsupportedOperationException(
480: "CallableStatement does not support this method.");
481: }
482:
483: public void updateAsciiStream(int columnIndex, InputStream x,
484: int length) throws SQLException {
485: throw new UnsupportedOperationException(
486: "CallableStatement does not support this method.");
487: }
488:
489: public void updateAsciiStream(String columnName, InputStream x,
490: int length) throws SQLException {
491: throw new UnsupportedOperationException(
492: "CallableStatement does not support this method.");
493: }
494:
495: public void updateBigDecimal(int columnIndex, BigDecimal x)
496: throws SQLException {
497: throw new UnsupportedOperationException(
498: "CallableStatement does not support this method.");
499: }
500:
501: public void updateBigDecimal(String columnName, BigDecimal x)
502: throws SQLException {
503: throw new UnsupportedOperationException(
504: "CallableStatement does not support this method.");
505: }
506:
507: public void updateBinaryStream(int columnIndex, InputStream x,
508: int length) throws SQLException {
509: throw new UnsupportedOperationException(
510: "CallableStatement does not support this method.");
511: }
512:
513: public void updateBinaryStream(String columnName, InputStream x,
514: int length) throws SQLException {
515: throw new UnsupportedOperationException(
516: "CallableStatement does not support this method.");
517: }
518:
519: public void updateBlob(int columnIndex, Blob x) throws SQLException {
520: throw new UnsupportedOperationException(
521: "CallableStatement does not support this method.");
522: }
523:
524: public void updateBlob(String columnName, Blob x)
525: throws SQLException {
526: throw new UnsupportedOperationException(
527: "CallableStatement does not support this method.");
528: }
529:
530: public void updateBoolean(int columnIndex, boolean x)
531: throws SQLException {
532: throw new UnsupportedOperationException(
533: "CallableStatement does not support this method.");
534: }
535:
536: public void updateBoolean(String columnName, boolean x)
537: throws SQLException {
538: throw new UnsupportedOperationException(
539: "CallableStatement does not support this method.");
540: }
541:
542: public void updateByte(int columnIndex, byte x) throws SQLException {
543: throw new UnsupportedOperationException(
544: "CallableStatement does not support this method.");
545: }
546:
547: public void updateByte(String columnName, byte x)
548: throws SQLException {
549: throw new UnsupportedOperationException(
550: "CallableStatement does not support this method.");
551: }
552:
553: public void updateBytes(int columnIndex, byte x[])
554: throws SQLException {
555: throw new UnsupportedOperationException(
556: "CallableStatement does not support this method.");
557: }
558:
559: public void updateBytes(String columnName, byte x[])
560: throws SQLException {
561: throw new UnsupportedOperationException(
562: "CallableStatement does not support this method.");
563: }
564:
565: public void updateCharacterStream(int columnIndex, Reader x,
566: int length) throws SQLException {
567: throw new UnsupportedOperationException(
568: "CallableStatement does not support this method.");
569: }
570:
571: public void updateCharacterStream(String columnName, Reader reader,
572: int length) throws SQLException {
573: throw new UnsupportedOperationException(
574: "CallableStatement does not support this method.");
575: }
576:
577: public void updateClob(int columnIndex, Clob x) throws SQLException {
578: throw new UnsupportedOperationException(
579: "CallableStatement does not support this method.");
580: }
581:
582: public void updateClob(String columnName, Clob x)
583: throws SQLException {
584: throw new UnsupportedOperationException(
585: "CallableStatement does not support this method.");
586: }
587:
588: public void updateDate(int columnIndex, Date x) throws SQLException {
589: throw new UnsupportedOperationException(
590: "CallableStatement does not support this method.");
591: }
592:
593: public void updateDate(String columnName, Date x)
594: throws SQLException {
595: throw new UnsupportedOperationException(
596: "CallableStatement does not support this method.");
597: }
598:
599: public void updateDouble(int columnIndex, double x)
600: throws SQLException {
601: throw new UnsupportedOperationException(
602: "CallableStatement does not support this method.");
603: }
604:
605: public void updateDouble(String columnName, double x)
606: throws SQLException {
607: throw new UnsupportedOperationException(
608: "CallableStatement does not support this method.");
609: }
610:
611: public void updateFloat(int columnIndex, float x)
612: throws SQLException {
613: throw new UnsupportedOperationException(
614: "CallableStatement does not support this method.");
615: }
616:
617: public void updateFloat(String columnName, float x)
618: throws SQLException {
619: throw new UnsupportedOperationException(
620: "CallableStatement does not support this method.");
621: }
622:
623: public void updateInt(int columnIndex, int x) throws SQLException {
624: throw new UnsupportedOperationException(
625: "CallableStatement does not support this method.");
626: }
627:
628: public void updateInt(String columnName, int x) throws SQLException {
629: throw new UnsupportedOperationException(
630: "CallableStatement does not support this method.");
631: }
632:
633: public void updateLong(int columnIndex, long x) throws SQLException {
634: throw new UnsupportedOperationException(
635: "CallableStatement does not support this method.");
636: }
637:
638: public void updateLong(String columnName, long x)
639: throws SQLException {
640: throw new UnsupportedOperationException(
641: "CallableStatement does not support this method.");
642: }
643:
644: public void updateNull(int columnIndex) throws SQLException {
645: throw new UnsupportedOperationException(
646: "CallableStatement does not support this method.");
647: }
648:
649: public void updateNull(String columnName) throws SQLException {
650: throw new UnsupportedOperationException(
651: "CallableStatement does not support this method.");
652: }
653:
654: public void updateObject(int columnIndex, Object x)
655: throws SQLException {
656: throw new UnsupportedOperationException(
657: "CallableStatement does not support this method.");
658: }
659:
660: public void updateObject(int columnIndex, Object x, int scale)
661: throws SQLException {
662: throw new UnsupportedOperationException(
663: "CallableStatement does not support this method.");
664: }
665:
666: public void updateObject(String columnName, Object x)
667: throws SQLException {
668: throw new UnsupportedOperationException(
669: "CallableStatement does not support this method.");
670: }
671:
672: public void updateObject(String columnName, Object x, int scale)
673: throws SQLException {
674: throw new UnsupportedOperationException(
675: "CallableStatement does not support this method.");
676: }
677:
678: public void updateRef(int columnIndex, Ref x) throws SQLException {
679: throw new UnsupportedOperationException(
680: "CallableStatement does not support this method.");
681: }
682:
683: public void updateRef(String columnName, Ref x) throws SQLException {
684: throw new UnsupportedOperationException(
685: "CallableStatement does not support this method.");
686: }
687:
688: public void updateRow() throws SQLException {
689: throw new UnsupportedOperationException(
690: "CallableStatement does not support this method.");
691: }
692:
693: public void updateShort(int columnIndex, short x)
694: throws SQLException {
695: throw new UnsupportedOperationException(
696: "CallableStatement does not support this method.");
697: }
698:
699: public void updateShort(String columnName, short x)
700: throws SQLException {
701: throw new UnsupportedOperationException(
702: "CallableStatement does not support this method.");
703: }
704:
705: public void updateString(int columnIndex, String x)
706: throws SQLException {
707: throw new UnsupportedOperationException(
708: "CallableStatement does not support this method.");
709: }
710:
711: public void updateString(String columnName, String x)
712: throws SQLException {
713: throw new UnsupportedOperationException(
714: "CallableStatement does not support this method.");
715: }
716:
717: public void updateTime(int columnIndex, Time x) throws SQLException {
718: throw new UnsupportedOperationException(
719: "CallableStatement does not support this method.");
720: }
721:
722: public void updateTime(String columnName, Time x)
723: throws SQLException {
724: throw new UnsupportedOperationException(
725: "CallableStatement does not support this method.");
726: }
727:
728: public void updateTimestamp(int columnIndex, Timestamp x)
729: throws SQLException {
730: throw new UnsupportedOperationException(
731: "CallableStatement does not support this method.");
732: }
733:
734: public void updateTimestamp(String columnName, Timestamp x)
735: throws SQLException {
736: throw new UnsupportedOperationException(
737: "CallableStatement does not support this method.");
738: }
739:
740: public boolean wasNull() throws SQLException {
741: return cs.wasNull();
742: }
743:
744: }
|