001: /*
002:
003: Derby - Class org.apache.derby.vti.UpdatableVTITemplate
004:
005: Licensed to the Apache Software Foundation (ASF) under one or more
006: contributor license agreements. See the NOTICE file distributed with
007: this work for additional information regarding copyright ownership.
008: The ASF licenses this file to You under the Apache License, Version 2.0
009: (the "License"); you may not use this file except in compliance with
010: the License. You may obtain a copy of the License at
011:
012: http://www.apache.org/licenses/LICENSE-2.0
013:
014: Unless required by applicable law or agreed to in writing, software
015: distributed under the License is distributed on an "AS IS" BASIS,
016: WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
017: See the License for the specific language governing permissions and
018: limitations under the License.
019:
020: */
021:
022: package org.apache.derby.vti;
023:
024: import org.apache.derby.iapi.reference.JDBC20Translation;
025:
026: import java.sql.Connection;
027: import java.sql.Date;
028: import java.sql.Statement;
029: import java.sql.PreparedStatement;
030: import java.sql.ResultSet;
031: import java.sql.ResultSetMetaData;
032: import java.sql.Statement;
033: import java.sql.SQLException;
034: import java.sql.SQLWarning;
035: import java.sql.Time;
036: import java.sql.Timestamp;
037: import java.math.BigDecimal;
038: import java.sql.Blob;
039: import java.sql.Ref;
040: import java.sql.Clob;
041: import java.sql.Array;
042:
043: import java.io.Reader;
044:
045: import java.util.Calendar;
046:
047: import java.io.InputStream;
048:
049: /**
050:
051: An abstract implementation of PreparedStatement (JDK1.1/JDBC 1.2) that is useful
052: when writing a read-write (updatable) virtual table interface (VTI).
053:
054: This class implements
055: the methods of the JDBC1.2 version of PreparedStatement plus the
056: JDBC2.0 getMetaData() method, each one throwing a SQLException
057: with the name of the method. A concrete subclass can then just implement
058: the methods not implemented here and override any methods it needs
059: to implement for correct functionality.
060:
061: */
062: public abstract class UpdatableVTITemplate implements PreparedStatement {
063: protected UpdatableVTITemplate() {
064: }
065:
066: /**
067: * @see java.sql.Statement
068: *
069: * @exception SQLException on unexpected JDBC error
070: */
071: public ResultSet executeQuery(String sql) throws SQLException {
072: throw new SQLException("executeQuery");
073: }
074:
075: /**
076: * @see java.sql.Statement
077: *
078: * @exception SQLException on unexpected JDBC error
079: */
080: public int executeUpdate(String sql) throws SQLException {
081: throw new SQLException("executeUpdate");
082: }
083:
084: /**
085: * @see java.sql.Statement
086: *
087: * @exception SQLException on unexpected JDBC error
088: */
089: public void close() throws SQLException {
090: throw new SQLException("close");
091: }
092:
093: /**
094: * @see java.sql.Statement
095: *
096: * @exception SQLException on unexpected JDBC error
097: */
098: public SQLWarning getWarnings() throws SQLException {
099: throw new SQLException("getWarnings");
100: }
101:
102: /**
103: * @see java.sql.Statement
104: *
105: * @exception SQLException on unexpected JDBC error
106: */
107: public void clearWarnings() throws SQLException {
108: throw new SQLException("clearWarnings");
109: }
110:
111: /**
112: * @see java.sql.Statement
113: *
114: * @exception SQLException on unexpected JDBC error
115: */
116: public int getMaxFieldSize() throws SQLException {
117: throw new SQLException("getMaxFieldSize");
118: }
119:
120: /**
121: * @see java.sql.Statement
122: *
123: * @exception SQLException on unexpected JDBC error
124: */
125: public void setMaxFieldSize(int max) throws SQLException {
126: throw new SQLException("setMaxFieldSize");
127: }
128:
129: /**
130: * @see java.sql.Statement
131: *
132: * @exception SQLException on unexpected JDBC error
133: */
134: public int getMaxRows() throws SQLException {
135: throw new SQLException("getMaxRows");
136: }
137:
138: /**
139: * @see java.sql.Statement
140: *
141: * @exception SQLException on unexpected JDBC error
142: */
143: public void setMaxRows(int max) throws SQLException {
144: throw new SQLException("setMaxRows");
145: }
146:
147: /**
148: * @see java.sql.Statement
149: *
150: * @exception SQLException on unexpected JDBC error
151: */
152: public void setEscapeProcessing(boolean enable) throws SQLException {
153: throw new SQLException("setEscapeProcessing");
154: }
155:
156: /**
157: * @see java.sql.Statement
158: *
159: * @exception SQLException on unexpected JDBC error
160: */
161: public int getQueryTimeout() throws SQLException {
162: throw new SQLException("getQueryTimeout");
163: }
164:
165: /**
166: * @see java.sql.Statement
167: *
168: * @exception SQLException on unexpected JDBC error
169: */
170: public void setQueryTimeout(int seconds) throws SQLException {
171: throw new SQLException("setQueryTimeout");
172: }
173:
174: /**
175: * @see java.sql.Statement
176: *
177: * @exception SQLException on unexpected JDBC error
178: */
179: public void addBatch(String sql) throws SQLException {
180: throw new SQLException("addBatch");
181: }
182:
183: /**
184: * @see java.sql.Statement
185: *
186: * @exception SQLException on unexpected JDBC error
187: */
188: public void clearBatch() throws SQLException {
189: throw new SQLException("clearBatch");
190: }
191:
192: /**
193: * @see java.sql.Statement
194: *
195: * @exception SQLException on unexpected JDBC error
196: */
197: public int[] executeBatch() throws SQLException {
198: throw new SQLException("executeBatch");
199: }
200:
201: /**
202: * @see java.sql.Statement
203: *
204: * @exception SQLException on unexpected JDBC error
205: */
206: public void cancel() throws SQLException {
207: throw new SQLException("cancel");
208: }
209:
210: /**
211: * @see java.sql.Statement
212: *
213: * @exception SQLException on unexpected JDBC error
214: */
215: public void setCursorName(String name) throws SQLException {
216: throw new SQLException("setCursorName");
217: }
218:
219: /**
220: * @see java.sql.Statement
221: *
222: * @exception SQLException on unexpected JDBC error
223: */
224: public boolean execute(String sql) throws SQLException {
225: throw new SQLException("execute");
226: }
227:
228: /**
229: * @see java.sql.Statement
230: *
231: * @exception SQLException on unexpected JDBC error
232: */
233: public ResultSet getResultSet() throws SQLException {
234: throw new SQLException("getResultSet");
235: }
236:
237: /**
238: * @see java.sql.Statement
239: *
240: * @exception SQLException on unexpected JDBC error
241: */
242: public int getUpdateCount() throws SQLException {
243: throw new SQLException("getUpdateCount");
244: }
245:
246: /**
247: * @see java.sql.Statement
248: *
249: * @exception SQLException on unexpected JDBC error
250: */
251: public boolean getMoreResults() throws SQLException {
252: throw new SQLException("getMoreResults");
253: }
254:
255: /**
256: * @see java.sql.Statement
257: *
258: * @exception SQLException on unexpected JDBC error
259: */
260: public int getResultSetConcurrency() throws SQLException {
261: return JDBC20Translation.CONCUR_UPDATABLE;
262: }
263:
264: //
265: // java.sql.PreparedStatement calls, passed through to our preparedStatement.
266: //
267:
268: /**
269: * @see java.sql.PreparedStatement
270: *
271: * @exception SQLException on unexpected JDBC error
272: */
273: public ResultSet executeQuery() throws SQLException {
274: throw new SQLException("executeQuery");
275: }
276:
277: /**
278: * @see java.sql.PreparedStatement
279: *
280: * @exception SQLException on unexpected JDBC error
281: */
282: public int executeUpdate() throws SQLException {
283: throw new SQLException("executeUpdate");
284: }
285:
286: /**
287: * @see java.sql.PreparedStatement
288: *
289: * @exception SQLException on unexpected JDBC error
290: */
291: public void setNull(int parameterIndex, int jdbcType)
292: throws SQLException {
293: throw new SQLException("setNull");
294: }
295:
296: /**
297: * @see java.sql.PreparedStatement
298: *
299: * @exception SQLException on unexpected JDBC error
300: */
301: public void setNull(int parameterIndex, int jdbcType,
302: String typeName) throws SQLException {
303: throw new SQLException("setNull");
304: }
305:
306: /**
307: * @see java.sql.PreparedStatement
308: *
309: * @exception SQLException on unexpected JDBC error
310: */
311: public void setBoolean(int parameterIndex, boolean x)
312: throws SQLException {
313: throw new SQLException("setBoolean");
314: }
315:
316: /**
317: * @see java.sql.PreparedStatement
318: *
319: * @exception SQLException on unexpected JDBC error
320: */
321: public void setByte(int parameterIndex, byte x) throws SQLException {
322: throw new SQLException("setByte");
323: }
324:
325: /**
326: * @see java.sql.PreparedStatement
327: *
328: * @exception SQLException on unexpected JDBC error
329: */
330: public void setShort(int parameterIndex, short x)
331: throws SQLException {
332: throw new SQLException("setShort");
333: }
334:
335: /**
336: * @see java.sql.PreparedStatement
337: *
338: * @exception SQLException on unexpected JDBC error
339: */
340: public void setInt(int parameterIndex, int x) throws SQLException {
341: throw new SQLException("setInt");
342: }
343:
344: /**
345: * @see java.sql.PreparedStatement
346: *
347: * @exception SQLException on unexpected JDBC error
348: */
349: public void setLong(int parameterIndex, long x) throws SQLException {
350: throw new SQLException("setLong");
351: }
352:
353: /**
354: * @see java.sql.PreparedStatement
355: *
356: * @exception SQLException on unexpected JDBC error
357: */
358: public void setFloat(int parameterIndex, float x)
359: throws SQLException {
360: throw new SQLException("setFloat");
361: }
362:
363: /**
364: * @see java.sql.PreparedStatement
365: *
366: * @exception SQLException on unexpected JDBC error
367: */
368: public void setDouble(int parameterIndex, double x)
369: throws SQLException {
370: throw new SQLException("setDouble");
371: }
372:
373: /**
374: * @see java.sql.PreparedStatement
375: *
376: * @exception SQLException on unexpected JDBC error
377: */
378: public void setBigDecimal(int parameterIndex, BigDecimal x)
379: throws SQLException {
380: throw new SQLException("setBigDecimal");
381: }
382:
383: /**
384: * @see java.sql.PreparedStatement
385: *
386: * @exception SQLException on unexpected JDBC error
387: */
388: public void setString(int parameterIndex, String x)
389: throws SQLException {
390: throw new SQLException("setString");
391: }
392:
393: /**
394: * @see java.sql.PreparedStatement
395: *
396: * @exception SQLException on unexpected JDBC error
397: */
398: public void setBytes(int parameterIndex, byte x[])
399: throws SQLException {
400: throw new SQLException("setBytes");
401: }
402:
403: /**
404: * @see java.sql.PreparedStatement
405: *
406: * @exception SQLException on unexpected JDBC error
407: */
408: public void setDate(int parameterIndex, Date x) throws SQLException {
409: throw new SQLException("setDate");
410: }
411:
412: /**
413: * @see java.sql.PreparedStatement
414: *
415: * @exception SQLException on unexpected JDBC error
416: */
417: public void setTime(int parameterIndex, Time x) throws SQLException {
418: throw new SQLException("setTime");
419: }
420:
421: /**
422: * @see java.sql.PreparedStatement
423: *
424: * @exception SQLException on unexpected JDBC error
425: */
426: public void setTimestamp(int parameterIndex, Timestamp x)
427: throws SQLException {
428: throw new SQLException("setTimestamp");
429: }
430:
431: /**
432: * @see java.sql.PreparedStatement
433: *
434: * @exception SQLException on unexpected JDBC error
435: */
436: public void setAsciiStream(int parameterIndex, InputStream x,
437: int length) throws SQLException {
438: throw new SQLException("setAsciiStream");
439: }
440:
441: /**
442: * @see java.sql.PreparedStatement
443: *
444: * @exception SQLException on unexpected JDBC error
445: */
446: public void setUnicodeStream(int parameterIndex, InputStream x,
447: int length) throws SQLException {
448: throw new SQLException("setUnicodeStream");
449: }
450:
451: /**
452: * @see java.sql.PreparedStatement
453: *
454: * @exception SQLException on unexpected JDBC error
455: */
456: public void setBinaryStream(int parameterIndex, InputStream x,
457: int length) throws SQLException {
458: throw new SQLException("setBinaryStream");
459: }
460:
461: /**
462: * @see java.sql.PreparedStatement
463: *
464: * @exception SQLException on unexpected JDBC error
465: */
466: public void clearParameters() throws SQLException {
467: throw new SQLException("clearParameters");
468: }
469:
470: /**
471: * @see java.sql.PreparedStatement
472: *
473: * @exception SQLException on unexpected JDBC error
474: */
475: public void setObject(int parameterIndex, Object x,
476: int targetJdbcType, int scale) throws SQLException {
477: throw new SQLException("setObject");
478: }
479:
480: /**
481: * @see java.sql.PreparedStatement
482: *
483: * @exception SQLException on unexpected JDBC error
484: */
485: public void setObject(int parameterIndex, Object x,
486: int targetJdbcType) throws SQLException {
487: throw new SQLException("setObject");
488: }
489:
490: /**
491: * @see java.sql.PreparedStatement
492: *
493: * @exception SQLException on unexpected JDBC error
494: */
495: public void setObject(int parameterIndex, Object x)
496: throws SQLException {
497: throw new SQLException("setObject");
498: }
499:
500: /**
501: * @see java.sql.PreparedStatement
502: *
503: * @exception SQLException on unexpected JDBC error
504: */
505: public boolean execute() throws SQLException {
506: throw new SQLException("execute");
507: }
508:
509: /**
510: * @see java.sql.PreparedStatement
511: *
512: * @exception SQLException on unexpected JDBC error
513: */
514: public ResultSetMetaData getMetaData() throws SQLException {
515: throw new SQLException("ResultSetMetaData");
516: }
517:
518: /**
519: * @see java.sql.PreparedStatement
520: *
521: * @exception SQLException Always thrown
522: */
523: public int getResultSetType() throws SQLException {
524: throw new SQLException("getResultSetType");
525: }
526:
527: /**
528: * @see java.sql.PreparedStatement
529: *
530: * @exception SQLException Always thrown
531: */
532: public void setBlob(int i, Blob x) throws SQLException {
533: throw new SQLException("setBlob");
534: }
535:
536: /**
537: * @see java.sql.PreparedStatement
538: *
539: * @exception SQLException Always thrown
540: */
541: public void setFetchDirection(int direction) throws SQLException {
542: throw new SQLException("setFetchDirection");
543: }
544:
545: /**
546: * @see java.sql.PreparedStatement
547: *
548: * @exception SQLException Always thrown
549: */
550: public void setFetchSize(int rows) throws SQLException {
551: throw new SQLException("setFetchSize");
552: }
553:
554: /**
555: * @see java.sql.PreparedStatement
556: *
557: * @exception SQLException Always thrown
558: */
559: public void addBatch() throws SQLException {
560: throw new SQLException("addBatch");
561: }
562:
563: /**
564: * @see java.sql.PreparedStatement
565: *
566: * @exception SQLException Always thrown
567: */
568: public void setCharacterStream(int parameterIndex, Reader reader,
569: int length) throws SQLException {
570: throw new SQLException("setCharacterStream");
571: }
572:
573: /**
574: * @see java.sql.PreparedStatement
575: *
576: * @exception SQLException Always thrown
577: */
578: public Connection getConnection() throws SQLException {
579: throw new SQLException("getConnection");
580: }
581:
582: /**
583: * @see java.sql.PreparedStatement
584: *
585: * @exception SQLException Always thrown
586: */
587: public int getFetchDirection() throws SQLException {
588: throw new SQLException("getFetchDirection");
589: }
590:
591: /**
592: * @see java.sql.PreparedStatement
593: *
594: * @exception SQLException Always thrown
595: */
596: public void setTime(int parameterIndex, Time x, Calendar cal)
597: throws SQLException {
598: throw new SQLException("setTime");
599: }
600:
601: /**
602: * @see java.sql.PreparedStatement
603: *
604: * @exception SQLException Always thrown
605: */
606: public void setTimestamp(int parameterIndex, Timestamp x,
607: Calendar cal) throws SQLException {
608: throw new SQLException("setTimestamp");
609: }
610:
611: /**
612: * @see java.sql.PreparedStatement
613: *
614: * @exception SQLException Always thrown
615: */
616: public int getFetchSize() throws SQLException {
617: throw new SQLException("getFetchSize");
618: }
619:
620: /**
621: * @see java.sql.PreparedStatement
622: *
623: * @exception SQLException Always thrown
624: */
625: public void setRef(int i, Ref x) throws SQLException {
626: throw new SQLException("setRef");
627: }
628:
629: /**
630: * @see java.sql.PreparedStatement
631: *
632: * @exception SQLException Always thrown
633: */
634: public void setDate(int parameterIndex, Date x, Calendar cal)
635: throws SQLException {
636: throw new SQLException("setDate");
637: }
638:
639: /**
640: * @see java.sql.PreparedStatement
641: *
642: * @exception SQLException Always thrown
643: */
644: public void setClob(int i, Clob x) throws SQLException {
645: throw new SQLException("setClob");
646: }
647:
648: /**
649: * @see java.sql.PreparedStatement
650: *
651: * @exception SQLException Always thrown
652: */
653: public void setArray(int i, Array x) throws SQLException {
654: throw new SQLException("setArray");
655: }
656: }
|