001/*
002// This software is subject to the terms of the Eclipse Public License v1.0
003// Agreement, available at the following URL:
004// http://www.eclipse.org/legal/epl-v10.html.
005// You must accept the terms of that agreement to use this software.
006//
007// Copyright (C) 2007-2011 Pentaho
008// All Rights Reserved.
009*/
010package mondrian.olap4j;
011
012import mondrian.rolap.RolapConnection;
013
014import org.olap4j.*;
015
016import java.io.InputStream;
017import java.io.Reader;
018import java.sql.*;
019import java.util.*;
020
021/**
022 * Abstract JDBC classes, for JDBC 4.0 and 4.1.
023 *
024 * @author jhyde
025 * @since Jun 14, 2007
026 */
027class FactoryJdbc4Plus {
028
029    // Inner classes
030
031    protected static abstract class AbstractEmptyResultSet
032        extends EmptyResultSet
033    {
034        AbstractEmptyResultSet(
035            MondrianOlap4jConnection olap4jConnection,
036            List<String> headerList,
037            List<List<Object>> rowList)
038        {
039            super(olap4jConnection, headerList, rowList);
040        }
041
042        // implement java.sql.ResultSet methods
043        // introduced in JDBC 4.0/JDK 1.6
044
045        public RowId getRowId(int columnIndex) throws SQLException {
046            throw new UnsupportedOperationException();
047        }
048
049        public RowId getRowId(String columnLabel) throws SQLException {
050            throw new UnsupportedOperationException();
051        }
052
053        public void updateRowId(int columnIndex, RowId x) throws SQLException {
054            throw new UnsupportedOperationException();
055        }
056
057        public void updateRowId(String columnLabel, RowId x) throws SQLException
058        {
059            throw new UnsupportedOperationException();
060        }
061
062        public int getHoldability() throws SQLException {
063            throw new UnsupportedOperationException();
064        }
065
066        public boolean isClosed() throws SQLException {
067            throw new UnsupportedOperationException();
068        }
069
070        public void updateNString(
071            int columnIndex, String nString) throws SQLException
072        {
073            throw new UnsupportedOperationException();
074        }
075
076        public void updateNString(
077            String columnLabel, String nString) throws SQLException
078        {
079            throw new UnsupportedOperationException();
080        }
081
082        public void updateNClob(int columnIndex, NClob nClob)
083            throws SQLException
084        {
085            throw new UnsupportedOperationException();
086        }
087
088        public void updateNClob(
089            String columnLabel, NClob nClob) throws SQLException
090        {
091            throw new UnsupportedOperationException();
092        }
093
094        public NClob getNClob(int columnIndex) throws SQLException {
095            throw new UnsupportedOperationException();
096        }
097
098        public NClob getNClob(String columnLabel) throws SQLException {
099            throw new UnsupportedOperationException();
100        }
101
102        public SQLXML getSQLXML(int columnIndex) throws SQLException {
103            throw new UnsupportedOperationException();
104        }
105
106        public SQLXML getSQLXML(String columnLabel) throws SQLException {
107            throw new UnsupportedOperationException();
108        }
109
110        public void updateSQLXML(
111            int columnIndex, SQLXML xmlObject) throws SQLException
112        {
113            throw new UnsupportedOperationException();
114        }
115
116        public void updateSQLXML(
117            String columnLabel, SQLXML xmlObject) throws SQLException
118        {
119            throw new UnsupportedOperationException();
120        }
121
122        public String getNString(int columnIndex) throws SQLException {
123            throw new UnsupportedOperationException();
124        }
125
126        public String getNString(String columnLabel) throws SQLException {
127            throw new UnsupportedOperationException();
128        }
129
130        public Reader getNCharacterStream(int columnIndex) throws SQLException {
131            throw new UnsupportedOperationException();
132        }
133
134        public Reader getNCharacterStream(String columnLabel)
135            throws SQLException
136        {
137            throw new UnsupportedOperationException();
138        }
139
140        public void updateNCharacterStream(
141            int columnIndex, Reader x, long length) throws SQLException
142        {
143            throw new UnsupportedOperationException();
144        }
145
146        public void updateNCharacterStream(
147            String columnLabel, Reader reader, long length) throws SQLException
148        {
149            throw new UnsupportedOperationException();
150        }
151
152        public void updateAsciiStream(
153            int columnIndex, InputStream x, long length) throws SQLException
154        {
155            throw new UnsupportedOperationException();
156        }
157
158        public void updateBinaryStream(
159            int columnIndex, InputStream x, long length) throws SQLException
160        {
161            throw new UnsupportedOperationException();
162        }
163
164        public void updateCharacterStream(
165            int columnIndex, Reader x, long length) throws SQLException
166        {
167            throw new UnsupportedOperationException();
168        }
169
170        public void updateAsciiStream(
171            String columnLabel, InputStream x, long length) throws SQLException
172        {
173            throw new UnsupportedOperationException();
174        }
175
176        public void updateBinaryStream(
177            String columnLabel, InputStream x, long length) throws SQLException
178        {
179            throw new UnsupportedOperationException();
180        }
181
182        public void updateCharacterStream(
183            String columnLabel, Reader reader, long length) throws SQLException
184        {
185            throw new UnsupportedOperationException();
186        }
187
188        public void updateBlob(
189            int columnIndex,
190            InputStream inputStream,
191            long length) throws SQLException
192        {
193            throw new UnsupportedOperationException();
194        }
195
196        public void updateBlob(
197            String columnLabel,
198            InputStream inputStream,
199            long length) throws SQLException
200        {
201            throw new UnsupportedOperationException();
202        }
203
204        public void updateClob(
205            int columnIndex, Reader reader, long length) throws SQLException
206        {
207            throw new UnsupportedOperationException();
208        }
209
210        public void updateClob(
211            String columnLabel, Reader reader, long length) throws SQLException
212        {
213            throw new UnsupportedOperationException();
214        }
215
216        public void updateNClob(
217            int columnIndex, Reader reader, long length) throws SQLException
218        {
219            throw new UnsupportedOperationException();
220        }
221
222        public void updateNClob(
223            String columnLabel, Reader reader, long length) throws SQLException
224        {
225            throw new UnsupportedOperationException();
226        }
227
228        public void updateNCharacterStream(
229            int columnIndex, Reader x) throws SQLException
230        {
231            throw new UnsupportedOperationException();
232        }
233
234        public void updateNCharacterStream(
235            String columnLabel, Reader reader) throws SQLException
236        {
237            throw new UnsupportedOperationException();
238        }
239
240        public void updateAsciiStream(
241            int columnIndex, InputStream x) throws SQLException
242        {
243            throw new UnsupportedOperationException();
244        }
245
246        public void updateBinaryStream(
247            int columnIndex, InputStream x) throws SQLException
248        {
249            throw new UnsupportedOperationException();
250        }
251
252        public void updateCharacterStream(
253            int columnIndex, Reader x) throws SQLException
254        {
255            throw new UnsupportedOperationException();
256        }
257
258        public void updateAsciiStream(
259            String columnLabel, InputStream x) throws SQLException
260        {
261            throw new UnsupportedOperationException();
262        }
263
264        public void updateBinaryStream(
265            String columnLabel, InputStream x) throws SQLException
266        {
267            throw new UnsupportedOperationException();
268        }
269
270        public void updateCharacterStream(
271            String columnLabel, Reader reader) throws SQLException
272        {
273            throw new UnsupportedOperationException();
274        }
275
276        public void updateBlob(
277            int columnIndex, InputStream inputStream) throws SQLException
278        {
279            throw new UnsupportedOperationException();
280        }
281
282        public void updateBlob(
283            String columnLabel, InputStream inputStream) throws SQLException
284        {
285            throw new UnsupportedOperationException();
286        }
287
288        public void updateClob(int columnIndex, Reader reader)
289            throws SQLException
290        {
291            throw new UnsupportedOperationException();
292        }
293
294        public void updateClob(
295            String columnLabel, Reader reader) throws SQLException
296        {
297            throw new UnsupportedOperationException();
298        }
299
300        public void updateNClob(
301            int columnIndex, Reader reader) throws SQLException
302        {
303            throw new UnsupportedOperationException();
304        }
305
306        public void updateNClob(
307            String columnLabel, Reader reader) throws SQLException
308        {
309            throw new UnsupportedOperationException();
310        }
311    }
312
313    static abstract class AbstractConnection
314        extends MondrianOlap4jConnection
315        implements OlapConnection
316    {
317        AbstractConnection(
318            Factory factory,
319            MondrianOlap4jDriver driver,
320            String url,
321            Properties info) throws SQLException
322        {
323            super(factory, driver, url, info);
324        }
325
326        public OlapStatement createStatement() {
327            return super.createStatement();
328        }
329
330        public OlapDatabaseMetaData getMetaData() {
331            return super.getMetaData();
332        }
333
334        // implement java.sql.Connection methods
335        // introduced in JDBC 4.0/JDK 1.6
336
337        public Clob createClob() throws SQLException {
338            throw new UnsupportedOperationException();
339        }
340
341        public Blob createBlob() throws SQLException {
342            throw new UnsupportedOperationException();
343        }
344
345        public NClob createNClob() throws SQLException {
346            throw new UnsupportedOperationException();
347        }
348
349        public SQLXML createSQLXML() throws SQLException {
350            throw new UnsupportedOperationException();
351        }
352
353        public boolean isValid(int timeout) throws SQLException {
354            return !isClosed();
355        }
356
357        public void setClientInfo(
358            String name, String value) throws SQLClientInfoException
359        {
360            throw new UnsupportedOperationException();
361        }
362
363        public void setClientInfo(Properties properties)
364            throws SQLClientInfoException
365        {
366            throw new UnsupportedOperationException();
367        }
368
369        public String getClientInfo(String name) throws SQLException {
370            throw new UnsupportedOperationException();
371        }
372
373        public Properties getClientInfo() throws SQLException {
374            throw new UnsupportedOperationException();
375        }
376
377        public Array createArrayOf(
378            String typeName, Object[] elements) throws SQLException
379        {
380            throw new UnsupportedOperationException();
381        }
382
383        public Struct createStruct(
384            String typeName, Object[] attributes) throws SQLException
385        {
386            throw new UnsupportedOperationException();
387        }
388    }
389
390    static abstract class AbstractCellSet
391        extends MondrianOlap4jCellSet
392    {
393        public AbstractCellSet(
394            MondrianOlap4jStatement olap4jStatement)
395        {
396            super(olap4jStatement);
397        }
398
399        // implement java.sql.CellSet methods
400        // introduced in JDBC 4.0/JDK 1.6
401
402        public RowId getRowId(int columnIndex) throws SQLException {
403            throw new UnsupportedOperationException();
404        }
405
406        public RowId getRowId(String columnLabel) throws SQLException {
407            throw new UnsupportedOperationException();
408        }
409
410        public void updateRowId(int columnIndex, RowId x) throws SQLException {
411            throw new UnsupportedOperationException();
412        }
413
414        public void updateRowId(String columnLabel, RowId x)
415            throws SQLException
416        {
417            throw new UnsupportedOperationException();
418        }
419
420        public int getHoldability() throws SQLException {
421            throw new UnsupportedOperationException();
422        }
423
424        public boolean isClosed() throws SQLException {
425            return closed;
426        }
427
428        public void updateNString(
429            int columnIndex, String nString) throws SQLException
430        {
431            throw new UnsupportedOperationException();
432        }
433
434        public void updateNString(
435            String columnLabel, String nString) throws SQLException
436        {
437            throw new UnsupportedOperationException();
438        }
439
440        public void updateNClob(int columnIndex, NClob nClob)
441            throws SQLException
442        {
443            throw new UnsupportedOperationException();
444        }
445
446        public void updateNClob(
447            String columnLabel, NClob nClob) throws SQLException
448        {
449            throw new UnsupportedOperationException();
450        }
451
452        public NClob getNClob(int columnIndex) throws SQLException {
453            throw new UnsupportedOperationException();
454        }
455
456        public NClob getNClob(String columnLabel) throws SQLException {
457            throw new UnsupportedOperationException();
458        }
459
460        public SQLXML getSQLXML(int columnIndex) throws SQLException {
461            throw new UnsupportedOperationException();
462        }
463
464        public SQLXML getSQLXML(String columnLabel) throws SQLException {
465            throw new UnsupportedOperationException();
466        }
467
468        public void updateSQLXML(
469            int columnIndex, SQLXML xmlObject) throws SQLException
470        {
471            throw new UnsupportedOperationException();
472        }
473
474        public void updateSQLXML(
475            String columnLabel, SQLXML xmlObject) throws SQLException
476        {
477            throw new UnsupportedOperationException();
478        }
479
480        public String getNString(int columnIndex) throws SQLException {
481            throw new UnsupportedOperationException();
482        }
483
484        public String getNString(String columnLabel) throws SQLException {
485            throw new UnsupportedOperationException();
486        }
487
488        public Reader getNCharacterStream(int columnIndex) throws SQLException {
489            throw new UnsupportedOperationException();
490        }
491
492        public Reader getNCharacterStream(
493            String columnLabel) throws SQLException
494        {
495            throw new UnsupportedOperationException();
496        }
497
498        public void updateNCharacterStream(
499            int columnIndex, Reader x, long length) throws SQLException
500        {
501            throw new UnsupportedOperationException();
502        }
503
504        public void updateNCharacterStream(
505            String columnLabel, Reader reader, long length) throws SQLException
506        {
507            throw new UnsupportedOperationException();
508        }
509
510        public void updateAsciiStream(
511            int columnIndex, InputStream x, long length) throws SQLException
512        {
513            throw new UnsupportedOperationException();
514        }
515
516        public void updateBinaryStream(
517            int columnIndex, InputStream x, long length) throws SQLException
518        {
519            throw new UnsupportedOperationException();
520        }
521
522        public void updateCharacterStream(
523            int columnIndex, Reader x, long length) throws SQLException
524        {
525            throw new UnsupportedOperationException();
526        }
527
528        public void updateAsciiStream(
529            String columnLabel, InputStream x, long length) throws SQLException
530        {
531            throw new UnsupportedOperationException();
532        }
533
534        public void updateBinaryStream(
535            String columnLabel, InputStream x, long length) throws SQLException
536        {
537            throw new UnsupportedOperationException();
538        }
539
540        public void updateCharacterStream(
541            String columnLabel, Reader reader, long length) throws SQLException
542        {
543            throw new UnsupportedOperationException();
544        }
545
546        public void updateBlob(
547            int columnIndex,
548            InputStream inputStream,
549            long length) throws SQLException
550        {
551            throw new UnsupportedOperationException();
552        }
553
554        public void updateBlob(
555            String columnLabel,
556            InputStream inputStream,
557            long length) throws SQLException
558        {
559            throw new UnsupportedOperationException();
560        }
561
562        public void updateClob(
563            int columnIndex, Reader reader, long length) throws SQLException
564        {
565            throw new UnsupportedOperationException();
566        }
567
568        public void updateClob(
569            String columnLabel, Reader reader, long length) throws SQLException
570        {
571            throw new UnsupportedOperationException();
572        }
573
574        public void updateNClob(
575            int columnIndex, Reader reader, long length) throws SQLException
576        {
577            throw new UnsupportedOperationException();
578        }
579
580        public void updateNClob(
581            String columnLabel, Reader reader, long length) throws SQLException
582        {
583            throw new UnsupportedOperationException();
584        }
585
586        public void updateNCharacterStream(
587            int columnIndex, Reader x) throws SQLException
588        {
589            throw new UnsupportedOperationException();
590        }
591
592        public void updateNCharacterStream(
593            String columnLabel, Reader reader) throws SQLException
594        {
595            throw new UnsupportedOperationException();
596        }
597
598        public void updateAsciiStream(
599            int columnIndex, InputStream x) throws SQLException
600        {
601            throw new UnsupportedOperationException();
602        }
603
604        public void updateBinaryStream(
605            int columnIndex, InputStream x) throws SQLException
606        {
607            throw new UnsupportedOperationException();
608        }
609
610        public void updateCharacterStream(
611            int columnIndex, Reader x) throws SQLException
612        {
613            throw new UnsupportedOperationException();
614        }
615
616        public void updateAsciiStream(
617            String columnLabel, InputStream x) throws SQLException
618        {
619            throw new UnsupportedOperationException();
620        }
621
622        public void updateBinaryStream(
623            String columnLabel, InputStream x) throws SQLException
624        {
625            throw new UnsupportedOperationException();
626        }
627
628        public void updateCharacterStream(
629            String columnLabel, Reader reader) throws SQLException
630        {
631            throw new UnsupportedOperationException();
632        }
633
634        public void updateBlob(
635            int columnIndex, InputStream inputStream) throws SQLException
636        {
637            throw new UnsupportedOperationException();
638        }
639
640        public void updateBlob(
641            String columnLabel, InputStream inputStream) throws SQLException
642        {
643            throw new UnsupportedOperationException();
644        }
645
646        public void updateClob(
647            int columnIndex, Reader reader) throws SQLException
648        {
649            throw new UnsupportedOperationException();
650        }
651
652        public void updateClob(
653            String columnLabel, Reader reader) throws SQLException
654        {
655            throw new UnsupportedOperationException();
656        }
657
658        public void updateNClob(
659            int columnIndex, Reader reader) throws SQLException
660        {
661            throw new UnsupportedOperationException();
662        }
663
664        public void updateNClob(
665            String columnLabel, Reader reader) throws SQLException
666        {
667            throw new UnsupportedOperationException();
668        }
669    }
670
671    // No need for an "AbstractStatement" class. Statement API is the same
672    // JDBC 3 and JDBC 4.
673
674    static abstract class AbstractPreparedStatement
675        extends MondrianOlap4jPreparedStatement
676    {
677        public AbstractPreparedStatement(
678            MondrianOlap4jConnection olap4jConnection,
679            String mdx)
680            throws OlapException
681        {
682            super(olap4jConnection, mdx);
683        }
684
685        public CellSetMetaData getMetaData() {
686            return super.getMetaData();
687        }
688
689        // implement java.sql.PreparedStatement methods
690        // introduced in JDBC 4.0/JDK 1.6
691
692        public void setRowId(int parameterIndex, RowId x) throws SQLException {
693            throw new UnsupportedOperationException();
694        }
695
696        public void setNString(
697            int parameterIndex, String value) throws SQLException
698        {
699            throw new UnsupportedOperationException();
700        }
701
702        public void setNCharacterStream(
703            int parameterIndex, Reader value, long length) throws SQLException
704        {
705            throw new UnsupportedOperationException();
706        }
707
708        public void setNClob(
709            int parameterIndex, NClob value) throws SQLException
710        {
711            throw new UnsupportedOperationException();
712        }
713
714        public void setClob(
715            int parameterIndex, Reader reader, long length) throws SQLException
716        {
717            throw new UnsupportedOperationException();
718        }
719
720        public void setBlob(
721            int parameterIndex,
722            InputStream inputStream,
723            long length) throws SQLException
724        {
725            throw new UnsupportedOperationException();
726        }
727
728        public void setNClob(
729            int parameterIndex, Reader reader, long length) throws SQLException
730        {
731            throw new UnsupportedOperationException();
732        }
733
734        public void setSQLXML(
735            int parameterIndex, SQLXML xmlObject) throws SQLException
736        {
737            throw new UnsupportedOperationException();
738        }
739
740        public void setAsciiStream(
741            int parameterIndex, InputStream x, long length) throws SQLException
742        {
743            throw new UnsupportedOperationException();
744        }
745
746        public void setBinaryStream(
747            int parameterIndex, InputStream x, long length) throws SQLException
748        {
749            throw new UnsupportedOperationException();
750        }
751
752        public void setCharacterStream(
753            int parameterIndex, Reader reader, long length) throws SQLException
754        {
755            throw new UnsupportedOperationException();
756        }
757
758        public void setAsciiStream(
759            int parameterIndex, InputStream x) throws SQLException
760        {
761            throw new UnsupportedOperationException();
762        }
763
764        public void setBinaryStream(
765            int parameterIndex, InputStream x) throws SQLException
766        {
767            throw new UnsupportedOperationException();
768        }
769
770        public void setCharacterStream(
771            int parameterIndex, Reader reader) throws SQLException
772        {
773            throw new UnsupportedOperationException();
774        }
775
776        public void setNCharacterStream(
777            int parameterIndex, Reader value) throws SQLException
778        {
779            throw new UnsupportedOperationException();
780        }
781
782        public void setClob(
783            int parameterIndex, Reader reader) throws SQLException
784        {
785            throw new UnsupportedOperationException();
786        }
787
788        public void setBlob(
789            int parameterIndex, InputStream inputStream) throws SQLException
790        {
791            throw new UnsupportedOperationException();
792        }
793
794        public void setNClob(
795            int parameterIndex, Reader reader) throws SQLException
796        {
797            throw new UnsupportedOperationException();
798        }
799    }
800
801    static abstract class AbstractDatabaseMetaData
802        extends MondrianOlap4jDatabaseMetaData
803    {
804        public AbstractDatabaseMetaData(
805            MondrianOlap4jConnection olap4jConnection,
806            RolapConnection mondrianConnection)
807        {
808            super(olap4jConnection, mondrianConnection);
809        }
810
811        public OlapConnection getConnection() {
812            return super.getConnection();
813        }
814
815        // implement java.sql.DatabaseMetaData methods
816        // introduced in JDBC 4.0/JDK 1.6
817
818        public RowIdLifetime getRowIdLifetime() throws SQLException {
819            throw new UnsupportedOperationException();
820        }
821
822        public ResultSet getSchemas(
823            String catalog, String schemaPattern) throws SQLException
824        {
825            throw new UnsupportedOperationException();
826        }
827
828        public boolean supportsStoredFunctionsUsingCallSyntax()
829            throws SQLException
830        {
831            throw new UnsupportedOperationException();
832        }
833
834        public boolean autoCommitFailureClosesAllResultSets()
835            throws SQLException
836        {
837            throw new UnsupportedOperationException();
838        }
839
840        public ResultSet getClientInfoProperties() throws SQLException {
841            throw new UnsupportedOperationException();
842        }
843
844        public ResultSet getFunctions(
845            String catalog,
846            String schemaPattern,
847            String functionNamePattern) throws SQLException
848        {
849            throw new UnsupportedOperationException();
850        }
851
852        public ResultSet getFunctionColumns(
853            String catalog,
854            String schemaPattern,
855            String functionNamePattern,
856            String columnNamePattern) throws SQLException
857        {
858            throw new UnsupportedOperationException();
859        }
860    }
861}
862
863// End FactoryJdbc4Plus.java