001/* 002 * Licensed to the Apache Software Foundation (ASF) under one or more 003 * contributor license agreements. See the NOTICE file distributed with 004 * this work for additional information regarding copyright ownership. 005 * The ASF licenses this file to You under the Apache License, Version 2.0 006 * (the "License"); you may not use this file except in compliance with 007 * the License. You may obtain a copy of the License at 008 * 009 * https://www.apache.org/licenses/LICENSE-2.0 010 * 011 * Unless required by applicable law or agreed to in writing, software 012 * distributed under the License is distributed on an "AS IS" BASIS, 013 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 014 * See the License for the specific language governing permissions and 015 * limitations under the License. 016 */ 017package org.apache.commons.dbcp2; 018 019import java.sql.Connection; 020import java.sql.DatabaseMetaData; 021import java.sql.ResultSet; 022import java.sql.RowIdLifetime; 023import java.sql.SQLException; 024import java.util.Objects; 025import java.util.concurrent.Callable; 026 027/** 028 * <p> 029 * A base delegating implementation of {@link DatabaseMetaData}. 030 * </p> 031 * <p> 032 * Methods that create {@link ResultSet} objects are wrapped to create {@link DelegatingResultSet} objects and the remaining methods simply call the 033 * corresponding method on the "delegate" provided in the constructor. 034 * </p> 035 * 036 * @since 2.0 037 */ 038public class DelegatingDatabaseMetaData implements DatabaseMetaData { 039 040 /** My delegate {@link DatabaseMetaData} */ 041 private final DatabaseMetaData databaseMetaData; 042 043 /** The connection that created me. **/ 044 private final DelegatingConnection<?> connection; 045 046 /** 047 * Constructs a new instance for the given delegating connection and database meta data. 048 * 049 * @param connection the delegating connection 050 * @param databaseMetaData the database meta data 051 */ 052 public DelegatingDatabaseMetaData(final DelegatingConnection<?> connection, final DatabaseMetaData databaseMetaData) { 053 this.connection = Objects.requireNonNull(connection, "connection"); 054 this.databaseMetaData = Objects.requireNonNull(databaseMetaData, "databaseMetaData"); 055 } 056 057 @Override 058 public boolean allProceduresAreCallable() throws SQLException { 059 return getB(databaseMetaData::allProceduresAreCallable); 060 } 061 062 @Override 063 public boolean allTablesAreSelectable() throws SQLException { 064 return getB(databaseMetaData::allTablesAreSelectable); 065 } 066 067 @Override 068 public boolean autoCommitFailureClosesAllResultSets() throws SQLException { 069 return getB(databaseMetaData::autoCommitFailureClosesAllResultSets); 070 } 071 072 @Override 073 public boolean dataDefinitionCausesTransactionCommit() throws SQLException { 074 return getB(databaseMetaData::dataDefinitionCausesTransactionCommit); 075 } 076 077 @Override 078 public boolean dataDefinitionIgnoredInTransactions() throws SQLException { 079 return getB(databaseMetaData::dataDefinitionIgnoredInTransactions); 080 } 081 082 @Override 083 public boolean deletesAreDetected(final int type) throws SQLException { 084 return getB(() -> databaseMetaData.deletesAreDetected(type)); 085 } 086 087 @Override 088 public boolean doesMaxRowSizeIncludeBlobs() throws SQLException { 089 return getB(databaseMetaData::doesMaxRowSizeIncludeBlobs); 090 } 091 092 @Override 093 public boolean generatedKeyAlwaysReturned() throws SQLException { 094 connection.checkOpen(); 095 return getB(() -> Jdbc41Bridge.generatedKeyAlwaysReturned(databaseMetaData)); 096 } 097 098 private <T> T get(final Callable<T> s) throws SQLException { 099 return get(s, null); 100 } 101 102 private <T> T get(final Callable<T> s, final T defaultValue) throws SQLException { 103 try { 104 return s.call(); 105 } catch (final Exception e) { 106 if (e instanceof SQLException) { 107 handleException((SQLException) e); 108 } 109 return defaultValue; 110 } 111 } 112 113 @Override 114 public ResultSet getAttributes(final String catalog, final String schemaPattern, final String typeNamePattern, final String attributeNamePattern) 115 throws SQLException { 116 return getRS(() -> databaseMetaData.getAttributes(catalog, schemaPattern, typeNamePattern, attributeNamePattern)); 117 } 118 119 private boolean getB(final Callable<Boolean> s) throws SQLException { 120 return get(s, false); 121 } 122 123 @Override 124 public ResultSet getBestRowIdentifier(final String catalog, final String schema, final String table, final int scope, final boolean nullable) 125 throws SQLException { 126 return getRS(() -> databaseMetaData.getBestRowIdentifier(catalog, schema, table, scope, nullable)); 127 } 128 129 @Override 130 public ResultSet getCatalogs() throws SQLException { 131 return getRS(databaseMetaData::getCatalogs); 132 } 133 134 @Override 135 public String getCatalogSeparator() throws SQLException { 136 return get(databaseMetaData::getCatalogSeparator); 137 } 138 139 @Override 140 public String getCatalogTerm() throws SQLException { 141 return get(databaseMetaData::getCatalogTerm); 142 } 143 144 @Override 145 public ResultSet getClientInfoProperties() throws SQLException { 146 return getRS(databaseMetaData::getClientInfoProperties); 147 } 148 149 @Override 150 public ResultSet getColumnPrivileges(final String catalog, final String schema, final String table, final String columnNamePattern) throws SQLException { 151 return getRS(() -> databaseMetaData.getColumnPrivileges(catalog, schema, table, columnNamePattern)); 152 } 153 154 @Override 155 public ResultSet getColumns(final String catalog, final String schemaPattern, final String tableNamePattern, final String columnNamePattern) 156 throws SQLException { 157 return getRS(() -> databaseMetaData.getColumns(catalog, schemaPattern, tableNamePattern, columnNamePattern)); 158 } 159 160 @Override 161 public Connection getConnection() throws SQLException { 162 return connection; 163 } 164 165 @Override 166 public ResultSet getCrossReference(final String parentCatalog, final String parentSchema, final String parentTable, final String foreignCatalog, 167 final String foreignSchema, final String foreignTable) throws SQLException { 168 return getRS(() -> databaseMetaData.getCrossReference(parentCatalog, parentSchema, parentTable, foreignCatalog, foreignSchema, foreignTable)); 169 } 170 171 @Override 172 public int getDatabaseMajorVersion() throws SQLException { 173 return getI(databaseMetaData::getDatabaseMajorVersion); 174 } 175 176 @Override 177 public int getDatabaseMinorVersion() throws SQLException { 178 return getI(databaseMetaData::getDatabaseMinorVersion); 179 } 180 181 @Override 182 public String getDatabaseProductName() throws SQLException { 183 return get(databaseMetaData::getDatabaseProductName); 184 } 185 186 @Override 187 public String getDatabaseProductVersion() throws SQLException { 188 return get(databaseMetaData::getDatabaseProductVersion); 189 } 190 191 @Override 192 public int getDefaultTransactionIsolation() throws SQLException { 193 return getI(databaseMetaData::getDefaultTransactionIsolation); 194 } 195 196 /** 197 * Gets the underlying database meta data. 198 * 199 * @return The underlying database meta data. 200 */ 201 public DatabaseMetaData getDelegate() { 202 return databaseMetaData; 203 } 204 205 @Override 206 public int getDriverMajorVersion() { 207 return databaseMetaData.getDriverMajorVersion(); 208 } 209 210 @Override 211 public int getDriverMinorVersion() { 212 return databaseMetaData.getDriverMinorVersion(); 213 } 214 215 @Override 216 public String getDriverName() throws SQLException { 217 return get(databaseMetaData::getDriverName); 218 } 219 220 @Override 221 public String getDriverVersion() throws SQLException { 222 return get(databaseMetaData::getDriverVersion); 223 } 224 225 @Override 226 public ResultSet getExportedKeys(final String catalog, final String schema, final String table) throws SQLException { 227 return getRS(() -> databaseMetaData.getExportedKeys(catalog, schema, table)); 228 } 229 230 @Override 231 public String getExtraNameCharacters() throws SQLException { 232 return get(databaseMetaData::getExtraNameCharacters); 233 } 234 235 @Override 236 public ResultSet getFunctionColumns(final String catalog, final String schemaPattern, final String functionNamePattern, final String columnNamePattern) 237 throws SQLException { 238 return getRS(() -> databaseMetaData.getFunctionColumns(catalog, schemaPattern, functionNamePattern, columnNamePattern)); 239 } 240 241 @Override 242 public ResultSet getFunctions(final String catalog, final String schemaPattern, final String functionNamePattern) throws SQLException { 243 return getRS(() -> databaseMetaData.getFunctions(catalog, schemaPattern, functionNamePattern)); 244 } 245 246 private int getI(final Callable<Integer> s) throws SQLException { 247 return get(s, 0); 248 } 249 250 @Override 251 public String getIdentifierQuoteString() throws SQLException { 252 return get(databaseMetaData::getIdentifierQuoteString); 253 } 254 255 @Override 256 public ResultSet getImportedKeys(final String catalog, final String schema, final String table) throws SQLException { 257 return getRS(() -> databaseMetaData.getImportedKeys(catalog, schema, table)); 258 } 259 260 @Override 261 public ResultSet getIndexInfo(final String catalog, final String schema, final String table, final boolean unique, final boolean approximate) 262 throws SQLException { 263 return getRS(() -> databaseMetaData.getIndexInfo(catalog, schema, table, unique, approximate)); 264 } 265 266 /** 267 * If my underlying {@link ResultSet} is not a {@link DelegatingResultSet}, returns it, otherwise recursively invokes this method on my delegate. 268 * <p> 269 * Hence this method will return the first delegate that is not a {@link DelegatingResultSet}, or {@code null} when no non-{@link DelegatingResultSet} 270 * delegate can be found by traversing this chain. 271 * </p> 272 * <p> 273 * This method is useful when you may have nested {@link DelegatingResultSet}s, and you want to make sure to obtain a "genuine" {@link ResultSet}. 274 * </p> 275 * 276 * @return the innermost database meta data. 277 */ 278 public DatabaseMetaData getInnermostDelegate() { 279 DatabaseMetaData m = databaseMetaData; 280 while (m instanceof DelegatingDatabaseMetaData) { 281 m = ((DelegatingDatabaseMetaData) m).getDelegate(); 282 if (this == m) { 283 return null; 284 } 285 } 286 return m; 287 } 288 289 @Override 290 public int getJDBCMajorVersion() throws SQLException { 291 return getI(databaseMetaData::getJDBCMajorVersion); 292 } 293 294 @Override 295 public int getJDBCMinorVersion() throws SQLException { 296 return getI(databaseMetaData::getJDBCMinorVersion); 297 } 298 299 private long getL(final Callable<Long> s) throws SQLException { 300 return get(s, 0L); 301 } 302 303 @Override 304 public int getMaxBinaryLiteralLength() throws SQLException { 305 return getI(databaseMetaData::getMaxBinaryLiteralLength); 306 } 307 308 @Override 309 public int getMaxCatalogNameLength() throws SQLException { 310 return getI(databaseMetaData::getMaxCatalogNameLength); 311 } 312 313 @Override 314 public int getMaxCharLiteralLength() throws SQLException { 315 return getI(databaseMetaData::getMaxCharLiteralLength); 316 } 317 318 @Override 319 public int getMaxColumnNameLength() throws SQLException { 320 return getI(databaseMetaData::getMaxColumnNameLength); 321 } 322 323 @Override 324 public int getMaxColumnsInGroupBy() throws SQLException { 325 return getI(databaseMetaData::getMaxColumnsInGroupBy); 326 } 327 328 @Override 329 public int getMaxColumnsInIndex() throws SQLException { 330 return getI(databaseMetaData::getMaxColumnsInIndex); 331 } 332 333 @Override 334 public int getMaxColumnsInOrderBy() throws SQLException { 335 return getI(databaseMetaData::getMaxColumnsInOrderBy); 336 } 337 338 @Override 339 public int getMaxColumnsInSelect() throws SQLException { 340 return getI(databaseMetaData::getMaxColumnsInSelect); 341 } 342 343 @Override 344 public int getMaxColumnsInTable() throws SQLException { 345 return getI(databaseMetaData::getMaxColumnsInTable); 346 } 347 348 @Override 349 public int getMaxConnections() throws SQLException { 350 return getI(databaseMetaData::getMaxConnections); 351 } 352 353 @Override 354 public int getMaxCursorNameLength() throws SQLException { 355 return getI(databaseMetaData::getMaxCursorNameLength); 356 } 357 358 @Override 359 public int getMaxIndexLength() throws SQLException { 360 return getI(databaseMetaData::getMaxIndexLength); 361 } 362 363 /** 364 * @since 2.5.0 365 */ 366 @Override 367 public long getMaxLogicalLobSize() throws SQLException { 368 return getL(databaseMetaData::getMaxLogicalLobSize); 369 } 370 371 @Override 372 public int getMaxProcedureNameLength() throws SQLException { 373 return getI(databaseMetaData::getMaxProcedureNameLength); 374 } 375 376 @Override 377 public int getMaxRowSize() throws SQLException { 378 return getI(databaseMetaData::getMaxRowSize); 379 } 380 381 @Override 382 public int getMaxSchemaNameLength() throws SQLException { 383 return getI(databaseMetaData::getMaxSchemaNameLength); 384 } 385 386 @Override 387 public int getMaxStatementLength() throws SQLException { 388 return getI(databaseMetaData::getMaxStatementLength); 389 } 390 391 @Override 392 public int getMaxStatements() throws SQLException { 393 return getI(databaseMetaData::getMaxStatements); 394 } 395 396 @Override 397 public int getMaxTableNameLength() throws SQLException { 398 return getI(databaseMetaData::getMaxTableNameLength); 399 } 400 401 @Override 402 public int getMaxTablesInSelect() throws SQLException { 403 return getI(databaseMetaData::getMaxTablesInSelect); 404 } 405 406 @Override 407 public int getMaxUserNameLength() throws SQLException { 408 return getI(databaseMetaData::getMaxUserNameLength); 409 } 410 411 @Override 412 public String getNumericFunctions() throws SQLException { 413 return get(databaseMetaData::getNumericFunctions); 414 } 415 416 @Override 417 public ResultSet getPrimaryKeys(final String catalog, final String schema, final String table) throws SQLException { 418 return getRS(() -> databaseMetaData.getPrimaryKeys(catalog, schema, table)); 419 } 420 421 @Override 422 public ResultSet getProcedureColumns(final String catalog, final String schemaPattern, final String procedureNamePattern, final String columnNamePattern) 423 throws SQLException { 424 return getRS(() -> databaseMetaData.getProcedureColumns(catalog, schemaPattern, procedureNamePattern, columnNamePattern)); 425 } 426 427 @Override 428 public ResultSet getProcedures(final String catalog, final String schemaPattern, final String procedureNamePattern) throws SQLException { 429 return getRS(() -> databaseMetaData.getProcedures(catalog, schemaPattern, procedureNamePattern)); 430 } 431 432 @Override 433 public String getProcedureTerm() throws SQLException { 434 return get(databaseMetaData::getProcedureTerm); 435 } 436 437 @Override 438 public ResultSet getPseudoColumns(final String catalog, final String schemaPattern, final String tableNamePattern, final String columnNamePattern) 439 throws SQLException { 440 return getRS(() -> Jdbc41Bridge.getPseudoColumns(databaseMetaData, catalog, schemaPattern, tableNamePattern, columnNamePattern)); 441 } 442 443 @Override 444 public int getResultSetHoldability() throws SQLException { 445 return getI(databaseMetaData::getResultSetHoldability); 446 } 447 448 @Override 449 public RowIdLifetime getRowIdLifetime() throws SQLException { 450 return get(databaseMetaData::getRowIdLifetime); 451 } 452 453 @SuppressWarnings("resource") 454 private ResultSet getRS(final Callable<ResultSet> s) throws SQLException { 455 connection.checkOpen(); 456 return DelegatingResultSet.wrapResultSet(connection, get(s)); 457 } 458 459 @Override 460 public ResultSet getSchemas() throws SQLException { 461 return getRS(databaseMetaData::getSchemas); 462 } 463 464 @Override 465 public ResultSet getSchemas(final String catalog, final String schemaPattern) throws SQLException { 466 return getRS(() -> databaseMetaData.getSchemas(catalog, schemaPattern)); 467 } 468 469 @Override 470 public String getSchemaTerm() throws SQLException { 471 return get(databaseMetaData::getSchemaTerm); 472 } 473 474 @Override 475 public String getSearchStringEscape() throws SQLException { 476 return get(databaseMetaData::getSearchStringEscape); 477 } 478 479 @Override 480 public String getSQLKeywords() throws SQLException { 481 return get(databaseMetaData::getSQLKeywords); 482 } 483 484 @Override 485 public int getSQLStateType() throws SQLException { 486 return getI(databaseMetaData::getSQLStateType); 487 } 488 489 @Override 490 public String getStringFunctions() throws SQLException { 491 return get(databaseMetaData::getStringFunctions); 492 } 493 494 @Override 495 public ResultSet getSuperTables(final String catalog, final String schemaPattern, final String tableNamePattern) throws SQLException { 496 return getRS(() -> databaseMetaData.getSuperTables(catalog, schemaPattern, tableNamePattern)); 497 } 498 499 @Override 500 public ResultSet getSuperTypes(final String catalog, final String schemaPattern, final String typeNamePattern) throws SQLException { 501 return getRS(() -> databaseMetaData.getSuperTypes(catalog, schemaPattern, typeNamePattern)); 502 } 503 504 @Override 505 public String getSystemFunctions() throws SQLException { 506 return get(databaseMetaData::getSystemFunctions); 507 } 508 509 @Override 510 public ResultSet getTablePrivileges(final String catalog, final String schemaPattern, final String tableNamePattern) throws SQLException { 511 return getRS(() -> databaseMetaData.getTablePrivileges(catalog, schemaPattern, tableNamePattern)); 512 } 513 514 @Override 515 public ResultSet getTables(final String catalog, final String schemaPattern, final String tableNamePattern, final String[] types) throws SQLException { 516 return getRS(() -> databaseMetaData.getTables(catalog, schemaPattern, tableNamePattern, types)); 517 } 518 519 @Override 520 public ResultSet getTableTypes() throws SQLException { 521 return getRS(databaseMetaData::getTableTypes); 522 } 523 524 @Override 525 public String getTimeDateFunctions() throws SQLException { 526 return get(databaseMetaData::getTimeDateFunctions); 527 } 528 529 @Override 530 public ResultSet getTypeInfo() throws SQLException { 531 return getRS(databaseMetaData::getTypeInfo); 532 } 533 534 @Override 535 public ResultSet getUDTs(final String catalog, final String schemaPattern, final String typeNamePattern, final int[] types) throws SQLException { 536 return getRS(() -> databaseMetaData.getUDTs(catalog, schemaPattern, typeNamePattern, types)); 537 } 538 539 @Override 540 public String getURL() throws SQLException { 541 return get(databaseMetaData::getURL); 542 } 543 544 @Override 545 public String getUserName() throws SQLException { 546 return get(databaseMetaData::getUserName); 547 } 548 549 @Override 550 public ResultSet getVersionColumns(final String catalog, final String schema, final String table) throws SQLException { 551 return getRS(() -> databaseMetaData.getVersionColumns(catalog, schema, table)); 552 } 553 554 /** 555 * Delegates to the connection's {@link DelegatingConnection#handleException(SQLException)}. 556 * 557 * @param e the exception to throw or delegate. 558 * @throws SQLException the exception to throw. 559 */ 560 protected void handleException(final SQLException e) throws SQLException { 561 if (connection == null) { 562 throw e; 563 } 564 connection.handleException(e); 565 } 566 567 @Override 568 public boolean insertsAreDetected(final int type) throws SQLException { 569 return getB(() -> databaseMetaData.insertsAreDetected(type)); 570 } 571 572 @Override 573 public boolean isCatalogAtStart() throws SQLException { 574 return getB(databaseMetaData::isCatalogAtStart); 575 } 576 577 @Override 578 public boolean isReadOnly() throws SQLException { 579 return getB(databaseMetaData::isReadOnly); 580 } 581 582 @Override 583 public boolean isWrapperFor(final Class<?> iface) throws SQLException { 584 if (iface.isAssignableFrom(getClass()) || iface.isAssignableFrom(databaseMetaData.getClass())) { 585 return true; 586 } 587 return databaseMetaData.isWrapperFor(iface); 588 } 589 590 @Override 591 public boolean locatorsUpdateCopy() throws SQLException { 592 return getB(databaseMetaData::locatorsUpdateCopy); 593 } 594 595 @Override 596 public boolean nullPlusNonNullIsNull() throws SQLException { 597 return getB(databaseMetaData::nullPlusNonNullIsNull); 598 } 599 600 @Override 601 public boolean nullsAreSortedAtEnd() throws SQLException { 602 return getB(databaseMetaData::nullsAreSortedAtEnd); 603 } 604 605 @Override 606 public boolean nullsAreSortedAtStart() throws SQLException { 607 return getB(databaseMetaData::nullsAreSortedAtStart); 608 } 609 610 @Override 611 public boolean nullsAreSortedHigh() throws SQLException { 612 return getB(databaseMetaData::nullsAreSortedHigh); 613 } 614 615 @Override 616 public boolean nullsAreSortedLow() throws SQLException { 617 return getB(databaseMetaData::nullsAreSortedLow); 618 } 619 620 @Override 621 public boolean othersDeletesAreVisible(final int type) throws SQLException { 622 return getB(() -> databaseMetaData.othersDeletesAreVisible(type)); 623 } 624 625 @Override 626 public boolean othersInsertsAreVisible(final int type) throws SQLException { 627 return getB(() -> databaseMetaData.othersInsertsAreVisible(type)); 628 } 629 630 @Override 631 public boolean othersUpdatesAreVisible(final int type) throws SQLException { 632 return getB(() -> databaseMetaData.othersUpdatesAreVisible(type)); 633 } 634 635 @Override 636 public boolean ownDeletesAreVisible(final int type) throws SQLException { 637 return getB(() -> databaseMetaData.ownDeletesAreVisible(type)); 638 } 639 640 @Override 641 public boolean ownInsertsAreVisible(final int type) throws SQLException { 642 return getB(() -> databaseMetaData.ownInsertsAreVisible(type)); 643 } 644 645 @Override 646 public boolean ownUpdatesAreVisible(final int type) throws SQLException { 647 return getB(() -> databaseMetaData.ownUpdatesAreVisible(type)); 648 } 649 650 @Override 651 public boolean storesLowerCaseIdentifiers() throws SQLException { 652 return getB(databaseMetaData::storesLowerCaseIdentifiers); 653 } 654 655 @Override 656 public boolean storesLowerCaseQuotedIdentifiers() throws SQLException { 657 return getB(databaseMetaData::storesLowerCaseQuotedIdentifiers); 658 } 659 660 @Override 661 public boolean storesMixedCaseIdentifiers() throws SQLException { 662 return getB(databaseMetaData::storesMixedCaseIdentifiers); 663 } 664 665 @Override 666 public boolean storesMixedCaseQuotedIdentifiers() throws SQLException { 667 return getB(databaseMetaData::storesMixedCaseQuotedIdentifiers); 668 } 669 670 @Override 671 public boolean storesUpperCaseIdentifiers() throws SQLException { 672 return getB(databaseMetaData::storesUpperCaseIdentifiers); 673 674 } 675 676 @Override 677 public boolean storesUpperCaseQuotedIdentifiers() throws SQLException { 678 return getB(databaseMetaData::storesUpperCaseQuotedIdentifiers); 679 } 680 681 @Override 682 public boolean supportsAlterTableWithAddColumn() throws SQLException { 683 return getB(databaseMetaData::supportsAlterTableWithAddColumn); 684 } 685 686 @Override 687 public boolean supportsAlterTableWithDropColumn() throws SQLException { 688 return getB(databaseMetaData::supportsAlterTableWithDropColumn); 689 } 690 691 @Override 692 public boolean supportsANSI92EntryLevelSQL() throws SQLException { 693 return getB(databaseMetaData::supportsANSI92EntryLevelSQL); 694 } 695 696 @Override 697 public boolean supportsANSI92FullSQL() throws SQLException { 698 return getB(databaseMetaData::supportsANSI92FullSQL); 699 } 700 701 @Override 702 public boolean supportsANSI92IntermediateSQL() throws SQLException { 703 return getB(databaseMetaData::supportsANSI92IntermediateSQL); 704 } 705 706 @Override 707 public boolean supportsBatchUpdates() throws SQLException { 708 return getB(databaseMetaData::supportsBatchUpdates); 709 } 710 711 @Override 712 public boolean supportsCatalogsInDataManipulation() throws SQLException { 713 return getB(databaseMetaData::supportsCatalogsInDataManipulation); 714 } 715 716 @Override 717 public boolean supportsCatalogsInIndexDefinitions() throws SQLException { 718 return getB(databaseMetaData::supportsCatalogsInIndexDefinitions); 719 } 720 721 @Override 722 public boolean supportsCatalogsInPrivilegeDefinitions() throws SQLException { 723 return getB(databaseMetaData::supportsCatalogsInPrivilegeDefinitions); 724 } 725 726 @Override 727 public boolean supportsCatalogsInProcedureCalls() throws SQLException { 728 return getB(databaseMetaData::supportsCatalogsInProcedureCalls); 729 } 730 731 @Override 732 public boolean supportsCatalogsInTableDefinitions() throws SQLException { 733 return getB(databaseMetaData::supportsCatalogsInTableDefinitions); 734 } 735 736 @Override 737 public boolean supportsColumnAliasing() throws SQLException { 738 return getB(databaseMetaData::supportsColumnAliasing); 739 } 740 741 @Override 742 public boolean supportsConvert() throws SQLException { 743 return getB(databaseMetaData::supportsConvert); 744 } 745 746 @Override 747 public boolean supportsConvert(final int fromType, final int toType) throws SQLException { 748 return getB(() -> databaseMetaData.supportsConvert(fromType, toType)); 749 } 750 751 @Override 752 public boolean supportsCoreSQLGrammar() throws SQLException { 753 return getB(databaseMetaData::supportsCoreSQLGrammar); 754 } 755 756 @Override 757 public boolean supportsCorrelatedSubqueries() throws SQLException { 758 return getB(databaseMetaData::supportsCorrelatedSubqueries); 759 } 760 761 @Override 762 public boolean supportsDataDefinitionAndDataManipulationTransactions() throws SQLException { 763 return getB(databaseMetaData::supportsDataDefinitionAndDataManipulationTransactions); 764 } 765 766 @Override 767 public boolean supportsDataManipulationTransactionsOnly() throws SQLException { 768 return getB(databaseMetaData::supportsDataManipulationTransactionsOnly); 769 } 770 771 @Override 772 public boolean supportsDifferentTableCorrelationNames() throws SQLException { 773 return getB(databaseMetaData::supportsDifferentTableCorrelationNames); 774 } 775 776 @Override 777 public boolean supportsExpressionsInOrderBy() throws SQLException { 778 return getB(databaseMetaData::supportsExpressionsInOrderBy); 779 } 780 781 @Override 782 public boolean supportsExtendedSQLGrammar() throws SQLException { 783 return getB(databaseMetaData::supportsExtendedSQLGrammar); 784 } 785 786 @Override 787 public boolean supportsFullOuterJoins() throws SQLException { 788 return getB(databaseMetaData::supportsFullOuterJoins); 789 } 790 791 @Override 792 public boolean supportsGetGeneratedKeys() throws SQLException { 793 return getB(databaseMetaData::supportsGetGeneratedKeys); 794 } 795 796 @Override 797 public boolean supportsGroupBy() throws SQLException { 798 return getB(databaseMetaData::supportsGroupBy); 799 } 800 801 @Override 802 public boolean supportsGroupByBeyondSelect() throws SQLException { 803 return getB(databaseMetaData::supportsGroupByBeyondSelect); 804 } 805 806 @Override 807 public boolean supportsGroupByUnrelated() throws SQLException { 808 return getB(databaseMetaData::supportsGroupByUnrelated); 809 } 810 811 @Override 812 public boolean supportsIntegrityEnhancementFacility() throws SQLException { 813 return getB(databaseMetaData::supportsIntegrityEnhancementFacility); 814 } 815 816 @Override 817 public boolean supportsLikeEscapeClause() throws SQLException { 818 return getB(databaseMetaData::supportsLikeEscapeClause); 819 } 820 821 @Override 822 public boolean supportsLimitedOuterJoins() throws SQLException { 823 return getB(databaseMetaData::supportsLimitedOuterJoins); 824 } 825 826 @Override 827 public boolean supportsMinimumSQLGrammar() throws SQLException { 828 return getB(databaseMetaData::supportsMinimumSQLGrammar); 829 } 830 831 @Override 832 public boolean supportsMixedCaseIdentifiers() throws SQLException { 833 return getB(databaseMetaData::supportsMixedCaseIdentifiers); 834 } 835 836 @Override 837 public boolean supportsMixedCaseQuotedIdentifiers() throws SQLException { 838 return getB(databaseMetaData::supportsMixedCaseQuotedIdentifiers); 839 } 840 841 @Override 842 public boolean supportsMultipleOpenResults() throws SQLException { 843 return getB(databaseMetaData::supportsMultipleOpenResults); 844 } 845 846 @Override 847 public boolean supportsMultipleResultSets() throws SQLException { 848 return getB(databaseMetaData::supportsMultipleResultSets); 849 } 850 851 @Override 852 public boolean supportsMultipleTransactions() throws SQLException { 853 return getB(databaseMetaData::supportsMultipleTransactions); 854 } 855 856 @Override 857 public boolean supportsNamedParameters() throws SQLException { 858 return getB(databaseMetaData::supportsNamedParameters); 859 } 860 861 @Override 862 public boolean supportsNonNullableColumns() throws SQLException { 863 return getB(databaseMetaData::supportsNonNullableColumns); 864 } 865 866 @Override 867 public boolean supportsOpenCursorsAcrossCommit() throws SQLException { 868 return getB(databaseMetaData::supportsOpenCursorsAcrossCommit); 869 } 870 871 @Override 872 public boolean supportsOpenCursorsAcrossRollback() throws SQLException { 873 return getB(databaseMetaData::supportsOpenCursorsAcrossRollback); 874 } 875 876 @Override 877 public boolean supportsOpenStatementsAcrossCommit() throws SQLException { 878 return getB(databaseMetaData::supportsOpenStatementsAcrossCommit); 879 } 880 881 @Override 882 public boolean supportsOpenStatementsAcrossRollback() throws SQLException { 883 return getB(databaseMetaData::supportsOpenStatementsAcrossRollback); 884 } 885 886 @Override 887 public boolean supportsOrderByUnrelated() throws SQLException { 888 return getB(databaseMetaData::supportsOrderByUnrelated); 889 } 890 891 @Override 892 public boolean supportsOuterJoins() throws SQLException { 893 return getB(databaseMetaData::supportsOuterJoins); 894 } 895 896 @Override 897 public boolean supportsPositionedDelete() throws SQLException { 898 return getB(databaseMetaData::supportsPositionedDelete); 899 } 900 901 @Override 902 public boolean supportsPositionedUpdate() throws SQLException { 903 return getB(databaseMetaData::supportsPositionedUpdate); 904 } 905 906 /** 907 * @since 2.5.0 908 */ 909 @Override 910 public boolean supportsRefCursors() throws SQLException { 911 return getB(databaseMetaData::supportsRefCursors); 912 } 913 914 @Override 915 public boolean supportsResultSetConcurrency(final int type, final int concurrency) throws SQLException { 916 return getB(() -> databaseMetaData.supportsResultSetConcurrency(type, concurrency)); 917 } 918 919 @Override 920 public boolean supportsResultSetHoldability(final int holdability) throws SQLException { 921 return getB(() -> databaseMetaData.supportsResultSetHoldability(holdability)); 922 } 923 924 @Override 925 public boolean supportsResultSetType(final int type) throws SQLException { 926 return getB(() -> databaseMetaData.supportsResultSetType(type)); 927 } 928 929 @Override 930 public boolean supportsSavepoints() throws SQLException { 931 return getB(databaseMetaData::supportsSavepoints); 932 } 933 934 @Override 935 public boolean supportsSchemasInDataManipulation() throws SQLException { 936 return getB(databaseMetaData::supportsSchemasInDataManipulation); 937 } 938 939 @Override 940 public boolean supportsSchemasInIndexDefinitions() throws SQLException { 941 return getB(databaseMetaData::supportsSchemasInIndexDefinitions); 942 } 943 944 @Override 945 public boolean supportsSchemasInPrivilegeDefinitions() throws SQLException { 946 return getB(databaseMetaData::supportsSchemasInPrivilegeDefinitions); 947 } 948 949 @Override 950 public boolean supportsSchemasInProcedureCalls() throws SQLException { 951 return getB(databaseMetaData::supportsSchemasInProcedureCalls); 952 } 953 954 @Override 955 public boolean supportsSchemasInTableDefinitions() throws SQLException { 956 return getB(databaseMetaData::supportsSchemasInTableDefinitions); 957 } 958 959 @Override 960 public boolean supportsSelectForUpdate() throws SQLException { 961 return getB(databaseMetaData::supportsSelectForUpdate); 962 } 963 964 @Override 965 public boolean supportsStatementPooling() throws SQLException { 966 return getB(databaseMetaData::supportsStatementPooling); 967 } 968 969 @Override 970 public boolean supportsStoredFunctionsUsingCallSyntax() throws SQLException { 971 return getB(databaseMetaData::supportsStoredFunctionsUsingCallSyntax); 972 } 973 974 @Override 975 public boolean supportsStoredProcedures() throws SQLException { 976 return getB(databaseMetaData::supportsStoredProcedures); 977 } 978 979 @Override 980 public boolean supportsSubqueriesInComparisons() throws SQLException { 981 return getB(databaseMetaData::supportsSubqueriesInComparisons); 982 } 983 984 @Override 985 public boolean supportsSubqueriesInExists() throws SQLException { 986 return getB(databaseMetaData::supportsSubqueriesInExists); 987 } 988 989 @Override 990 public boolean supportsSubqueriesInIns() throws SQLException { 991 return getB(databaseMetaData::supportsSubqueriesInIns); 992 } 993 994 @Override 995 public boolean supportsSubqueriesInQuantifieds() throws SQLException { 996 return getB(databaseMetaData::supportsSubqueriesInQuantifieds); 997 } 998 999 @Override 1000 public boolean supportsTableCorrelationNames() throws SQLException { 1001 return getB(databaseMetaData::supportsTableCorrelationNames); 1002 } 1003 1004 @Override 1005 public boolean supportsTransactionIsolationLevel(final int level) throws SQLException { 1006 return getB(() -> databaseMetaData.supportsTransactionIsolationLevel(level)); 1007 } 1008 1009 @Override 1010 public boolean supportsTransactions() throws SQLException { 1011 return getB(databaseMetaData::supportsTransactions); 1012 } 1013 1014 @Override 1015 public boolean supportsUnion() throws SQLException { 1016 return getB(databaseMetaData::supportsUnion); 1017 } 1018 1019 @Override 1020 public boolean supportsUnionAll() throws SQLException { 1021 return getB(databaseMetaData::supportsUnionAll); 1022 } 1023 1024 @Override 1025 public <T> T unwrap(final Class<T> iface) throws SQLException { 1026 if (iface.isAssignableFrom(getClass())) { 1027 return iface.cast(this); 1028 } 1029 if (iface.isAssignableFrom(databaseMetaData.getClass())) { 1030 return iface.cast(databaseMetaData); 1031 } 1032 return databaseMetaData.unwrap(iface); 1033 } 1034 1035 @Override 1036 public boolean updatesAreDetected(final int type) throws SQLException { 1037 return getB(() -> databaseMetaData.updatesAreDetected(type)); 1038 } 1039 1040 @Override 1041 public boolean usesLocalFilePerTable() throws SQLException { 1042 return getB(databaseMetaData::usesLocalFilePerTable); 1043 } 1044 1045 @Override 1046 public boolean usesLocalFiles() throws SQLException { 1047 return getB(databaseMetaData::usesLocalFiles); 1048 } 1049}