File: DelegatingDatabaseMetaData.java

package info (click to toggle)
tomcat11 11.0.18-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 47,520 kB
  • sloc: java: 370,500; xml: 56,763; jsp: 4,787; sh: 1,304; perl: 324; makefile: 25; ansic: 14
file content (1048 lines) | stat: -rw-r--r-- 35,740 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
/*
 * Licensed to the Apache Software Foundation (ASF) under one or more
 * contributor license agreements.  See the NOTICE file distributed with
 * this work for additional information regarding copyright ownership.
 * The ASF licenses this file to You under the Apache License, Version 2.0
 * (the "License"); you may not use this file except in compliance with
 * the License.  You may obtain a copy of the License at
 *
 *      https://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package org.apache.tomcat.dbcp.dbcp2;

import java.sql.Connection;
import java.sql.DatabaseMetaData;
import java.sql.ResultSet;
import java.sql.RowIdLifetime;
import java.sql.SQLException;
import java.util.Objects;
import java.util.concurrent.Callable;

/**
 * <p>
 * A base delegating implementation of {@link DatabaseMetaData}.
 * </p>
 * <p>
 * Methods that create {@link ResultSet} objects are wrapped to create {@link DelegatingResultSet} objects and the remaining methods simply call the
 * corresponding method on the "delegate" provided in the constructor.
 * </p>
 *
 * @since 2.0
 */
public class DelegatingDatabaseMetaData implements DatabaseMetaData {

    /** My delegate {@link DatabaseMetaData} */
    private final DatabaseMetaData databaseMetaData;

    /** The connection that created me. **/
    private final DelegatingConnection<?> connection;

    /**
     * Constructs a new instance for the given delegating connection and database meta data.
     *
     * @param connection       the delegating connection
     * @param databaseMetaData the database meta data
     */
    public DelegatingDatabaseMetaData(final DelegatingConnection<?> connection, final DatabaseMetaData databaseMetaData) {
        this.connection = Objects.requireNonNull(connection, "connection");
        this.databaseMetaData = Objects.requireNonNull(databaseMetaData, "databaseMetaData");
    }

    @Override
    public boolean allProceduresAreCallable() throws SQLException {
        return getB(databaseMetaData::allProceduresAreCallable);
    }

    @Override
    public boolean allTablesAreSelectable() throws SQLException {
        return getB(databaseMetaData::allTablesAreSelectable);
    }

    @Override
    public boolean autoCommitFailureClosesAllResultSets() throws SQLException {
        return getB(databaseMetaData::autoCommitFailureClosesAllResultSets);
    }

    @Override
    public boolean dataDefinitionCausesTransactionCommit() throws SQLException {
        return getB(databaseMetaData::dataDefinitionCausesTransactionCommit);
    }

    @Override
    public boolean dataDefinitionIgnoredInTransactions() throws SQLException {
        return getB(databaseMetaData::dataDefinitionIgnoredInTransactions);
    }

    @Override
    public boolean deletesAreDetected(final int type) throws SQLException {
        return getB(() -> Boolean.valueOf(databaseMetaData.deletesAreDetected(type)));
    }

    @Override
    public boolean doesMaxRowSizeIncludeBlobs() throws SQLException {
        return getB(databaseMetaData::doesMaxRowSizeIncludeBlobs);
    }

    @Override
    public boolean generatedKeyAlwaysReturned() throws SQLException {
        connection.checkOpen();
        return getB(() -> Boolean.valueOf(Jdbc41Bridge.generatedKeyAlwaysReturned(databaseMetaData)));
    }

    private <T> T get(final Callable<T> s) throws SQLException {
        return get(s, null);
    }

    private <T> T get(final Callable<T> s, final T defaultValue) throws SQLException {
        try {
            return s.call();
        } catch (final Exception e) {
            if (e instanceof SQLException) {
                handleException((SQLException) e);
            }
            return defaultValue;
        }
    }

    @Override
    public ResultSet getAttributes(final String catalog, final String schemaPattern, final String typeNamePattern, final String attributeNamePattern)
            throws SQLException {
        return getRS(() -> databaseMetaData.getAttributes(catalog, schemaPattern, typeNamePattern, attributeNamePattern));
    }

    private boolean getB(final Callable<Boolean> s) throws SQLException {
        return get(s, Boolean.FALSE).booleanValue();
    }

    @Override
    public ResultSet getBestRowIdentifier(final String catalog, final String schema, final String table, final int scope, final boolean nullable)
            throws SQLException {
        return getRS(() -> databaseMetaData.getBestRowIdentifier(catalog, schema, table, scope, nullable));
    }

    @Override
    public ResultSet getCatalogs() throws SQLException {
        return getRS(databaseMetaData::getCatalogs);
    }

    @Override
    public String getCatalogSeparator() throws SQLException {
        return get(databaseMetaData::getCatalogSeparator);
    }

    @Override
    public String getCatalogTerm() throws SQLException {
        return get(databaseMetaData::getCatalogTerm);
    }

    @Override
    public ResultSet getClientInfoProperties() throws SQLException {
        return getRS(databaseMetaData::getClientInfoProperties);
    }

    @Override
    public ResultSet getColumnPrivileges(final String catalog, final String schema, final String table, final String columnNamePattern) throws SQLException {
        return getRS(() -> databaseMetaData.getColumnPrivileges(catalog, schema, table, columnNamePattern));
    }

    @Override
    public ResultSet getColumns(final String catalog, final String schemaPattern, final String tableNamePattern, final String columnNamePattern)
            throws SQLException {
        return getRS(() -> databaseMetaData.getColumns(catalog, schemaPattern, tableNamePattern, columnNamePattern));
    }

    @Override
    public Connection getConnection() throws SQLException {
        return connection;
    }

    @Override
    public ResultSet getCrossReference(final String parentCatalog, final String parentSchema, final String parentTable, final String foreignCatalog,
            final String foreignSchema, final String foreignTable) throws SQLException {
        return getRS(() -> databaseMetaData.getCrossReference(parentCatalog, parentSchema, parentTable, foreignCatalog, foreignSchema, foreignTable));
    }

    @Override
    public int getDatabaseMajorVersion() throws SQLException {
        return getI(databaseMetaData::getDatabaseMajorVersion);
    }

    @Override
    public int getDatabaseMinorVersion() throws SQLException {
        return getI(databaseMetaData::getDatabaseMinorVersion);
    }

    @Override
    public String getDatabaseProductName() throws SQLException {
        return get(databaseMetaData::getDatabaseProductName);
    }

    @Override
    public String getDatabaseProductVersion() throws SQLException {
        return get(databaseMetaData::getDatabaseProductVersion);
    }

    @Override
    public int getDefaultTransactionIsolation() throws SQLException {
        return getI(databaseMetaData::getDefaultTransactionIsolation);
    }

    /**
     * Gets the underlying database meta data.
     *
     * @return The underlying database meta data.
     */
    public DatabaseMetaData getDelegate() {
        return databaseMetaData;
    }

    @Override
    public int getDriverMajorVersion() {
        return databaseMetaData.getDriverMajorVersion();
    }

    @Override
    public int getDriverMinorVersion() {
        return databaseMetaData.getDriverMinorVersion();
    }

    @Override
    public String getDriverName() throws SQLException {
        return get(databaseMetaData::getDriverName);
    }

    @Override
    public String getDriverVersion() throws SQLException {
        return get(databaseMetaData::getDriverVersion);
    }

    @Override
    public ResultSet getExportedKeys(final String catalog, final String schema, final String table) throws SQLException {
        return getRS(() -> databaseMetaData.getExportedKeys(catalog, schema, table));
    }

    @Override
    public String getExtraNameCharacters() throws SQLException {
        return get(databaseMetaData::getExtraNameCharacters);
    }

    @Override
    public ResultSet getFunctionColumns(final String catalog, final String schemaPattern, final String functionNamePattern, final String columnNamePattern)
            throws SQLException {
        return getRS(() -> databaseMetaData.getFunctionColumns(catalog, schemaPattern, functionNamePattern, columnNamePattern));
    }

    @Override
    public ResultSet getFunctions(final String catalog, final String schemaPattern, final String functionNamePattern) throws SQLException {
        return getRS(() -> databaseMetaData.getFunctions(catalog, schemaPattern, functionNamePattern));
    }

    private int getI(final Callable<Integer> s) throws SQLException {
        return get(s, Integer.valueOf(0)).intValue();
    }

    @Override
    public String getIdentifierQuoteString() throws SQLException {
        return get(databaseMetaData::getIdentifierQuoteString);
    }

    @Override
    public ResultSet getImportedKeys(final String catalog, final String schema, final String table) throws SQLException {
        return getRS(() -> databaseMetaData.getImportedKeys(catalog, schema, table));
    }

    @Override
    public ResultSet getIndexInfo(final String catalog, final String schema, final String table, final boolean unique, final boolean approximate)
            throws SQLException {
        return getRS(() -> databaseMetaData.getIndexInfo(catalog, schema, table, unique, approximate));
    }

    /**
     * If my underlying {@link ResultSet} is not a {@link DelegatingResultSet}, returns it, otherwise recursively invokes this method on my delegate.
     * <p>
     * Hence this method will return the first delegate that is not a {@link DelegatingResultSet}, or {@code null} when no non-{@link DelegatingResultSet}
     * delegate can be found by traversing this chain.
     * </p>
     * <p>
     * This method is useful when you may have nested {@link DelegatingResultSet}s, and you want to make sure to obtain a "genuine" {@link ResultSet}.
     * </p>
     *
     * @return the innermost database meta data.
     */
    public DatabaseMetaData getInnermostDelegate() {
        DatabaseMetaData m = databaseMetaData;
        while (m instanceof DelegatingDatabaseMetaData) {
            m = ((DelegatingDatabaseMetaData) m).getDelegate();
            if (this == m) {
                return null;
            }
        }
        return m;
    }

    @Override
    public int getJDBCMajorVersion() throws SQLException {
        return getI(databaseMetaData::getJDBCMajorVersion);
    }

    @Override
    public int getJDBCMinorVersion() throws SQLException {
        return getI(databaseMetaData::getJDBCMinorVersion);
    }

    private long getL(final Callable<Long> s) throws SQLException {
        return get(s, Long.valueOf(0)).longValue();
    }

    @Override
    public int getMaxBinaryLiteralLength() throws SQLException {
        return getI(databaseMetaData::getMaxBinaryLiteralLength);
    }

    @Override
    public int getMaxCatalogNameLength() throws SQLException {
        return getI(databaseMetaData::getMaxCatalogNameLength);
    }

    @Override
    public int getMaxCharLiteralLength() throws SQLException {
        return getI(databaseMetaData::getMaxCharLiteralLength);
    }

    @Override
    public int getMaxColumnNameLength() throws SQLException {
        return getI(databaseMetaData::getMaxColumnNameLength);
    }

    @Override
    public int getMaxColumnsInGroupBy() throws SQLException {
        return getI(databaseMetaData::getMaxColumnsInGroupBy);
    }

    @Override
    public int getMaxColumnsInIndex() throws SQLException {
        return getI(databaseMetaData::getMaxColumnsInIndex);
    }

    @Override
    public int getMaxColumnsInOrderBy() throws SQLException {
        return getI(databaseMetaData::getMaxColumnsInOrderBy);
    }

    @Override
    public int getMaxColumnsInSelect() throws SQLException {
        return getI(databaseMetaData::getMaxColumnsInSelect);
    }

    @Override
    public int getMaxColumnsInTable() throws SQLException {
        return getI(databaseMetaData::getMaxColumnsInTable);
    }

    @Override
    public int getMaxConnections() throws SQLException {
        return getI(databaseMetaData::getMaxConnections);
    }

    @Override
    public int getMaxCursorNameLength() throws SQLException {
        return getI(databaseMetaData::getMaxCursorNameLength);
    }

    @Override
    public int getMaxIndexLength() throws SQLException {
        return getI(databaseMetaData::getMaxIndexLength);
    }

    /**
     * @since 2.5.0
     */
    @Override
    public long getMaxLogicalLobSize() throws SQLException {
        return getL(databaseMetaData::getMaxLogicalLobSize);
    }

    @Override
    public int getMaxProcedureNameLength() throws SQLException {
        return getI(databaseMetaData::getMaxProcedureNameLength);
    }

    @Override
    public int getMaxRowSize() throws SQLException {
        return getI(databaseMetaData::getMaxRowSize);
    }

    @Override
    public int getMaxSchemaNameLength() throws SQLException {
        return getI(databaseMetaData::getMaxSchemaNameLength);
    }

    @Override
    public int getMaxStatementLength() throws SQLException {
        return getI(databaseMetaData::getMaxStatementLength);
    }

    @Override
    public int getMaxStatements() throws SQLException {
        return getI(databaseMetaData::getMaxStatements);
    }

    @Override
    public int getMaxTableNameLength() throws SQLException {
        return getI(databaseMetaData::getMaxTableNameLength);
    }

    @Override
    public int getMaxTablesInSelect() throws SQLException {
        return getI(databaseMetaData::getMaxTablesInSelect);
    }

    @Override
    public int getMaxUserNameLength() throws SQLException {
        return getI(databaseMetaData::getMaxUserNameLength);
    }

    @Override
    public String getNumericFunctions() throws SQLException {
        return get(databaseMetaData::getNumericFunctions);
    }

    @Override
    public ResultSet getPrimaryKeys(final String catalog, final String schema, final String table) throws SQLException {
        return getRS(() -> databaseMetaData.getPrimaryKeys(catalog, schema, table));
    }

    @Override
    public ResultSet getProcedureColumns(final String catalog, final String schemaPattern, final String procedureNamePattern, final String columnNamePattern)
            throws SQLException {
        return getRS(() -> databaseMetaData.getProcedureColumns(catalog, schemaPattern, procedureNamePattern, columnNamePattern));
    }

    @Override
    public ResultSet getProcedures(final String catalog, final String schemaPattern, final String procedureNamePattern) throws SQLException {
        return getRS(() -> databaseMetaData.getProcedures(catalog, schemaPattern, procedureNamePattern));
    }

    @Override
    public String getProcedureTerm() throws SQLException {
        return get(databaseMetaData::getProcedureTerm);
    }

    @Override
    public ResultSet getPseudoColumns(final String catalog, final String schemaPattern, final String tableNamePattern, final String columnNamePattern)
            throws SQLException {
        return getRS(() -> Jdbc41Bridge.getPseudoColumns(databaseMetaData, catalog, schemaPattern, tableNamePattern, columnNamePattern));
    }

    @Override
    public int getResultSetHoldability() throws SQLException {
        return getI(databaseMetaData::getResultSetHoldability);
    }

    @Override
    public RowIdLifetime getRowIdLifetime() throws SQLException {
        return get(databaseMetaData::getRowIdLifetime);
    }

    private ResultSet getRS(final Callable<ResultSet> s) throws SQLException {
        connection.checkOpen();
        return DelegatingResultSet.wrapResultSet(connection, get(s));
    }

    @Override
    public ResultSet getSchemas() throws SQLException {
        return getRS(databaseMetaData::getSchemas);
    }

    @Override
    public ResultSet getSchemas(final String catalog, final String schemaPattern) throws SQLException {
        return getRS(() -> databaseMetaData.getSchemas(catalog, schemaPattern));
    }

    @Override
    public String getSchemaTerm() throws SQLException {
        return get(databaseMetaData::getSchemaTerm);
    }

    @Override
    public String getSearchStringEscape() throws SQLException {
        return get(databaseMetaData::getSearchStringEscape);
    }

    @Override
    public String getSQLKeywords() throws SQLException {
        return get(databaseMetaData::getSQLKeywords);
    }

    @Override
    public int getSQLStateType() throws SQLException {
        return getI(databaseMetaData::getSQLStateType);
    }

    @Override
    public String getStringFunctions() throws SQLException {
        return get(databaseMetaData::getStringFunctions);
    }

    @Override
    public ResultSet getSuperTables(final String catalog, final String schemaPattern, final String tableNamePattern) throws SQLException {
        return getRS(() -> databaseMetaData.getSuperTables(catalog, schemaPattern, tableNamePattern));
    }

    @Override
    public ResultSet getSuperTypes(final String catalog, final String schemaPattern, final String typeNamePattern) throws SQLException {
        return getRS(() -> databaseMetaData.getSuperTypes(catalog, schemaPattern, typeNamePattern));
    }

    @Override
    public String getSystemFunctions() throws SQLException {
        return get(databaseMetaData::getSystemFunctions);
    }

    @Override
    public ResultSet getTablePrivileges(final String catalog, final String schemaPattern, final String tableNamePattern) throws SQLException {
        return getRS(() -> databaseMetaData.getTablePrivileges(catalog, schemaPattern, tableNamePattern));
    }

    @Override
    public ResultSet getTables(final String catalog, final String schemaPattern, final String tableNamePattern, final String[] types) throws SQLException {
        return getRS(() -> databaseMetaData.getTables(catalog, schemaPattern, tableNamePattern, types));
    }

    @Override
    public ResultSet getTableTypes() throws SQLException {
        return getRS(databaseMetaData::getTableTypes);
    }

    @Override
    public String getTimeDateFunctions() throws SQLException {
        return get(databaseMetaData::getTimeDateFunctions);
    }

    @Override
    public ResultSet getTypeInfo() throws SQLException {
        return getRS(databaseMetaData::getTypeInfo);
    }

    @Override
    public ResultSet getUDTs(final String catalog, final String schemaPattern, final String typeNamePattern, final int[] types) throws SQLException {
        return getRS(() -> databaseMetaData.getUDTs(catalog, schemaPattern, typeNamePattern, types));
    }

    @Override
    public String getURL() throws SQLException {
        return get(databaseMetaData::getURL);
    }

    @Override
    public String getUserName() throws SQLException {
        return get(databaseMetaData::getUserName);
    }

    @Override
    public ResultSet getVersionColumns(final String catalog, final String schema, final String table) throws SQLException {
        return getRS(() -> databaseMetaData.getVersionColumns(catalog, schema, table));
    }

    /**
     * Delegates to the connection's {@link DelegatingConnection#handleException(SQLException)}.
     *
     * @param e the exception to throw or delegate.
     * @throws SQLException the exception to throw.
     */
    protected void handleException(final SQLException e) throws SQLException {
        if (connection == null) {
            throw e;
        }
        connection.handleException(e);
    }

    @Override
    public boolean insertsAreDetected(final int type) throws SQLException {
        return getB(() -> Boolean.valueOf(databaseMetaData.insertsAreDetected(type)));
    }

    @Override
    public boolean isCatalogAtStart() throws SQLException {
        return getB(databaseMetaData::isCatalogAtStart);
    }

    @Override
    public boolean isReadOnly() throws SQLException {
        return getB(databaseMetaData::isReadOnly);
    }

    @Override
    public boolean isWrapperFor(final Class<?> iface) throws SQLException {
        if (iface.isAssignableFrom(getClass()) || iface.isAssignableFrom(databaseMetaData.getClass())) {
            return true;
        }
        return databaseMetaData.isWrapperFor(iface);
    }

    @Override
    public boolean locatorsUpdateCopy() throws SQLException {
        return getB(databaseMetaData::locatorsUpdateCopy);
    }

    @Override
    public boolean nullPlusNonNullIsNull() throws SQLException {
        return getB(databaseMetaData::nullPlusNonNullIsNull);
    }

    @Override
    public boolean nullsAreSortedAtEnd() throws SQLException {
        return getB(databaseMetaData::nullsAreSortedAtEnd);
    }

    @Override
    public boolean nullsAreSortedAtStart() throws SQLException {
        return getB(databaseMetaData::nullsAreSortedAtStart);
    }

    @Override
    public boolean nullsAreSortedHigh() throws SQLException {
        return getB(databaseMetaData::nullsAreSortedHigh);
    }

    @Override
    public boolean nullsAreSortedLow() throws SQLException {
        return getB(databaseMetaData::nullsAreSortedLow);
    }

    @Override
    public boolean othersDeletesAreVisible(final int type) throws SQLException {
        return getB(() -> Boolean.valueOf(databaseMetaData.othersDeletesAreVisible(type)));
    }

    @Override
    public boolean othersInsertsAreVisible(final int type) throws SQLException {
        return getB(() -> Boolean.valueOf(databaseMetaData.othersInsertsAreVisible(type)));
    }

    @Override
    public boolean othersUpdatesAreVisible(final int type) throws SQLException {
        return getB(() -> Boolean.valueOf(databaseMetaData.othersUpdatesAreVisible(type)));
    }

    @Override
    public boolean ownDeletesAreVisible(final int type) throws SQLException {
        return getB(() -> Boolean.valueOf(databaseMetaData.ownDeletesAreVisible(type)));
    }

    @Override
    public boolean ownInsertsAreVisible(final int type) throws SQLException {
        return getB(() -> Boolean.valueOf(databaseMetaData.ownInsertsAreVisible(type)));
    }

    @Override
    public boolean ownUpdatesAreVisible(final int type) throws SQLException {
        return getB(() -> Boolean.valueOf(databaseMetaData.ownUpdatesAreVisible(type)));
    }

    @Override
    public boolean storesLowerCaseIdentifiers() throws SQLException {
        return getB(databaseMetaData::storesLowerCaseIdentifiers);
    }

    @Override
    public boolean storesLowerCaseQuotedIdentifiers() throws SQLException {
        return getB(databaseMetaData::storesLowerCaseQuotedIdentifiers);
    }

    @Override
    public boolean storesMixedCaseIdentifiers() throws SQLException {
        return getB(databaseMetaData::storesMixedCaseIdentifiers);
    }

    @Override
    public boolean storesMixedCaseQuotedIdentifiers() throws SQLException {
        return getB(databaseMetaData::storesMixedCaseQuotedIdentifiers);
    }

    @Override
    public boolean storesUpperCaseIdentifiers() throws SQLException {
        return getB(databaseMetaData::storesUpperCaseIdentifiers);

    }

    @Override
    public boolean storesUpperCaseQuotedIdentifiers() throws SQLException {
        return getB(databaseMetaData::storesUpperCaseQuotedIdentifiers);
    }

    @Override
    public boolean supportsAlterTableWithAddColumn() throws SQLException {
        return getB(databaseMetaData::supportsAlterTableWithAddColumn);
    }

    @Override
    public boolean supportsAlterTableWithDropColumn() throws SQLException {
        return getB(databaseMetaData::supportsAlterTableWithDropColumn);
    }

    @Override
    public boolean supportsANSI92EntryLevelSQL() throws SQLException {
        return getB(databaseMetaData::supportsANSI92EntryLevelSQL);
    }

    @Override
    public boolean supportsANSI92FullSQL() throws SQLException {
        return getB(databaseMetaData::supportsANSI92FullSQL);
    }

    @Override
    public boolean supportsANSI92IntermediateSQL() throws SQLException {
        return getB(databaseMetaData::supportsANSI92IntermediateSQL);
    }

    @Override
    public boolean supportsBatchUpdates() throws SQLException {
        return getB(databaseMetaData::supportsBatchUpdates);
    }

    @Override
    public boolean supportsCatalogsInDataManipulation() throws SQLException {
        return getB(databaseMetaData::supportsCatalogsInDataManipulation);
    }

    @Override
    public boolean supportsCatalogsInIndexDefinitions() throws SQLException {
        return getB(databaseMetaData::supportsCatalogsInIndexDefinitions);
    }

    @Override
    public boolean supportsCatalogsInPrivilegeDefinitions() throws SQLException {
        return getB(databaseMetaData::supportsCatalogsInPrivilegeDefinitions);
    }

    @Override
    public boolean supportsCatalogsInProcedureCalls() throws SQLException {
        return getB(databaseMetaData::supportsCatalogsInProcedureCalls);
    }

    @Override
    public boolean supportsCatalogsInTableDefinitions() throws SQLException {
        return getB(databaseMetaData::supportsCatalogsInTableDefinitions);
    }

    @Override
    public boolean supportsColumnAliasing() throws SQLException {
        return getB(databaseMetaData::supportsColumnAliasing);
    }

    @Override
    public boolean supportsConvert() throws SQLException {
        return getB(databaseMetaData::supportsConvert);
    }

    @Override
    public boolean supportsConvert(final int fromType, final int toType) throws SQLException {
        return getB(() -> Boolean.valueOf(databaseMetaData.supportsConvert(fromType, toType)));
    }

    @Override
    public boolean supportsCoreSQLGrammar() throws SQLException {
        return getB(databaseMetaData::supportsCoreSQLGrammar);
    }

    @Override
    public boolean supportsCorrelatedSubqueries() throws SQLException {
        return getB(databaseMetaData::supportsCorrelatedSubqueries);
    }

    @Override
    public boolean supportsDataDefinitionAndDataManipulationTransactions() throws SQLException {
        return getB(databaseMetaData::supportsDataDefinitionAndDataManipulationTransactions);
    }

    @Override
    public boolean supportsDataManipulationTransactionsOnly() throws SQLException {
        return getB(databaseMetaData::supportsDataManipulationTransactionsOnly);
    }

    @Override
    public boolean supportsDifferentTableCorrelationNames() throws SQLException {
        return getB(databaseMetaData::supportsDifferentTableCorrelationNames);
    }

    @Override
    public boolean supportsExpressionsInOrderBy() throws SQLException {
        return getB(databaseMetaData::supportsExpressionsInOrderBy);
    }

    @Override
    public boolean supportsExtendedSQLGrammar() throws SQLException {
        return getB(databaseMetaData::supportsExtendedSQLGrammar);
    }

    @Override
    public boolean supportsFullOuterJoins() throws SQLException {
        return getB(databaseMetaData::supportsFullOuterJoins);
    }

    @Override
    public boolean supportsGetGeneratedKeys() throws SQLException {
        return getB(databaseMetaData::supportsGetGeneratedKeys);
    }

    @Override
    public boolean supportsGroupBy() throws SQLException {
        return getB(databaseMetaData::supportsGroupBy);
    }

    @Override
    public boolean supportsGroupByBeyondSelect() throws SQLException {
        return getB(databaseMetaData::supportsGroupByBeyondSelect);
    }

    @Override
    public boolean supportsGroupByUnrelated() throws SQLException {
        return getB(databaseMetaData::supportsGroupByUnrelated);
    }

    @Override
    public boolean supportsIntegrityEnhancementFacility() throws SQLException {
        return getB(databaseMetaData::supportsIntegrityEnhancementFacility);
    }

    @Override
    public boolean supportsLikeEscapeClause() throws SQLException {
        return getB(databaseMetaData::supportsLikeEscapeClause);
    }

    @Override
    public boolean supportsLimitedOuterJoins() throws SQLException {
        return getB(databaseMetaData::supportsLimitedOuterJoins);
    }

    @Override
    public boolean supportsMinimumSQLGrammar() throws SQLException {
        return getB(databaseMetaData::supportsMinimumSQLGrammar);
    }

    @Override
    public boolean supportsMixedCaseIdentifiers() throws SQLException {
        return getB(databaseMetaData::supportsMixedCaseIdentifiers);
    }

    @Override
    public boolean supportsMixedCaseQuotedIdentifiers() throws SQLException {
        return getB(databaseMetaData::supportsMixedCaseQuotedIdentifiers);
    }

    @Override
    public boolean supportsMultipleOpenResults() throws SQLException {
        return getB(databaseMetaData::supportsMultipleOpenResults);
    }

    @Override
    public boolean supportsMultipleResultSets() throws SQLException {
        return getB(databaseMetaData::supportsMultipleResultSets);
    }

    @Override
    public boolean supportsMultipleTransactions() throws SQLException {
        return getB(databaseMetaData::supportsMultipleTransactions);
    }

    @Override
    public boolean supportsNamedParameters() throws SQLException {
        return getB(databaseMetaData::supportsNamedParameters);
    }

    @Override
    public boolean supportsNonNullableColumns() throws SQLException {
        return getB(databaseMetaData::supportsNonNullableColumns);
    }

    @Override
    public boolean supportsOpenCursorsAcrossCommit() throws SQLException {
        return getB(databaseMetaData::supportsOpenCursorsAcrossCommit);
    }

    @Override
    public boolean supportsOpenCursorsAcrossRollback() throws SQLException {
        return getB(databaseMetaData::supportsOpenCursorsAcrossRollback);
    }

    @Override
    public boolean supportsOpenStatementsAcrossCommit() throws SQLException {
        return getB(databaseMetaData::supportsOpenStatementsAcrossCommit);
    }

    @Override
    public boolean supportsOpenStatementsAcrossRollback() throws SQLException {
        return getB(databaseMetaData::supportsOpenStatementsAcrossRollback);
    }

    @Override
    public boolean supportsOrderByUnrelated() throws SQLException {
        return getB(databaseMetaData::supportsOrderByUnrelated);
    }

    @Override
    public boolean supportsOuterJoins() throws SQLException {
        return getB(databaseMetaData::supportsOuterJoins);
    }

    @Override
    public boolean supportsPositionedDelete() throws SQLException {
        return getB(databaseMetaData::supportsPositionedDelete);
    }

    @Override
    public boolean supportsPositionedUpdate() throws SQLException {
        return getB(databaseMetaData::supportsPositionedUpdate);
    }

    /**
     * @since 2.5.0
     */
    @Override
    public boolean supportsRefCursors() throws SQLException {
        return getB(databaseMetaData::supportsRefCursors);
    }

    @Override
    public boolean supportsResultSetConcurrency(final int type, final int concurrency) throws SQLException {
        return getB(() -> Boolean.valueOf(databaseMetaData.supportsResultSetConcurrency(type, concurrency)));
    }

    @Override
    public boolean supportsResultSetHoldability(final int holdability) throws SQLException {
        return getB(() -> Boolean.valueOf(databaseMetaData.supportsResultSetHoldability(holdability)));
    }

    @Override
    public boolean supportsResultSetType(final int type) throws SQLException {
        return getB(() -> Boolean.valueOf(databaseMetaData.supportsResultSetType(type)));
    }

    @Override
    public boolean supportsSavepoints() throws SQLException {
        return getB(databaseMetaData::supportsSavepoints);
    }

    @Override
    public boolean supportsSchemasInDataManipulation() throws SQLException {
        return getB(databaseMetaData::supportsSchemasInDataManipulation);
    }

    @Override
    public boolean supportsSchemasInIndexDefinitions() throws SQLException {
        return getB(databaseMetaData::supportsSchemasInIndexDefinitions);
    }

    @Override
    public boolean supportsSchemasInPrivilegeDefinitions() throws SQLException {
        return getB(databaseMetaData::supportsSchemasInPrivilegeDefinitions);
    }

    @Override
    public boolean supportsSchemasInProcedureCalls() throws SQLException {
        return getB(databaseMetaData::supportsSchemasInProcedureCalls);
    }

    @Override
    public boolean supportsSchemasInTableDefinitions() throws SQLException {
        return getB(databaseMetaData::supportsSchemasInTableDefinitions);
    }

    @Override
    public boolean supportsSelectForUpdate() throws SQLException {
        return getB(databaseMetaData::supportsSelectForUpdate);
    }

    @Override
    public boolean supportsStatementPooling() throws SQLException {
        return getB(databaseMetaData::supportsStatementPooling);
    }

    @Override
    public boolean supportsStoredFunctionsUsingCallSyntax() throws SQLException {
        return getB(databaseMetaData::supportsStoredFunctionsUsingCallSyntax);
    }

    @Override
    public boolean supportsStoredProcedures() throws SQLException {
        return getB(databaseMetaData::supportsStoredProcedures);
    }

    @Override
    public boolean supportsSubqueriesInComparisons() throws SQLException {
        return getB(databaseMetaData::supportsSubqueriesInComparisons);
    }

    @Override
    public boolean supportsSubqueriesInExists() throws SQLException {
        return getB(databaseMetaData::supportsSubqueriesInExists);
    }

    @Override
    public boolean supportsSubqueriesInIns() throws SQLException {
        return getB(databaseMetaData::supportsSubqueriesInIns);
    }

    @Override
    public boolean supportsSubqueriesInQuantifieds() throws SQLException {
        return getB(databaseMetaData::supportsSubqueriesInQuantifieds);
    }

    @Override
    public boolean supportsTableCorrelationNames() throws SQLException {
        return getB(databaseMetaData::supportsTableCorrelationNames);
    }

    @Override
    public boolean supportsTransactionIsolationLevel(final int level) throws SQLException {
        return getB(() -> Boolean.valueOf(databaseMetaData.supportsTransactionIsolationLevel(level)));
    }

    @Override
    public boolean supportsTransactions() throws SQLException {
        return getB(databaseMetaData::supportsTransactions);
    }

    @Override
    public boolean supportsUnion() throws SQLException {
        return getB(databaseMetaData::supportsUnion);
    }

    @Override
    public boolean supportsUnionAll() throws SQLException {
        return getB(databaseMetaData::supportsUnionAll);
    }

    @Override
    public <T> T unwrap(final Class<T> iface) throws SQLException {
        if (iface.isAssignableFrom(getClass())) {
            return iface.cast(this);
        }
        if (iface.isAssignableFrom(databaseMetaData.getClass())) {
            return iface.cast(databaseMetaData);
        }
        return databaseMetaData.unwrap(iface);
    }

    @Override
    public boolean updatesAreDetected(final int type) throws SQLException {
        return getB(() -> Boolean.valueOf(databaseMetaData.updatesAreDetected(type)));
    }

    @Override
    public boolean usesLocalFilePerTable() throws SQLException {
        return getB(databaseMetaData::usesLocalFilePerTable);
    }

    @Override
    public boolean usesLocalFiles() throws SQLException {
        return getB(databaseMetaData::usesLocalFiles);
    }
}