    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 *      http://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;
    024
    025/**
    026 * <p>
    027 * A base delegating implementation of {@link DatabaseMetaData}.
    028 * </p>
    029 * <p>
    030 * Methods that create {@link ResultSet} objects are wrapped to create {@link DelegatingResultSet} objects and the
    031 * remaining methods simply call the corresponding method on the "delegate" provided in the constructor.
    032 * </p>
    033 *
    034 * @since 2.0
    035 */
    036public class DelegatingDatabaseMetaData implements DatabaseMetaData {
    037
    038    /** My delegate {@link DatabaseMetaData} */
    039    private final DatabaseMetaData databaseMetaData;
    040
    041    /** The connection that created me. **/
    042    private final DelegatingConnection<?> connection;
    043
    044    /**
    045     * Constructs a new instance for the given delegating connection and database meta data.
    046     *
    047     * @param connection
    048     *            the delegating connection
    049     * @param databaseMetaData
    050     *            the database meta data
    051     */
    052    public DelegatingDatabaseMetaData(final DelegatingConnection<?> connection,
    053            final DatabaseMetaData databaseMetaData) {
    054        super();
    055        this.connection = connection;
    056        this.databaseMetaData = databaseMetaData;
    057    }
    058
    059    /**
    060     * Gets the underlying database meta data.
    061     *
    062     * @return The underlying database meta data.
    063     */
    064    public DatabaseMetaData getDelegate() {
    065        return databaseMetaData;
    066    }
    067
    068    /**
    069     * If my underlying {@link ResultSet} is not a {@code DelegatingResultSet}, returns it, otherwise recursively
    070     * invokes this method on my delegate.
    071     * <p>
    072     * Hence this method will return the first delegate that is not a {@code DelegatingResultSet}, or {@code null} when
    073     * no non-{@code DelegatingResultSet} delegate can be found by traversing this chain.
    074     * </p>
    075     * <p>
    076     * This method is useful when you may have nested {@code DelegatingResultSet}s, and you want to make sure to obtain
    077     * a "genuine" {@link ResultSet}.
    078     * </p>
    079     *
    080     * @return the innermost database meta data.
    081     */
    082    public DatabaseMetaData getInnermostDelegate() {
    083        DatabaseMetaData m = databaseMetaData;
    084        while (m != null && m instanceof DelegatingDatabaseMetaData) {
    085            m = ((DelegatingDatabaseMetaData) m).getDelegate();
    086            if (this == m) {
    087                return null;
    088            }
    089        }
    090        return m;
    091    }
    092
    093    protected void handleException(final SQLException e) throws SQLException {
    094        if (connection != null) {
    095            connection.handleException(e);
    096        } else {
    097            throw e;
    098        }
    099    }
    100
    101    @Override
    102    public boolean allProceduresAreCallable() throws SQLException {
    103        try {
    104            return databaseMetaData.allProceduresAreCallable();
    105        } catch (final SQLException e) {
    106            handleException(e);
    107            return false;
    108        }
    109    }
    110
    111    @Override
    112    public boolean allTablesAreSelectable() throws SQLException {
    113        try {
    114            return databaseMetaData.allTablesAreSelectable();
    115        } catch (final SQLException e) {
    116            handleException(e);
    117            return false;
    118        }
    119    }
    120
    121    @Override
    122    public boolean dataDefinitionCausesTransactionCommit() throws SQLException {
    123        try {
    124            return databaseMetaData.dataDefinitionCausesTransactionCommit();
    125        } catch (final SQLException e) {
    126            handleException(e);
    127            return false;
    128        }
    129    }
    130
    131    @Override
    132    public boolean dataDefinitionIgnoredInTransactions() throws SQLException {
    133        try {
    134            return databaseMetaData.dataDefinitionIgnoredInTransactions();
    135        } catch (final SQLException e) {
    136            handleException(e);
    137            return false;
    138        }
    139    }
    140
    141    @Override
    142    public boolean deletesAreDetected(final int type) throws SQLException {
    143        try {
    144            return databaseMetaData.deletesAreDetected(type);
    145        } catch (final SQLException e) {
    146            handleException(e);
    147            return false;
    148        }
    149    }
    150
    151    @Override
    152    public boolean doesMaxRowSizeIncludeBlobs() throws SQLException {
    153        try {
    154            return databaseMetaData.doesMaxRowSizeIncludeBlobs();
    155        } catch (final SQLException e) {
    156            handleException(e);
    157            return false;
    158        }
    159    }
    160
    161    @Override
    162    public ResultSet getAttributes(final String catalog, final String schemaPattern, final String typeNamePattern,
    163            final String attributeNamePattern) throws SQLException {
    164        connection.checkOpen();
    165        try {
    166            return DelegatingResultSet.wrapResultSet(connection,
    167                    databaseMetaData.getAttributes(catalog, schemaPattern, typeNamePattern, attributeNamePattern));
    168        } catch (final SQLException e) {
    169            handleException(e);
    170            throw new AssertionError();
    171        }
    172    }
    173
    174    @Override
    175    public ResultSet getBestRowIdentifier(final String catalog, final String schema, final String table,
    176            final int scope, final boolean nullable) throws SQLException {
    177        connection.checkOpen();
    178        try {
    179            return DelegatingResultSet.wrapResultSet(connection,
    180                    databaseMetaData.getBestRowIdentifier(catalog, schema, table, scope, nullable));
    181        } catch (final SQLException e) {
    182            handleException(e);
    183            throw new AssertionError();
    184        }
    185    }
    186
    187    @Override
    188    public String getCatalogSeparator() throws SQLException {
    189        try {
    190            return databaseMetaData.getCatalogSeparator();
    191        } catch (final SQLException e) {
    192            handleException(e);
    193            throw new AssertionError();
    194        }
    195    }
    196
    197    @Override
    198    public String getCatalogTerm() throws SQLException {
    199        try {
    200            return databaseMetaData.getCatalogTerm();
    201        } catch (final SQLException e) {
    202            handleException(e);
    203            throw new AssertionError();
    204        }
    205    }
    206
    207    @Override
    208    public ResultSet getCatalogs() throws SQLException {
    209        connection.checkOpen();
    210        try {
    211            return DelegatingResultSet.wrapResultSet(connection, databaseMetaData.getCatalogs());
    212        } catch (final SQLException e) {
    213            handleException(e);
    214            throw new AssertionError();
    215        }
    216    }
    217
    218    @Override
    219    public ResultSet getColumnPrivileges(final String catalog, final String schema, final String table,
    220            final String columnNamePattern) throws SQLException {
    221        connection.checkOpen();
    222        try {
    223            return DelegatingResultSet.wrapResultSet(connection,
    224                    databaseMetaData.getColumnPrivileges(catalog, schema, table, columnNamePattern));
    225        } catch (final SQLException e) {
    226            handleException(e);
    227            throw new AssertionError();
    228        }
    229    }
    230
    231    @Override
    232    public ResultSet getColumns(final String catalog, final String schemaPattern, final String tableNamePattern,
    233            final String columnNamePattern) throws SQLException {
    234        connection.checkOpen();
    235        try {
    236            return DelegatingResultSet.wrapResultSet(connection,
    237                    databaseMetaData.getColumns(catalog, schemaPattern, tableNamePattern, columnNamePattern));
    238        } catch (final SQLException e) {
    239            handleException(e);
    240            throw new AssertionError();
    241        }
    242    }
    243
    244    @Override
    245    public Connection getConnection() throws SQLException {
    246        return connection;
    247    }
    248
    249    @Override
    250    public ResultSet getCrossReference(final String parentCatalog, final String parentSchema, final String parentTable,
    251            final String foreignCatalog, final String foreignSchema, final String foreignTable) throws SQLException {
    252        connection.checkOpen();
    253        try {
    254            return DelegatingResultSet.wrapResultSet(connection, databaseMetaData.getCrossReference(parentCatalog,
    255                    parentSchema, parentTable, foreignCatalog, foreignSchema, foreignTable));
    256        } catch (final SQLException e) {
    257            handleException(e);
    258            throw new AssertionError();
    259        }
    260    }
    261
    262    @Override
    263    public int getDatabaseMajorVersion() throws SQLException {
    264        try {
    265            return databaseMetaData.getDatabaseMajorVersion();
    266        } catch (final SQLException e) {
    267            handleException(e);
    268            return 0;
    269        }
    270    }
    271
    272    @Override
    273    public int getDatabaseMinorVersion() throws SQLException {
    274        try {
    275            return databaseMetaData.getDatabaseMinorVersion();
    276        } catch (final SQLException e) {
    277            handleException(e);
    278            return 0;
    279        }
    280    }
    281
    282    @Override
    283    public String getDatabaseProductName() throws SQLException {
    284        try {
    285            return databaseMetaData.getDatabaseProductName();
    286        } catch (final SQLException e) {
    287            handleException(e);
    288            throw new AssertionError();
    289        }
    290    }
    291
    292    @Override
    293    public String getDatabaseProductVersion() throws SQLException {
    294        try {
    295            return databaseMetaData.getDatabaseProductVersion();
    296        } catch (final SQLException e) {
    297            handleException(e);
    298            throw new AssertionError();
    299        }
    300    }
    301
    302    @Override
    303    public int getDefaultTransactionIsolation() throws SQLException {
    304        try {
    305            return databaseMetaData.getDefaultTransactionIsolation();
    306        } catch (final SQLException e) {
    307            handleException(e);
    308            return 0;
    309        }
    310    }
    311
    312    @Override
    313    public int getDriverMajorVersion() {
    314        return databaseMetaData.getDriverMajorVersion();
    315    }
    316
    317    @Override
    318    public int getDriverMinorVersion() {
    319        return databaseMetaData.getDriverMinorVersion();
    320    }
    321
    322    @Override
    323    public String getDriverName() throws SQLException {
    324        try {
    325            return databaseMetaData.getDriverName();
    326        } catch (final SQLException e) {
    327            handleException(e);
    328            throw new AssertionError();
    329        }
    330    }
    331
    332    @Override
    333    public String getDriverVersion() throws SQLException {
    334        try {
    335            return databaseMetaData.getDriverVersion();
    336        } catch (final SQLException e) {
    337            handleException(e);
    338            throw new AssertionError();
    339        }
    340    }
    341
    342    @Override
    343    public ResultSet getExportedKeys(final String catalog, final String schema, final String table)
    344            throws SQLException {
    345        connection.checkOpen();
    346        try {
    347            return DelegatingResultSet.wrapResultSet(connection,
    348                    databaseMetaData.getExportedKeys(catalog, schema, table));
    349        } catch (final SQLException e) {
    350            handleException(e);
    351            throw new AssertionError();
    352        }
    353    }
    354
    355    @Override
    356    public String getExtraNameCharacters() throws SQLException {
    357        try {
    358            return databaseMetaData.getExtraNameCharacters();
    359        } catch (final SQLException e) {
    360            handleException(e);
    361            throw new AssertionError();
    362        }
    363    }
    364
    365    @Override
    366    public String getIdentifierQuoteString() throws SQLException {
    367        try {
    368            return databaseMetaData.getIdentifierQuoteString();
    369        } catch (final SQLException e) {
    370            handleException(e);
    371            throw new AssertionError();
    372        }
    373    }
    374
    375    @Override
    376    public ResultSet getImportedKeys(final String catalog, final String schema, final String table)
    377            throws SQLException {
    378        connection.checkOpen();
    379        try {
    380            return DelegatingResultSet.wrapResultSet(connection,
    381                    databaseMetaData.getImportedKeys(catalog, schema, table));
    382        } catch (final SQLException e) {
    383            handleException(e);
    384            throw new AssertionError();
    385        }
    386    }
    387
    388    @Override
    389    public ResultSet getIndexInfo(final String catalog, final String schema, final String table, final boolean unique,
    390            final boolean approximate) throws SQLException {
    391        connection.checkOpen();
    392        try {
    393            return DelegatingResultSet.wrapResultSet(connection,
    394                    databaseMetaData.getIndexInfo(catalog, schema, table, unique, approximate));
    395        } catch (final SQLException e) {
    396            handleException(e);
    397            throw new AssertionError();
    398        }
    399    }
    400
    401    @Override
    402    public int getJDBCMajorVersion() throws SQLException {
    403        try {
    404            return databaseMetaData.getJDBCMajorVersion();
    405        } catch (final SQLException e) {
    406            handleException(e);
    407            return 0;
    408        }
    409    }
    410
    411    @Override
    412    public int getJDBCMinorVersion() throws SQLException {
    413        try {
    414            return databaseMetaData.getJDBCMinorVersion();
    415        } catch (final SQLException e) {
    416            handleException(e);
    417            return 0;
    418        }
    419    }
    420
    421    @Override
    422    public int getMaxBinaryLiteralLength() throws SQLException {
    423        try {
    424            return databaseMetaData.getMaxBinaryLiteralLength();
    425        } catch (final SQLException e) {
    426            handleException(e);
    427            return 0;
    428        }
    429    }
    430
    431    @Override
    432    public int getMaxCatalogNameLength() throws SQLException {
    433        try {
    434            return databaseMetaData.getMaxCatalogNameLength();
    435        } catch (final SQLException e) {
    436            handleException(e);
    437            return 0;
    438        }
    439    }
    440
    441    @Override
    442    public int getMaxCharLiteralLength() throws SQLException {
    443        try {
    444            return databaseMetaData.getMaxCharLiteralLength();
    445        } catch (final SQLException e) {
    446            handleException(e);
    447            return 0;
    448        }
    449    }
    450
    451    @Override
    452    public int getMaxColumnNameLength() throws SQLException {
    453        try {
    454            return databaseMetaData.getMaxColumnNameLength();
    455        } catch (final SQLException e) {
    456            handleException(e);
    457            return 0;
    458        }
    459    }
    460
    461    @Override
    462    public int getMaxColumnsInGroupBy() throws SQLException {
    463        try {
    464            return databaseMetaData.getMaxColumnsInGroupBy();
    465        } catch (final SQLException e) {
    466            handleException(e);
    467            return 0;
    468        }
    469    }
    470
    471    @Override
    472    public int getMaxColumnsInIndex() throws SQLException {
    473        try {
    474            return databaseMetaData.getMaxColumnsInIndex();
    475        } catch (final SQLException e) {
    476            handleException(e);
    477            return 0;
    478        }
    479    }
    480
    481    @Override
    482    public int getMaxColumnsInOrderBy() throws SQLException {
    483        try {
    484            return databaseMetaData.getMaxColumnsInOrderBy();
    485        } catch (final SQLException e) {
    486            handleException(e);
    487            return 0;
    488        }
    489    }
    490
    491    @Override
    492    public int getMaxColumnsInSelect() throws SQLException {
    493        try {
    494            return databaseMetaData.getMaxColumnsInSelect();
    495        } catch (final SQLException e) {
    496            handleException(e);
    497            return 0;
    498        }
    499    }
    500
    501    @Override
    502    public int getMaxColumnsInTable() throws SQLException {
    503        try {
    504            return databaseMetaData.getMaxColumnsInTable();
    505        } catch (final SQLException e) {
    506            handleException(e);
    507            return 0;
    508        }
    509    }
    510
    511    @Override
    512    public int getMaxConnections() throws SQLException {
    513        try {
    514            return databaseMetaData.getMaxConnections();
    515        } catch (final SQLException e) {
    516            handleException(e);
    517            return 0;
    518        }
    519    }
    520
    521    @Override
    522    public int getMaxCursorNameLength() throws SQLException {
    523        try {
    524            return databaseMetaData.getMaxCursorNameLength();
    525        } catch (final SQLException e) {
    526            handleException(e);
    527            return 0;
    528        }
    529    }
    530
    531    @Override
    532    public int getMaxIndexLength() throws SQLException {
    533        try {
    534            return databaseMetaData.getMaxIndexLength();
    535        } catch (final SQLException e) {
    536            handleException(e);
    537            return 0;
    538        }
    539    }
    540
    541    @Override
    542    public int getMaxProcedureNameLength() throws SQLException {
    543        try {
    544            return databaseMetaData.getMaxProcedureNameLength();
    545        } catch (final SQLException e) {
    546            handleException(e);
    547            return 0;
    548        }
    549    }
    550
    551    @Override
    552    public int getMaxRowSize() throws SQLException {
    553        try {
    554            return databaseMetaData.getMaxRowSize();
    555        } catch (final SQLException e) {
    556            handleException(e);
    557            return 0;
    558        }
    559    }
    560
    561    @Override
    562    public int getMaxSchemaNameLength() throws SQLException {
    563        try {
    564            return databaseMetaData.getMaxSchemaNameLength();
    565        } catch (final SQLException e) {
    566            handleException(e);
    567            return 0;
    568        }
    569    }
    570
    571    @Override
    572    public int getMaxStatementLength() throws SQLException {
    573        try {
    574            return databaseMetaData.getMaxStatementLength();
    575        } catch (final SQLException e) {
    576            handleException(e);
    577            return 0;
    578        }
    579    }
    580
    581    @Override
    582    public int getMaxStatements() throws SQLException {
    583        try {
    584            return databaseMetaData.getMaxStatements();
    585        } catch (final SQLException e) {
    586            handleException(e);
    587            return 0;
    588        }
    589    }
    590
    591    @Override
    592    public int getMaxTableNameLength() throws SQLException {
    593        try {
    594            return databaseMetaData.getMaxTableNameLength();
    595        } catch (final SQLException e) {
    596            handleException(e);
    597            return 0;
    598        }
    599    }
    600
    601    @Override
    602    public int getMaxTablesInSelect() throws SQLException {
    603        try {
    604            return databaseMetaData.getMaxTablesInSelect();
    605        } catch (final SQLException e) {
    606            handleException(e);
    607            return 0;
    608        }
    609    }
    610
    611    @Override
    612    public int getMaxUserNameLength() throws SQLException {
    613        try {
    614            return databaseMetaData.getMaxUserNameLength();
    615        } catch (final SQLException e) {
    616            handleException(e);
    617            return 0;
    618        }
    619    }
    620
    621    @Override
    622    public String getNumericFunctions() throws SQLException {
    623        try {
    624            return databaseMetaData.getNumericFunctions();
    625        } catch (final SQLException e) {
    626            handleException(e);
    627            throw new AssertionError();
    628        }
    629    }
    630
    631    @Override
    632    public ResultSet getPrimaryKeys(final String catalog, final String schema, final String table) throws SQLException {
    633        connection.checkOpen();
    634        try {
    635            return DelegatingResultSet.wrapResultSet(connection,
    636                    databaseMetaData.getPrimaryKeys(catalog, schema, table));
    637        } catch (final SQLException e) {
    638            handleException(e);
    639            throw new AssertionError();
    640        }
    641    }
    642
    643    @Override
    644    public ResultSet getProcedureColumns(final String catalog, final String schemaPattern,
    645            final String procedureNamePattern, final String columnNamePattern) throws SQLException {
    646        connection.checkOpen();
    647        try {
    648            return DelegatingResultSet.wrapResultSet(connection, databaseMetaData.getProcedureColumns(catalog,
    649                    schemaPattern, procedureNamePattern, columnNamePattern));
    650        } catch (final SQLException e) {
    651            handleException(e);
    652            throw new AssertionError();
    653        }
    654    }
    655
    656    @Override
    657    public String getProcedureTerm() throws SQLException {
    658        try {
    659            return databaseMetaData.getProcedureTerm();
    660        } catch (final SQLException e) {
    661            handleException(e);
    662            throw new AssertionError();
    663        }
    664    }
    665
    666    @Override
    667    public ResultSet getProcedures(final String catalog, final String schemaPattern, final String procedureNamePattern)
    668            throws SQLException {
    669        connection.checkOpen();
    670        try {
    671            return DelegatingResultSet.wrapResultSet(connection,
    672                    databaseMetaData.getProcedures(catalog, schemaPattern, procedureNamePattern));
    673        } catch (final SQLException e) {
    674            handleException(e);
    675            throw new AssertionError();
    676        }
    677    }
    678
    679    @Override
    680    public int getResultSetHoldability() throws SQLException {
    681        try {
    682            return databaseMetaData.getResultSetHoldability();
    683        } catch (final SQLException e) {
    684            handleException(e);
    685            return 0;
    686        }
    687    }
    688
    689    @Override
    690    public String getSQLKeywords() throws SQLException {
    691        try {
    692            return databaseMetaData.getSQLKeywords();
    693        } catch (final SQLException e) {
    694            handleException(e);
    695            throw new AssertionError();
    696        }
    697    }
    698
    699    @Override
    700    public int getSQLStateType() throws SQLException {
    701        try {
    702            return databaseMetaData.getSQLStateType();
    703        } catch (final SQLException e) {
    704            handleException(e);
    705            return 0;
    706        }
    707    }
    708
    709    @Override
    710    public String getSchemaTerm() throws SQLException {
    711        try {
    712            return databaseMetaData.getSchemaTerm();
    713        } catch (final SQLException e) {
    714            handleException(e);
    715            throw new AssertionError();
    716        }
    717    }
    718
    719    @Override
    720    public ResultSet getSchemas() throws SQLException {
    721        connection.checkOpen();
    722        try {
    723            return DelegatingResultSet.wrapResultSet(connection, databaseMetaData.getSchemas());
    724        } catch (final SQLException e) {
    725            handleException(e);
    726            throw new AssertionError();
    727        }
    728    }
    729
    730    @Override
    731    public String getSearchStringEscape() throws SQLException {
    732        try {
    733            return databaseMetaData.getSearchStringEscape();
    734        } catch (final SQLException e) {
    735            handleException(e);
    736            throw new AssertionError();
    737        }
    738    }
    739
    740    @Override
    741    public String getStringFunctions() throws SQLException {
    742        try {
    743            return databaseMetaData.getStringFunctions();
    744        } catch (final SQLException e) {
    745            handleException(e);
    746            throw new AssertionError();
    747        }
    748    }
    749
    750    @Override
    751    public ResultSet getSuperTables(final String catalog, final String schemaPattern, final String tableNamePattern)
    752            throws SQLException {
    753        connection.checkOpen();
    754        try {
    755            return DelegatingResultSet.wrapResultSet(connection,
    756                    databaseMetaData.getSuperTables(catalog, schemaPattern, tableNamePattern));
    757        } catch (final SQLException e) {
    758            handleException(e);
    759            throw new AssertionError();
    760        }
    761    }
    762
    763    @Override
    764    public ResultSet getSuperTypes(final String catalog, final String schemaPattern, final String typeNamePattern)
    765            throws SQLException {
    766        connection.checkOpen();
    767        try {
    768            return DelegatingResultSet.wrapResultSet(connection,
    769                    databaseMetaData.getSuperTypes(catalog, schemaPattern, typeNamePattern));
    770        } catch (final SQLException e) {
    771            handleException(e);
    772            throw new AssertionError();
    773        }
    774    }
    775
    776    @Override
    777    public String getSystemFunctions() throws SQLException {
    778        try {
    779            return databaseMetaData.getSystemFunctions();
    780        } catch (final SQLException e) {
    781            handleException(e);
    782            throw new AssertionError();
    783        }
    784    }
    785
    786    @Override
    787    public ResultSet getTablePrivileges(final String catalog, final String schemaPattern, final String tableNamePattern)
    788            throws SQLException {
    789        connection.checkOpen();
    790        try {
    791            return DelegatingResultSet.wrapResultSet(connection,
    792                    databaseMetaData.getTablePrivileges(catalog, schemaPattern, tableNamePattern));
    793        } catch (final SQLException e) {
    794            handleException(e);
    795            throw new AssertionError();
    796        }
    797    }
    798
    799    @Override
    800    public ResultSet getTableTypes() throws SQLException {
    801        connection.checkOpen();
    802        try {
    803            return DelegatingResultSet.wrapResultSet(connection, databaseMetaData.getTableTypes());
    804        } catch (final SQLException e) {
    805            handleException(e);
    806            throw new AssertionError();
    807        }
    808    }
    809
    810    @Override
    811    public ResultSet getTables(final String catalog, final String schemaPattern, final String tableNamePattern,
    812            final String[] types) throws SQLException {
    813        connection.checkOpen();
    814        try {
    815            return DelegatingResultSet.wrapResultSet(connection,
    816                    databaseMetaData.getTables(catalog, schemaPattern, tableNamePattern, types));
    817        } catch (final SQLException e) {
    818            handleException(e);
    819            throw new AssertionError();
    820        }
    821    }
    822
    823    @Override
    824    public String getTimeDateFunctions() throws SQLException {
    825        try {
    826            return databaseMetaData.getTimeDateFunctions();
    827        } catch (final SQLException e) {
    828            handleException(e);
    829            throw new AssertionError();
    830        }
    831    }
    832
    833    @Override
    834    public ResultSet getTypeInfo() throws SQLException {
    835        connection.checkOpen();
    836        try {
    837            return DelegatingResultSet.wrapResultSet(connection, databaseMetaData.getTypeInfo());
    838        } catch (final SQLException e) {
    839            handleException(e);
    840            throw new AssertionError();
    841        }
    842    }
    843
    844    @Override
    845    public ResultSet getUDTs(final String catalog, final String schemaPattern, final String typeNamePattern,
    846            final int[] types) throws SQLException {
    847        connection.checkOpen();
    848        try {
    849            return DelegatingResultSet.wrapResultSet(connection,
    850                    databaseMetaData.getUDTs(catalog, schemaPattern, typeNamePattern, types));
    851        } catch (final SQLException e) {
    852            handleException(e);
    853            throw new AssertionError();
    854        }
    855    }
    856
    857    @Override
    858    public String getURL() throws SQLException {
    859        try {
    860            return databaseMetaData.getURL();
    861        } catch (final SQLException e) {
    862            handleException(e);
    863            throw new AssertionError();
    864        }
    865    }
    866
    867    @Override
    868    public String getUserName() throws SQLException {
    869        try {
    870            return databaseMetaData.getUserName();
    871        } catch (final SQLException e) {
    872            handleException(e);
    873            throw new AssertionError();
    874        }
    875    }
    876
    877    @Override
    878    public ResultSet getVersionColumns(final String catalog, final String schema, final String table)
    879            throws SQLException {
    880        connection.checkOpen();
    881        try {
    882            return DelegatingResultSet.wrapResultSet(connection,
    883                    databaseMetaData.getVersionColumns(catalog, schema, table));
    884        } catch (final SQLException e) {
    885            handleException(e);
    886            throw new AssertionError();
    887        }
    888    }
    889
    890    @Override
    891    public boolean insertsAreDetected(final int type) throws SQLException {
    892        try {
    893            return databaseMetaData.insertsAreDetected(type);
    894        } catch (final SQLException e) {
    895            handleException(e);
    896            return false;
    897        }
    898    }
    899
    900    @Override
    901    public boolean isCatalogAtStart() throws SQLException {
    902        try {
    903            return databaseMetaData.isCatalogAtStart();
    904        } catch (final SQLException e) {
    905            handleException(e);
    906            return false;
    907        }
    908    }
    909
    910    @Override
    911    public boolean isReadOnly() throws SQLException {
    912        try {
    913            return databaseMetaData.isReadOnly();
    914        } catch (final SQLException e) {
    915            handleException(e);
    916            return false;
    917        }
    918    }
    919
    920    @Override
    921    public boolean locatorsUpdateCopy() throws SQLException {
    922        try {
    923            return databaseMetaData.locatorsUpdateCopy();
    924        } catch (final SQLException e) {
    925            handleException(e);
    926            return false;
    927        }
    928    }
    929
    930    @Override
    931    public boolean nullPlusNonNullIsNull() throws SQLException {
    932        try {
    933            return databaseMetaData.nullPlusNonNullIsNull();
    934        } catch (final SQLException e) {
    935            handleException(e);
    936            return false;
    937        }
    938    }
    939
    940    @Override
    941    public boolean nullsAreSortedAtEnd() throws SQLException {
    942        try {
    943            return databaseMetaData.nullsAreSortedAtEnd();
    944        } catch (final SQLException e) {
    945            handleException(e);
    946            return false;
    947        }
    948    }
    949
    950    @Override
    951    public boolean nullsAreSortedAtStart() throws SQLException {
    952        try {
    953            return databaseMetaData.nullsAreSortedAtStart();
    954        } catch (final SQLException e) {
    955            handleException(e);
    956            return false;
    957        }
    958    }
    959
    960    @Override
    961    public boolean nullsAreSortedHigh() throws SQLException {
    962        try {
    963            return databaseMetaData.nullsAreSortedHigh();
    964        } catch (final SQLException e) {
    965            handleException(e);
    966            return false;
    967        }
    968    }
    969
    970    @Override
    971    public boolean nullsAreSortedLow() throws SQLException {
    972        try {
    973            return databaseMetaData.nullsAreSortedLow();
    974        } catch (final SQLException e) {
    975            handleException(e);
    976            return false;
    977        }
    978    }
    979
    980    @Override
    981    public boolean othersDeletesAreVisible(final int type) throws SQLException {
    982        try {
    983            return databaseMetaData.othersDeletesAreVisible(type);
    984        } catch (final SQLException e) {
    985            handleException(e);
    986            return false;
    987        }
    988    }
    989
    990    @Override
    991    public boolean othersInsertsAreVisible(final int type) throws SQLException {
    992        try {
    993            return databaseMetaData.othersInsertsAreVisible(type);
    994        } catch (final SQLException e) {
    995            handleException(e);
    996            return false;
    997        }
    998    }
    999
    1000    @Override
    1001    public boolean othersUpdatesAreVisible(final int type) throws SQLException {
    1002        try {
    1003            return databaseMetaData.othersUpdatesAreVisible(type);
    1004        } catch (final SQLException e) {
    1005            handleException(e);
    1006            return false;
    1007        }
    1008    }
    1009
    1010    @Override
    1011    public boolean ownDeletesAreVisible(final int type) throws SQLException {
    1012        try {
    1013            return databaseMetaData.ownDeletesAreVisible(type);
    1014        } catch (final SQLException e) {
    1015            handleException(e);
    1016            return false;
    1017        }
    1018    }
    1019
    1020    @Override
    1021    public boolean ownInsertsAreVisible(final int type) throws SQLException {
    1022        try {
    1023            return databaseMetaData.ownInsertsAreVisible(type);
    1024        } catch (final SQLException e) {
    1025            handleException(e);
    1026            return false;
    1027        }
    1028    }
    1029
    1030    @Override
    1031    public boolean ownUpdatesAreVisible(final int type) throws SQLException {
    1032        try {
    1033            return databaseMetaData.ownUpdatesAreVisible(type);
    1034        } catch (final SQLException e) {
    1035            handleException(e);
    1036            return false;
    1037        }
    1038    }
    1039
    1040    @Override
    1041    public boolean storesLowerCaseIdentifiers() throws SQLException {
    1042        try {
    1043            return databaseMetaData.storesLowerCaseIdentifiers();
    1044        } catch (final SQLException e) {
    1045            handleException(e);
    1046            return false;
    1047        }
    1048    }
    1049
    1050    @Override
    1051    public boolean storesLowerCaseQuotedIdentifiers() throws SQLException {
    1052        try {
    1053            return databaseMetaData.storesLowerCaseQuotedIdentifiers();
    1054        } catch (final SQLException e) {
    1055            handleException(e);
    1056            return false;
    1057        }
    1058    }
    1059
    1060    @Override
    1061    public boolean storesMixedCaseIdentifiers() throws SQLException {
    1062        try {
    1063            return databaseMetaData.storesMixedCaseIdentifiers();
    1064        } catch (final SQLException e) {
    1065            handleException(e);
    1066            return false;
    1067        }
    1068    }
    1069
    1070    @Override
    1071    public boolean storesMixedCaseQuotedIdentifiers() throws SQLException {
    1072        try {
    1073            return databaseMetaData.storesMixedCaseQuotedIdentifiers();
    1074        } catch (final SQLException e) {
    1075            handleException(e);
    1076            return false;
    1077        }
    1078    }
    1079
    1080    @Override
    1081    public boolean storesUpperCaseIdentifiers() throws SQLException {
    1082        try {
    1083            return databaseMetaData.storesUpperCaseIdentifiers();
    1084        } catch (final SQLException e) {
    1085            handleException(e);
    1086            return false;
    1087        }
    1088    }
    1089
    1090    @Override
    1091    public boolean storesUpperCaseQuotedIdentifiers() throws SQLException {
    1092        try {
    1093            return databaseMetaData.storesUpperCaseQuotedIdentifiers();
    1094        } catch (final SQLException e) {
    1095            handleException(e);
    1096            return false;
    1097        }
    1098    }
    1099
    1100    @Override
    1101    public boolean supportsANSI92EntryLevelSQL() throws SQLException {
    1102        try {
    1103            return databaseMetaData.supportsANSI92EntryLevelSQL();
    1104        } catch (final SQLException e) {
    1105            handleException(e);
    1106            return false;
    1107        }
    1108    }
    1109
    1110    @Override
    1111    public boolean supportsANSI92FullSQL() throws SQLException {
    1112        try {
    1113            return databaseMetaData.supportsANSI92FullSQL();
    1114        } catch (final SQLException e) {
    1115            handleException(e);
    1116            return false;
    1117        }
    1118    }
    1119
    1120    @Override
    1121    public boolean supportsANSI92IntermediateSQL() throws SQLException {
    1122        try {
    1123            return databaseMetaData.supportsANSI92IntermediateSQL();
    1124        } catch (final SQLException e) {
    1125            handleException(e);
    1126            return false;
    1127        }
    1128    }
    1129
    1130    @Override
    1131    public boolean supportsAlterTableWithAddColumn() throws SQLException {
    1132        try {
    1133            return databaseMetaData.supportsAlterTableWithAddColumn();
    1134        } catch (final SQLException e) {
    1135            handleException(e);
    1136            return false;
    1137        }
    1138    }
    1139
    1140    @Override
    1141    public boolean supportsAlterTableWithDropColumn() throws SQLException {
    1142        try {
    1143            return databaseMetaData.supportsAlterTableWithDropColumn();
    1144        } catch (final SQLException e) {
    1145            handleException(e);
    1146            return false;
    1147        }
    1148    }
    1149
    1150    @Override
    1151    public boolean supportsBatchUpdates() throws SQLException {
    1152        try {
    1153            return databaseMetaData.supportsBatchUpdates();
    1154        } catch (final SQLException e) {
    1155            handleException(e);
    1156            return false;
    1157        }
    1158    }
    1159
    1160    @Override
    1161    public boolean supportsCatalogsInDataManipulation() throws SQLException {
    1162        try {
    1163            return databaseMetaData.supportsCatalogsInDataManipulation();
    1164        } catch (final SQLException e) {
    1165            handleException(e);
    1166            return false;
    1167        }
    1168    }
    1169
    1170    @Override
    1171    public boolean supportsCatalogsInIndexDefinitions() throws SQLException {
    1172        try {
    1173            return databaseMetaData.supportsCatalogsInIndexDefinitions();
    1174        } catch (final SQLException e) {
    1175            handleException(e);
    1176            return false;
    1177        }
    1178    }
    1179
    1180    @Override
    1181    public boolean supportsCatalogsInPrivilegeDefinitions() throws SQLException {
    1182        try {
    1183            return databaseMetaData.supportsCatalogsInPrivilegeDefinitions();
    1184        } catch (final SQLException e) {
    1185            handleException(e);
    1186            return false;
    1187        }
    1188    }
    1189
    1190    @Override
    1191    public boolean supportsCatalogsInProcedureCalls() throws SQLException {
    1192        try {
    1193            return databaseMetaData.supportsCatalogsInProcedureCalls();
    1194        } catch (final SQLException e) {
    1195            handleException(e);
    1196            return false;
    1197        }
    1198    }
    1199
    1200    @Override
    1201    public boolean supportsCatalogsInTableDefinitions() throws SQLException {
    1202        try {
    1203            return databaseMetaData.supportsCatalogsInTableDefinitions();
    1204        } catch (final SQLException e) {
    1205            handleException(e);
    1206            return false;
    1207        }
    1208    }
    1209
    1210    @Override
    1211    public boolean supportsColumnAliasing() throws SQLException {
    1212        try {
    1213            return databaseMetaData.supportsColumnAliasing();
    1214        } catch (final SQLException e) {
    1215            handleException(e);
    1216            return false;
    1217        }
    1218    }
    1219
    1220    @Override
    1221    public boolean supportsConvert() throws SQLException {
    1222        try {
    1223            return databaseMetaData.supportsConvert();
    1224        } catch (final SQLException e) {
    1225            handleException(e);
    1226            return false;
    1227        }
    1228    }
    1229
    1230    @Override
    1231    public boolean supportsConvert(final int fromType, final int toType) throws SQLException {
    1232        try {
    1233            return databaseMetaData.supportsConvert(fromType, toType);
    1234        } catch (final SQLException e) {
    1235            handleException(e);
    1236            return false;
    1237        }
    1238    }
    1239
    1240    @Override
    1241    public boolean supportsCoreSQLGrammar() throws SQLException {
    1242        try {
    1243            return databaseMetaData.supportsCoreSQLGrammar();
    1244        } catch (final SQLException e) {
    1245            handleException(e);
    1246            return false;
    1247        }
    1248    }
    1249
    1250    @Override
    1251    public boolean supportsCorrelatedSubqueries() throws SQLException {
    1252        try {
    1253            return databaseMetaData.supportsCorrelatedSubqueries();
    1254        } catch (final SQLException e) {
    1255            handleException(e);
    1256            return false;
    1257        }
    1258    }
    1259
    1260    @Override
    1261    public boolean supportsDataDefinitionAndDataManipulationTransactions() throws SQLException {
    1262        try {
    1263            return databaseMetaData.supportsDataDefinitionAndDataManipulationTransactions();
    1264        } catch (final SQLException e) {
    1265            handleException(e);
    1266            return false;
    1267        }
    1268    }
    1269
    1270    @Override
    1271    public boolean supportsDataManipulationTransactionsOnly() throws SQLException {
    1272        try {
    1273            return databaseMetaData.supportsDataManipulationTransactionsOnly();
    1274        } catch (final SQLException e) {
    1275            handleException(e);
    1276            return false;
    1277        }
    1278    }
    1279
    1280    @Override
    1281    public boolean supportsDifferentTableCorrelationNames() throws SQLException {
    1282        try {
    1283            return databaseMetaData.supportsDifferentTableCorrelationNames();
    1284        } catch (final SQLException e) {
    1285            handleException(e);
    1286            return false;
    1287        }
    1288    }
    1289
    1290    @Override
    1291    public boolean supportsExpressionsInOrderBy() throws SQLException {
    1292        try {
    1293            return databaseMetaData.supportsExpressionsInOrderBy();
    1294        } catch (final SQLException e) {
    1295            handleException(e);
    1296            return false;
    1297        }
    1298    }
    1299
    1300    @Override
    1301    public boolean supportsExtendedSQLGrammar() throws SQLException {
    1302        try {
    1303            return databaseMetaData.supportsExtendedSQLGrammar();
    1304        } catch (final SQLException e) {
    1305            handleException(e);
    1306            return false;
    1307        }
    1308    }
    1309
    1310    @Override
    1311    public boolean supportsFullOuterJoins() throws SQLException {
    1312        try {
    1313            return databaseMetaData.supportsFullOuterJoins();
    1314        } catch (final SQLException e) {
    1315            handleException(e);
    1316            return false;
    1317        }
    1318    }
    1319
    1320    @Override
    1321    public boolean supportsGetGeneratedKeys() throws SQLException {
    1322        try {
    1323            return databaseMetaData.supportsGetGeneratedKeys();
    1324        } catch (final SQLException e) {
    1325            handleException(e);
    1326            return false;
    1327        }
    1328    }
    1329
    1330    @Override
    1331    public boolean supportsGroupBy() throws SQLException {
    1332        try {
    1333            return databaseMetaData.supportsGroupBy();
    1334        } catch (final SQLException e) {
    1335            handleException(e);
    1336            return false;
    1337        }
    1338    }
    1339
    1340    @Override
    1341    public boolean supportsGroupByBeyondSelect() throws SQLException {
    1342        try {
    1343            return databaseMetaData.supportsGroupByBeyondSelect();
    1344        } catch (final SQLException e) {
    1345            handleException(e);
    1346            return false;
    1347        }
    1348    }
    1349
    1350    @Override
    1351    public boolean supportsGroupByUnrelated() throws SQLException {
    1352        try {
    1353            return databaseMetaData.supportsGroupByUnrelated();
    1354        } catch (final SQLException e) {
    1355            handleException(e);
    1356            return false;
    1357        }
    1358    }
    1359
    1360    @Override
    1361    public boolean supportsIntegrityEnhancementFacility() throws SQLException {
    1362        try {
    1363            return databaseMetaData.supportsIntegrityEnhancementFacility();
    1364        } catch (final SQLException e) {
    1365            handleException(e);
    1366            return false;
    1367        }
    1368    }
    1369
    1370    @Override
    1371    public boolean supportsLikeEscapeClause() throws SQLException {
    1372        try {
    1373            return databaseMetaData.supportsLikeEscapeClause();
    1374        } catch (final SQLException e) {
    1375            handleException(e);
    1376            return false;
    1377        }
    1378    }
    1379
    1380    @Override
    1381    public boolean supportsLimitedOuterJoins() throws SQLException {
    1382        try {
    1383            return databaseMetaData.supportsLimitedOuterJoins();
    1384        } catch (final SQLException e) {
    1385            handleException(e);
    1386            return false;
    1387        }
    1388    }
    1389
    1390    @Override
    1391    public boolean supportsMinimumSQLGrammar() throws SQLException {
    1392        try {
    1393            return databaseMetaData.supportsMinimumSQLGrammar();
    1394        } catch (final SQLException e) {
    1395            handleException(e);
    1396            return false;
    1397        }
    1398    }
    1399
    1400    @Override
    1401    public boolean supportsMixedCaseIdentifiers() throws SQLException {
    1402        try {
    1403            return databaseMetaData.supportsMixedCaseIdentifiers();
    1404        } catch (final SQLException e) {
    1405            handleException(e);
    1406            return false;
    1407        }
    1408    }
    1409
    1410    @Override
    1411    public boolean supportsMixedCaseQuotedIdentifiers() throws SQLException {
    1412        try {
    1413            return databaseMetaData.supportsMixedCaseQuotedIdentifiers();
    1414        } catch (final SQLException e) {
    1415            handleException(e);
    1416            return false;
    1417        }
    1418    }
    1419
    1420    @Override
    1421    public boolean supportsMultipleOpenResults() throws SQLException {
    1422        try {
    1423            return databaseMetaData.supportsMultipleOpenResults();
    1424        } catch (final SQLException e) {
    1425            handleException(e);
    1426            return false;
    1427        }
    1428    }
    1429
    1430    @Override
    1431    public boolean supportsMultipleResultSets() throws SQLException {
    1432        try {
    1433            return databaseMetaData.supportsMultipleResultSets();
    1434        } catch (final SQLException e) {
    1435            handleException(e);
    1436            return false;
    1437        }
    1438    }
    1439
    1440    @Override
    1441    public boolean supportsMultipleTransactions() throws SQLException {
    1442        try {
    1443            return databaseMetaData.supportsMultipleTransactions();
    1444        } catch (final SQLException e) {
    1445            handleException(e);
    1446            return false;
    1447        }
    1448    }
    1449
    1450    @Override
    1451    public boolean supportsNamedParameters() throws SQLException {
    1452        try {
    1453            return databaseMetaData.supportsNamedParameters();
    1454        } catch (final SQLException e) {
    1455            handleException(e);
    1456            return false;
    1457        }
    1458    }
    1459
    1460    @Override
    1461    public boolean supportsNonNullableColumns() throws SQLException {
    1462        try {
    1463            return databaseMetaData.supportsNonNullableColumns();
    1464        } catch (final SQLException e) {
    1465            handleException(e);
    1466            return false;
    1467        }
    1468    }
    1469
    1470    @Override
    1471    public boolean supportsOpenCursorsAcrossCommit() throws SQLException {
    1472        try {
    1473            return databaseMetaData.supportsOpenCursorsAcrossCommit();
    1474        } catch (final SQLException e) {
    1475            handleException(e);
    1476            return false;
    1477        }
    1478    }
    1479
    1480    @Override
    1481    public boolean supportsOpenCursorsAcrossRollback() throws SQLException {
    1482        try {
    1483            return databaseMetaData.supportsOpenCursorsAcrossRollback();
    1484        } catch (final SQLException e) {
    1485            handleException(e);
    1486            return false;
    1487        }
    1488    }
    1489
    1490    @Override
    1491    public boolean supportsOpenStatementsAcrossCommit() throws SQLException {
    1492        try {
    1493            return databaseMetaData.supportsOpenStatementsAcrossCommit();
    1494        } catch (final SQLException e) {
    1495            handleException(e);
    1496            return false;
    1497        }
    1498    }
    1499
    1500    @Override
    1501    public boolean supportsOpenStatementsAcrossRollback() throws SQLException {
    1502        try {
    1503            return databaseMetaData.supportsOpenStatementsAcrossRollback();
    1504        } catch (final SQLException e) {
    1505            handleException(e);
    1506            return false;
    1507        }
    1508    }
    1509
    1510    @Override
    1511    public boolean supportsOrderByUnrelated() throws SQLException {
    1512        try {
    1513            return databaseMetaData.supportsOrderByUnrelated();
    1514        } catch (final SQLException e) {
    1515            handleException(e);
    1516            return false;
    1517        }
    1518    }
    1519
    1520    @Override
    1521    public boolean supportsOuterJoins() throws SQLException {
    1522        try {
    1523            return databaseMetaData.supportsOuterJoins();
    1524        } catch (final SQLException e) {
    1525            handleException(e);
    1526            return false;
    1527        }
    1528    }
    1529
    1530    @Override
    1531    public boolean supportsPositionedDelete() throws SQLException {
    1532        try {
    1533            return databaseMetaData.supportsPositionedDelete();
    1534        } catch (final SQLException e) {
    1535            handleException(e);
    1536            return false;
    1537        }
    1538    }
    1539
    1540    @Override
    1541    public boolean supportsPositionedUpdate() throws SQLException {
    1542        try {
    1543            return databaseMetaData.supportsPositionedUpdate();
    1544        } catch (final SQLException e) {
    1545            handleException(e);
    1546            return false;
    1547        }
    1548    }
    1549
    1550    @Override
    1551    public boolean supportsResultSetConcurrency(final int type, final int concurrency) throws SQLException {
    1552        try {
    1553            return databaseMetaData.supportsResultSetConcurrency(type, concurrency);
    1554        } catch (final SQLException e) {
    1555            handleException(e);
    1556            return false;
    1557        }
    1558    }
    1559
    1560    @Override
    1561    public boolean supportsResultSetHoldability(final int holdability) throws SQLException {
    1562        try {
    1563            return databaseMetaData.supportsResultSetHoldability(holdability);
    1564        } catch (final SQLException e) {
    1565            handleException(e);
    1566            return false;
    1567        }
    1568    }
    1569
    1570    @Override
    1571    public boolean supportsResultSetType(final int type) throws SQLException {
    1572        try {
    1573            return databaseMetaData.supportsResultSetType(type);
    1574        } catch (final SQLException e) {
    1575            handleException(e);
    1576            return false;
    1577        }
    1578    }
    1579
    1580    @Override
    1581    public boolean supportsSavepoints() throws SQLException {
    1582        try {
    1583            return databaseMetaData.supportsSavepoints();
    1584        } catch (final SQLException e) {
    1585            handleException(e);
    1586            return false;
    1587        }
    1588    }
    1589
    1590    @Override
    1591    public boolean supportsSchemasInDataManipulation() throws SQLException {
    1592        try {
    1593            return databaseMetaData.supportsSchemasInDataManipulation();
    1594        } catch (final SQLException e) {
    1595            handleException(e);
    1596            return false;
    1597        }
    1598    }
    1599
    1600    @Override
    1601    public boolean supportsSchemasInIndexDefinitions() throws SQLException {
    1602        try {
    1603            return databaseMetaData.supportsSchemasInIndexDefinitions();
    1604        } catch (final SQLException e) {
    1605            handleException(e);
    1606            return false;
    1607        }
    1608    }
    1609
    1610    @Override
    1611    public boolean supportsSchemasInPrivilegeDefinitions() throws SQLException {
    1612        try {
    1613            return databaseMetaData.supportsSchemasInPrivilegeDefinitions();
    1614        } catch (final SQLException e) {
    1615            handleException(e);
    1616            return false;
    1617        }
    1618    }
    1619
    1620    @Override
    1621    public boolean supportsSchemasInProcedureCalls() throws SQLException {
    1622        try {
    1623            return databaseMetaData.supportsSchemasInProcedureCalls();
    1624        } catch (final SQLException e) {
    1625            handleException(e);
    1626            return false;
    1627        }
    1628    }
    1629
    1630    @Override
    1631    public boolean supportsSchemasInTableDefinitions() throws SQLException {
    1632        try {
    1633            return databaseMetaData.supportsSchemasInTableDefinitions();
    1634        } catch (final SQLException e) {
    1635            handleException(e);
    1636            return false;
    1637        }
    1638    }
    1639
    1640    @Override
    1641    public boolean supportsSelectForUpdate() throws SQLException {
    1642        try {
    1643            return databaseMetaData.supportsSelectForUpdate();
    1644        } catch (final SQLException e) {
    1645            handleException(e);
    1646            return false;
    1647        }
    1648    }
    1649
    1650    @Override
    1651    public boolean supportsStatementPooling() throws SQLException {
    1652        try {
    1653            return databaseMetaData.supportsStatementPooling();
    1654        } catch (final SQLException e) {
    1655            handleException(e);
    1656            return false;
    1657        }
    1658    }
    1659
    1660    @Override
    1661    public boolean supportsStoredProcedures() throws SQLException {
    1662        try {
    1663            return databaseMetaData.supportsStoredProcedures();
    1664        } catch (final SQLException e) {
    1665            handleException(e);
    1666            return false;
    1667        }
    1668    }
    1669
    1670    @Override
    1671    public boolean supportsSubqueriesInComparisons() throws SQLException {
    1672        try {
    1673            return databaseMetaData.supportsSubqueriesInComparisons();
    1674        } catch (final SQLException e) {
    1675            handleException(e);
    1676            return false;
    1677        }
    1678    }
    1679
    1680    @Override
    1681    public boolean supportsSubqueriesInExists() throws SQLException {
    1682        try {
    1683            return databaseMetaData.supportsSubqueriesInExists();
    1684        } catch (final SQLException e) {
    1685            handleException(e);
    1686            return false;
    1687        }
    1688    }
    1689
    1690    @Override
    1691    public boolean supportsSubqueriesInIns() throws SQLException {
    1692        try {
    1693            return databaseMetaData.supportsSubqueriesInIns();
    1694        } catch (final SQLException e) {
    1695            handleException(e);
    1696            return false;
    1697        }
    1698    }
    1699
    1700    @Override
    1701    public boolean supportsSubqueriesInQuantifieds() throws SQLException {
    1702        try {
    1703            return databaseMetaData.supportsSubqueriesInQuantifieds();
    1704        } catch (final SQLException e) {
    1705            handleException(e);
    1706            return false;
    1707        }
    1708    }
    1709
    1710    @Override
    1711    public boolean supportsTableCorrelationNames() throws SQLException {
    1712        try {
    1713            return databaseMetaData.supportsTableCorrelationNames();
    1714        } catch (final SQLException e) {
    1715            handleException(e);
    1716            return false;
    1717        }
    1718    }
    1719
    1720    @Override
    1721    public boolean supportsTransactionIsolationLevel(final int level) throws SQLException {
    1722        try {
    1723            return databaseMetaData.supportsTransactionIsolationLevel(level);
    1724        } catch (final SQLException e) {
    1725            handleException(e);
    1726            return false;
    1727        }
    1728    }
    1729
    1730    @Override
    1731    public boolean supportsTransactions() throws SQLException {
    1732        try {
    1733            return databaseMetaData.supportsTransactions();
    1734        } catch (final SQLException e) {
    1735            handleException(e);
    1736            return false;
    1737        }
    1738    }
    1739
    1740    @Override
    1741    public boolean supportsUnion() throws SQLException {
    1742        try {
    1743            return databaseMetaData.supportsUnion();
    1744        } catch (final SQLException e) {
    1745            handleException(e);
    1746            return false;
    1747        }
    1748    }
    1749
    1750    @Override
    1751    public boolean supportsUnionAll() throws SQLException {
    1752        try {
    1753            return databaseMetaData.supportsUnionAll();
    1754        } catch (final SQLException e) {
    1755            handleException(e);
    1756            return false;
    1757        }
    1758    }
    1759
    1760    @Override
    1761    public boolean updatesAreDetected(final int type) throws SQLException {
    1762        try {
    1763            return databaseMetaData.updatesAreDetected(type);
    1764        } catch (final SQLException e) {
    1765            handleException(e);
    1766            return false;
    1767        }
    1768    }
    1769
    1770    @Override
    1771    public boolean usesLocalFilePerTable() throws SQLException {
    1772        try {
    1773            return databaseMetaData.usesLocalFilePerTable();
    1774        } catch (final SQLException e) {
    1775            handleException(e);
    1776            return false;
    1777        }
    1778    }
    1779
    1780    @Override
    1781    public boolean usesLocalFiles() throws SQLException {
    1782        try {
    1783            return databaseMetaData.usesLocalFiles();
    1784        } catch (final SQLException e) {
    1785            handleException(e);
    1786            return false;
    1787        }
    1788    }
    1789
    1790    /* JDBC_4_ANT_KEY_BEGIN */
    1791
    1792    @Override
    1793    public boolean isWrapperFor(final Class<?> iface) throws SQLException {
    1794        if (iface.isAssignableFrom(getClass())) {
    1795            return true;
    1796        } else if (iface.isAssignableFrom(databaseMetaData.getClass())) {
    1797            return true;
    1798        } else {
    1799            return databaseMetaData.isWrapperFor(iface);
    1800        }
    1801    }
    1802
    1803    @Override
    1804    public <T> T unwrap(final Class<T> iface) throws SQLException {
    1805        if (iface.isAssignableFrom(getClass())) {
    1806            return iface.cast(this);
    1807        } else if (iface.isAssignableFrom(databaseMetaData.getClass())) {
    1808            return iface.cast(databaseMetaData);
    1809        } else {
    1810            return databaseMetaData.unwrap(iface);
    1811        }
    1812    }
    1813
    1814    @Override
    1815    public RowIdLifetime getRowIdLifetime() throws SQLException {
    1816        try {
    1817            return databaseMetaData.getRowIdLifetime();
    1818        } catch (final SQLException e) {
    1819            handleException(e);
    1820            throw new AssertionError();
    1821        }
    1822    }
    1823
    1824    @Override
    1825    public ResultSet getSchemas(final String catalog, final String schemaPattern) throws SQLException {
    1826        connection.checkOpen();
    1827        try {
    1828            return DelegatingResultSet.wrapResultSet(connection, databaseMetaData.getSchemas(catalog, schemaPattern));
    1829        } catch (final SQLException e) {
    1830            handleException(e);
    1831            throw new AssertionError();
    1832        }
    1833    }
    1834
    1835    @Override
    1836    public boolean autoCommitFailureClosesAllResultSets() throws SQLException {
    1837        try {
    1838            return databaseMetaData.autoCommitFailureClosesAllResultSets();
    1839        } catch (final SQLException e) {
    1840            handleException(e);
    1841            return false;
    1842        }
    1843    }
    1844
    1845    @Override
    1846    public boolean supportsStoredFunctionsUsingCallSyntax() throws SQLException {
    1847        try {
    1848            return databaseMetaData.supportsStoredFunctionsUsingCallSyntax();
    1849        } catch (final SQLException e) {
    1850            handleException(e);
    1851            return false;
    1852        }
    1853    }
    1854
    1855    @Override
    1856    public ResultSet getClientInfoProperties() throws SQLException {
    1857        connection.checkOpen();
    1858        try {
    1859            return DelegatingResultSet.wrapResultSet(connection, databaseMetaData.getClientInfoProperties());
    1860        } catch (final SQLException e) {
    1861            handleException(e);
    1862            throw new AssertionError();
    1863        }
    1864    }
    1865
    1866    @Override
    1867    public ResultSet getFunctions(final String catalog, final String schemaPattern, final String functionNamePattern)
    1868            throws SQLException {
    1869        connection.checkOpen();
    1870        try {
    1871            return DelegatingResultSet.wrapResultSet(connection,
    1872                    databaseMetaData.getFunctions(catalog, schemaPattern, functionNamePattern));
    1873        } catch (final SQLException e) {
    1874            handleException(e);
    1875            throw new AssertionError();
    1876        }
    1877    }
    1878
    1879    @Override
    1880    public ResultSet getFunctionColumns(final String catalog, final String schemaPattern,
    1881            final String functionNamePattern, final String columnNamePattern) throws SQLException {
    1882        connection.checkOpen();
    1883        try {
    1884            return DelegatingResultSet.wrapResultSet(connection, databaseMetaData.getFunctionColumns(catalog,
    1885                    schemaPattern, functionNamePattern, columnNamePattern));
    1886        } catch (final SQLException e) {
    1887            handleException(e);
    1888            throw new AssertionError();
    1889        }
    1890    }
    1891
    1892    /* JDBC_4_ANT_KEY_END */
    1893
    1894    @Override
    1895    public ResultSet getPseudoColumns(final String catalog, final String schemaPattern, final String tableNamePattern,
    1896            final String columnNamePattern) throws SQLException {
    1897        connection.checkOpen();
    1898        try {
    1899            return DelegatingResultSet.wrapResultSet(connection,
    1900                    databaseMetaData.getPseudoColumns(catalog, schemaPattern, tableNamePattern, columnNamePattern));
    1901        } catch (final SQLException e) {
    1902            handleException(e);
    1903            throw new AssertionError();
    1904        }
    1905    }
    1906
    1907    @Override
    1908    public boolean generatedKeyAlwaysReturned() throws SQLException {
    1909        connection.checkOpen();
    1910        try {
    1911            return databaseMetaData.generatedKeyAlwaysReturned();
    1912        } catch (final SQLException e) {
    1913            handleException(e);
    1914            return false;
    1915        }
    1916    }
    1917}