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