View Javadoc
1   /*
2   
3     Licensed to the Apache Software Foundation (ASF) under one or more
4     contributor license agreements.  See the NOTICE file distributed with
5     this work for additional information regarding copyright ownership.
6     The ASF licenses this file to You under the Apache License, Version 2.0
7     (the "License"); you may not use this file except in compliance with
8     the License.  You may obtain a copy of the License at
9   
10        http://www.apache.org/licenses/LICENSE-2.0
11  
12     Unless required by applicable law or agreed to in writing, software
13     distributed under the License is distributed on an "AS IS" BASIS,
14     WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15     See the License for the specific language governing permissions and
16     limitations under the License.
17   */
18  package org.apache.commons.dbcp2;
19  
20  import java.sql.Connection;
21  import java.sql.DatabaseMetaData;
22  import java.sql.ResultSet;
23  import java.sql.RowIdLifetime;
24  import java.sql.SQLException;
25  
26  /**
27   * Dummy {@link DatabaseMetaData} for testing purposes. Implements only those
28   * methods required by the test cases.
29   */
30  public class TesterDatabaseMetaData implements DatabaseMetaData {
31  
32      @Override
33      public boolean allProceduresAreCallable() throws SQLException {
34          return false;
35      }
36  
37      @Override
38      public boolean allTablesAreSelectable() throws SQLException {
39          return false;
40      }
41  
42      @Override
43      public boolean autoCommitFailureClosesAllResultSets() throws SQLException {
44          return false;
45      }
46  
47      @Override
48      public boolean dataDefinitionCausesTransactionCommit() throws SQLException {
49          return false;
50      }
51  
52      @Override
53      public boolean dataDefinitionIgnoredInTransactions() throws SQLException {
54          return false;
55      }
56  
57      @Override
58      public boolean deletesAreDetected(final int type) throws SQLException {
59          return false;
60      }
61  
62      @Override
63      public boolean doesMaxRowSizeIncludeBlobs() throws SQLException {
64          return false;
65      }
66  
67      @Override
68      public boolean generatedKeyAlwaysReturned() throws SQLException {
69          return false;
70      }
71  
72      @Override
73      public ResultSet getAttributes(final String catalog, final String schemaPattern,
74              final String typeNamePattern, final String attributeNamePattern)
75              throws SQLException {
76          return null;
77      }
78  
79      @Override
80      public ResultSet getBestRowIdentifier(final String catalog, final String schema,
81              final String table, final int scope, final boolean nullable) throws SQLException {
82          return null;
83      }
84  
85      @Override
86      public ResultSet getCatalogs() throws SQLException {
87          return null;
88      }
89  
90      @Override
91      public String getCatalogSeparator() throws SQLException {
92          return null;
93      }
94  
95      @Override
96      public String getCatalogTerm() throws SQLException {
97          return null;
98      }
99  
100     @Override
101     public ResultSet getClientInfoProperties() throws SQLException {
102         return null;
103     }
104 
105     @Override
106     public ResultSet getColumnPrivileges(final String catalog, final String schema,
107             final String table, final String columnNamePattern) throws SQLException {
108         return null;
109     }
110 
111     @Override
112     public ResultSet getColumns(final String catalog, final String schemaPattern,
113             final String tableNamePattern, final String columnNamePattern)
114             throws SQLException {
115         return null;
116     }
117 
118     @Override
119     public Connection getConnection() throws SQLException {
120         return null;
121     }
122 
123     @Override
124     public ResultSet getCrossReference(final String parentCatalog,
125             final String parentSchema, final String parentTable, final String foreignCatalog,
126             final String foreignSchema, final String foreignTable) throws SQLException {
127         return null;
128     }
129 
130     @Override
131     public int getDatabaseMajorVersion() throws SQLException {
132         return 0;
133     }
134 
135     @Override
136     public int getDatabaseMinorVersion() throws SQLException {
137         return 0;
138     }
139 
140     @Override
141     public String getDatabaseProductName() throws SQLException {
142         return null;
143     }
144 
145     @Override
146     public String getDatabaseProductVersion() throws SQLException {
147         return null;
148     }
149 
150     @Override
151     public int getDefaultTransactionIsolation() throws SQLException {
152         return 0;
153     }
154 
155     @Override
156     public int getDriverMajorVersion() {
157         return 0;
158     }
159 
160     @Override
161     public int getDriverMinorVersion() {
162         return 0;
163     }
164 
165     @Override
166     public String getDriverName() throws SQLException {
167         return null;
168     }
169 
170     @Override
171     public String getDriverVersion() throws SQLException {
172         return null;
173     }
174 
175     @Override
176     public ResultSet getExportedKeys(final String catalog, final String schema, final String table)
177             throws SQLException {
178         return null;
179     }
180 
181     @Override
182     public String getExtraNameCharacters() throws SQLException {
183         return null;
184     }
185 
186     @Override
187     public ResultSet getFunctionColumns(final String catalog, final String schemaPattern,
188             final String functionNamePattern, final String columnNamePattern)
189             throws SQLException {
190         return null;
191     }
192 
193     @Override
194     public ResultSet getFunctions(final String catalog, final String schemaPattern,
195             final String functionNamePattern) throws SQLException {
196         return null;
197     }
198 
199     @Override
200     public String getIdentifierQuoteString() throws SQLException {
201         return null;
202     }
203 
204     @Override
205     public ResultSet getImportedKeys(final String catalog, final String schema, final String table)
206             throws SQLException {
207         return null;
208     }
209 
210     @Override
211     public ResultSet getIndexInfo(final String catalog, final String schema, final String table,
212             final boolean unique, final boolean approximate) throws SQLException {
213         return null;
214     }
215 
216     @Override
217     public int getJDBCMajorVersion() throws SQLException {
218         return 0;
219     }
220 
221     @Override
222     public int getJDBCMinorVersion() throws SQLException {
223         return 0;
224     }
225 
226     @Override
227     public int getMaxBinaryLiteralLength() throws SQLException {
228         return 0;
229     }
230 
231     @Override
232     public int getMaxCatalogNameLength() throws SQLException {
233         return 0;
234     }
235 
236     @Override
237     public int getMaxCharLiteralLength() throws SQLException {
238         return 0;
239     }
240 
241     @Override
242     public int getMaxColumnNameLength() throws SQLException {
243         return 0;
244     }
245 
246     @Override
247     public int getMaxColumnsInGroupBy() throws SQLException {
248         return 0;
249     }
250 
251     @Override
252     public int getMaxColumnsInIndex() throws SQLException {
253         return 0;
254     }
255 
256     @Override
257     public int getMaxColumnsInOrderBy() throws SQLException {
258         return 0;
259     }
260 
261     @Override
262     public int getMaxColumnsInSelect() throws SQLException {
263         return 0;
264     }
265 
266     @Override
267     public int getMaxColumnsInTable() throws SQLException {
268         return 0;
269     }
270 
271     @Override
272     public int getMaxConnections() throws SQLException {
273         return 0;
274     }
275 
276     @Override
277     public int getMaxCursorNameLength() throws SQLException {
278         return 0;
279     }
280 
281     @Override
282     public int getMaxIndexLength() throws SQLException {
283         return 0;
284     }
285 
286     @Override
287     public int getMaxProcedureNameLength() throws SQLException {
288         return 0;
289     }
290 
291     @Override
292     public int getMaxRowSize() throws SQLException {
293         return 0;
294     }
295 
296     @Override
297     public int getMaxSchemaNameLength() throws SQLException {
298         return 0;
299     }
300 
301     @Override
302     public int getMaxStatementLength() throws SQLException {
303         return 0;
304     }
305 
306     @Override
307     public int getMaxStatements() throws SQLException {
308         return 0;
309     }
310 
311     @Override
312     public int getMaxTableNameLength() throws SQLException {
313         return 0;
314     }
315 
316     @Override
317     public int getMaxTablesInSelect() throws SQLException {
318         return 0;
319     }
320 
321     @Override
322     public int getMaxUserNameLength() throws SQLException {
323         return 0;
324     }
325 
326     @Override
327     public String getNumericFunctions() throws SQLException {
328         return null;
329     }
330 
331     @Override
332     public ResultSet getPrimaryKeys(final String catalog, final String schema, final String table)
333             throws SQLException {
334         return null;
335     }
336 
337     @Override
338     public ResultSet getProcedureColumns(final String catalog, final String schemaPattern,
339             final String procedureNamePattern, final String columnNamePattern)
340             throws SQLException {
341         return null;
342     }
343 
344     @Override
345     public ResultSet getProcedures(final String catalog, final String schemaPattern,
346             final String procedureNamePattern) throws SQLException {
347         return null;
348     }
349 
350     @Override
351     public String getProcedureTerm() throws SQLException {
352         return null;
353     }
354 
355     @Override
356     public ResultSet getPseudoColumns(final String catalog, final String schemaPattern,
357             final String tableNamePattern, final String columnNamePattern)
358             throws SQLException {
359         return null;
360     }
361 
362     @Override
363     public int getResultSetHoldability() throws SQLException {
364         return 0;
365     }
366 
367     @Override
368     public RowIdLifetime getRowIdLifetime() throws SQLException {
369         return null;
370     }
371 
372     @Override
373     public ResultSet getSchemas() throws SQLException {
374         return new TesterResultSet(null);
375     }
376 
377     @Override
378     public ResultSet getSchemas(final String catalog, final String schemaPattern)
379     throws SQLException {
380         return null;
381     }
382 
383     @Override
384     public String getSchemaTerm() throws SQLException {
385         return null;
386     }
387 
388     @Override
389     public String getSearchStringEscape() throws SQLException {
390         return null;
391     }
392 
393     @Override
394     public String getSQLKeywords() throws SQLException {
395         return null;
396     }
397 
398     @Override
399     public int getSQLStateType() throws SQLException {
400         return 0;
401     }
402 
403     @Override
404     public String getStringFunctions() throws SQLException {
405         return null;
406     }
407 
408     @Override
409     public ResultSet getSuperTables(final String catalog, final String schemaPattern,
410             final String tableNamePattern) throws SQLException {
411         return null;
412     }
413 
414     @Override
415     public ResultSet getSuperTypes(final String catalog, final String schemaPattern,
416             final String typeNamePattern) throws SQLException {
417         return null;
418     }
419 
420     @Override
421     public String getSystemFunctions() throws SQLException {
422         return null;
423     }
424 
425     @Override
426     public ResultSet getTablePrivileges(final String catalog, final String schemaPattern,
427             final String tableNamePattern) throws SQLException {
428         return null;
429     }
430 
431     @Override
432     public ResultSet getTables(final String catalog, final String schemaPattern,
433             final String tableNamePattern, final String[] types) throws SQLException {
434         return null;
435     }
436 
437     @Override
438     public ResultSet getTableTypes() throws SQLException {
439         return null;
440     }
441 
442     @Override
443     public String getTimeDateFunctions() throws SQLException {
444         return null;
445     }
446 
447     @Override
448     public ResultSet getTypeInfo() throws SQLException {
449         return null;
450     }
451 
452     @Override
453     public ResultSet getUDTs(final String catalog, final String schemaPattern,
454             final String typeNamePattern, final int[] types) throws SQLException {
455         return null;
456     }
457 
458     @Override
459     public String getURL() throws SQLException {
460         return null;
461     }
462 
463     @Override
464     public String getUserName() throws SQLException {
465         return null;
466     }
467 
468     @Override
469     public ResultSet getVersionColumns(final String catalog, final String schema,
470             final String table) throws SQLException {
471         return null;
472     }
473 
474     @Override
475     public boolean insertsAreDetected(final int type) throws SQLException {
476         return false;
477     }
478 
479     @Override
480     public boolean isCatalogAtStart() throws SQLException {
481         return false;
482     }
483 
484     @Override
485     public boolean isReadOnly() throws SQLException {
486         return false;
487     }
488 
489     @Override
490     public boolean isWrapperFor(final Class<?> iface) throws SQLException {
491         return false;
492     }
493 
494     @Override
495     public boolean locatorsUpdateCopy() throws SQLException {
496         return false;
497     }
498 
499     @Override
500     public boolean nullPlusNonNullIsNull() throws SQLException {
501         return false;
502     }
503 
504     @Override
505     public boolean nullsAreSortedAtEnd() throws SQLException {
506         return false;
507     }
508 
509     @Override
510     public boolean nullsAreSortedAtStart() throws SQLException {
511         return false;
512     }
513 
514     @Override
515     public boolean nullsAreSortedHigh() throws SQLException {
516         return false;
517     }
518 
519     @Override
520     public boolean nullsAreSortedLow() throws SQLException {
521         return false;
522     }
523 
524     @Override
525     public boolean othersDeletesAreVisible(final int type) throws SQLException {
526         return false;
527     }
528 
529     @Override
530     public boolean othersInsertsAreVisible(final int type) throws SQLException {
531         return false;
532     }
533 
534     @Override
535     public boolean othersUpdatesAreVisible(final int type) throws SQLException {
536         return false;
537     }
538 
539     @Override
540     public boolean ownDeletesAreVisible(final int type) throws SQLException {
541         return false;
542     }
543 
544     @Override
545     public boolean ownInsertsAreVisible(final int type) throws SQLException {
546         return false;
547     }
548 
549     @Override
550     public boolean ownUpdatesAreVisible(final int type) throws SQLException {
551         return false;
552     }
553 
554     @Override
555     public boolean storesLowerCaseIdentifiers() throws SQLException {
556         return false;
557     }
558 
559     @Override
560     public boolean storesLowerCaseQuotedIdentifiers() throws SQLException {
561         return false;
562     }
563 
564     @Override
565     public boolean storesMixedCaseIdentifiers() throws SQLException {
566         return false;
567     }
568 
569     @Override
570     public boolean storesMixedCaseQuotedIdentifiers() throws SQLException {
571         return false;
572     }
573 
574     @Override
575     public boolean storesUpperCaseIdentifiers() throws SQLException {
576         return false;
577     }
578 
579     @Override
580     public boolean storesUpperCaseQuotedIdentifiers() throws SQLException {
581         return false;
582     }
583 
584     @Override
585     public boolean supportsAlterTableWithAddColumn() throws SQLException {
586         return false;
587     }
588 
589     @Override
590     public boolean supportsAlterTableWithDropColumn() throws SQLException {
591         return false;
592     }
593 
594     @Override
595     public boolean supportsANSI92EntryLevelSQL() throws SQLException {
596         return false;
597     }
598 
599     @Override
600     public boolean supportsANSI92FullSQL() throws SQLException {
601         return false;
602     }
603 
604     @Override
605     public boolean supportsANSI92IntermediateSQL() throws SQLException {
606         return false;
607     }
608 
609     @Override
610     public boolean supportsBatchUpdates() throws SQLException {
611         return false;
612     }
613 
614     @Override
615     public boolean supportsCatalogsInDataManipulation() throws SQLException {
616         return false;
617     }
618 
619     @Override
620     public boolean supportsCatalogsInIndexDefinitions() throws SQLException {
621         return false;
622     }
623 
624     @Override
625     public boolean supportsCatalogsInPrivilegeDefinitions() throws SQLException {
626         return false;
627     }
628 
629     @Override
630     public boolean supportsCatalogsInProcedureCalls() throws SQLException {
631         return false;
632     }
633 
634     @Override
635     public boolean supportsCatalogsInTableDefinitions() throws SQLException {
636         return false;
637     }
638 
639     @Override
640     public boolean supportsColumnAliasing() throws SQLException {
641         return false;
642     }
643 
644     @Override
645     public boolean supportsConvert() throws SQLException {
646         return false;
647     }
648 
649     @Override
650     public boolean supportsConvert(final int fromType, final int toType)
651             throws SQLException {
652         return false;
653     }
654 
655     @Override
656     public boolean supportsCoreSQLGrammar() throws SQLException {
657         return false;
658     }
659 
660     @Override
661     public boolean supportsCorrelatedSubqueries() throws SQLException {
662         return false;
663     }
664 
665     @Override
666     public boolean supportsDataDefinitionAndDataManipulationTransactions()
667             throws SQLException {
668         return false;
669     }
670 
671     @Override
672     public boolean supportsDataManipulationTransactionsOnly()
673             throws SQLException {
674         return false;
675     }
676 
677     @Override
678     public boolean supportsDifferentTableCorrelationNames() throws SQLException {
679         return false;
680     }
681 
682     @Override
683     public boolean supportsExpressionsInOrderBy() throws SQLException {
684         return false;
685     }
686 
687     @Override
688     public boolean supportsExtendedSQLGrammar() throws SQLException {
689         return false;
690     }
691 
692     @Override
693     public boolean supportsFullOuterJoins() throws SQLException {
694         return false;
695     }
696 
697     @Override
698     public boolean supportsGetGeneratedKeys() throws SQLException {
699         return false;
700     }
701 
702     @Override
703     public boolean supportsGroupBy() throws SQLException {
704         return false;
705     }
706 
707     @Override
708     public boolean supportsGroupByBeyondSelect() throws SQLException {
709         return false;
710     }
711 
712     @Override
713     public boolean supportsGroupByUnrelated() throws SQLException {
714         return false;
715     }
716 
717     @Override
718     public boolean supportsIntegrityEnhancementFacility() throws SQLException {
719         return false;
720     }
721 
722     @Override
723     public boolean supportsLikeEscapeClause() throws SQLException {
724         return false;
725     }
726 
727     @Override
728     public boolean supportsLimitedOuterJoins() throws SQLException {
729         return false;
730     }
731 
732     @Override
733     public boolean supportsMinimumSQLGrammar() throws SQLException {
734         return false;
735     }
736 
737     @Override
738     public boolean supportsMixedCaseIdentifiers() throws SQLException {
739         return false;
740     }
741 
742     @Override
743     public boolean supportsMixedCaseQuotedIdentifiers() throws SQLException {
744         return false;
745     }
746 
747     @Override
748     public boolean supportsMultipleOpenResults() throws SQLException {
749         return false;
750     }
751 
752     @Override
753     public boolean supportsMultipleResultSets() throws SQLException {
754         return false;
755     }
756 
757     @Override
758     public boolean supportsMultipleTransactions() throws SQLException {
759         return false;
760     }
761 
762     @Override
763     public boolean supportsNamedParameters() throws SQLException {
764         return false;
765     }
766 
767     @Override
768     public boolean supportsNonNullableColumns() throws SQLException {
769         return false;
770     }
771 
772     @Override
773     public boolean supportsOpenCursorsAcrossCommit() throws SQLException {
774         return false;
775     }
776 
777     @Override
778     public boolean supportsOpenCursorsAcrossRollback() throws SQLException {
779         return false;
780     }
781 
782     @Override
783     public boolean supportsOpenStatementsAcrossCommit() throws SQLException {
784         return false;
785     }
786 
787     @Override
788     public boolean supportsOpenStatementsAcrossRollback() throws SQLException {
789         return false;
790     }
791 
792     @Override
793     public boolean supportsOrderByUnrelated() throws SQLException {
794         return false;
795     }
796 
797     @Override
798     public boolean supportsOuterJoins() throws SQLException {
799         return false;
800     }
801 
802     @Override
803     public boolean supportsPositionedDelete() throws SQLException {
804         return false;
805     }
806 
807     @Override
808     public boolean supportsPositionedUpdate() throws SQLException {
809         return false;
810     }
811 
812     @Override
813     public boolean supportsResultSetConcurrency(final int type, final int concurrency)
814             throws SQLException {
815         return false;
816     }
817 
818     @Override
819     public boolean supportsResultSetHoldability(final int holdability)
820             throws SQLException {
821         return false;
822     }
823 
824     @Override
825     public boolean supportsResultSetType(final int type) throws SQLException {
826         return false;
827     }
828 
829     @Override
830     public boolean supportsSavepoints() throws SQLException {
831         return false;
832     }
833 
834     @Override
835     public boolean supportsSchemasInDataManipulation() throws SQLException {
836         return false;
837     }
838 
839     @Override
840     public boolean supportsSchemasInIndexDefinitions() throws SQLException {
841         return false;
842     }
843 
844     @Override
845     public boolean supportsSchemasInPrivilegeDefinitions() throws SQLException {
846         return false;
847     }
848 
849     @Override
850     public boolean supportsSchemasInProcedureCalls() throws SQLException {
851         return false;
852     }
853 
854     @Override
855     public boolean supportsSchemasInTableDefinitions() throws SQLException {
856         return false;
857     }
858 
859     @Override
860     public boolean supportsSelectForUpdate() throws SQLException {
861         return false;
862     }
863 
864     @Override
865     public boolean supportsStatementPooling() throws SQLException {
866         return false;
867     }
868 
869     @Override
870     public boolean supportsStoredFunctionsUsingCallSyntax() throws SQLException {
871         return false;
872     }
873 
874     @Override
875     public boolean supportsStoredProcedures() throws SQLException {
876         return false;
877     }
878 
879     @Override
880     public boolean supportsSubqueriesInComparisons() throws SQLException {
881         return false;
882     }
883 
884     @Override
885     public boolean supportsSubqueriesInExists() throws SQLException {
886         return false;
887     }
888 
889     @Override
890     public boolean supportsSubqueriesInIns() throws SQLException {
891         return false;
892     }
893 
894     @Override
895     public boolean supportsSubqueriesInQuantifieds() throws SQLException {
896         return false;
897     }
898 
899     @Override
900     public boolean supportsTableCorrelationNames() throws SQLException {
901         return false;
902     }
903 
904     @Override
905     public boolean supportsTransactionIsolationLevel(final int level)
906             throws SQLException {
907         return false;
908     }
909 
910     @Override
911     public boolean supportsTransactions() throws SQLException {
912         return false;
913     }
914 
915     @Override
916     public boolean supportsUnion() throws SQLException {
917         return false;
918     }
919 
920     @Override
921     public boolean supportsUnionAll() throws SQLException {
922         return false;
923     }
924 
925     @Override
926     public <T> T unwrap(final Class<T> iface) throws SQLException {
927         return null;
928     }
929 
930     @Override
931     public boolean updatesAreDetected(final int type) throws SQLException {
932         return false;
933     }
934 
935     @Override
936     public boolean usesLocalFilePerTable() throws SQLException {
937         return false;
938     }
939 
940     @Override
941     public boolean usesLocalFiles() throws SQLException {
942         return false;
943     }
944 }