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>A base delegating implementation of {@link DatabaseMetaData}.</p> 027 * 028 * <p>Methods that create {@link ResultSet} objects are wrapped to 029 * create {@link DelegatingResultSet} objects and the remaining methods 030 * simply call the corresponding method on the "delegate" 031 * provided in the constructor.</p> 032 * @version $Id: DelegatingDatabaseMetaData.java 1649430 2015-01-04 21:29:32Z tn $ 033 * @since 2.0 034 */ 035public class DelegatingDatabaseMetaData implements DatabaseMetaData { 036 037 /** My delegate {@link DatabaseMetaData} */ 038 private final DatabaseMetaData _meta; 039 040 /** The connection that created me. **/ 041 private final DelegatingConnection<?> _conn; 042 043 public DelegatingDatabaseMetaData(DelegatingConnection<?> c, 044 DatabaseMetaData m) { 045 super(); 046 _conn = c; 047 _meta = m; 048 } 049 050 public DatabaseMetaData getDelegate() { 051 return _meta; 052 } 053 054 /** 055 * If my underlying {@link ResultSet} is not a 056 * {@code DelegatingResultSet}, returns it, 057 * otherwise recursively invokes this method on 058 * my delegate. 059 * <p> 060 * Hence this method will return the first 061 * delegate that is not a {@code DelegatingResultSet}, 062 * or {@code null} when no non-{@code DelegatingResultSet} 063 * delegate can be found by transversing this chain. 064 * <p> 065 * This method is useful when you may have nested 066 * {@code DelegatingResultSet}s, and you want to make 067 * sure to obtain a "genuine" {@link ResultSet}. 068 */ 069 public DatabaseMetaData getInnermostDelegate() { 070 DatabaseMetaData m = _meta; 071 while(m != null && m instanceof DelegatingDatabaseMetaData) { 072 m = ((DelegatingDatabaseMetaData)m).getDelegate(); 073 if(this == m) { 074 return null; 075 } 076 } 077 return m; 078 } 079 080 protected void handleException(SQLException e) throws SQLException { 081 if (_conn != null) { 082 _conn.handleException(e); 083 } 084 else { 085 throw e; 086 } 087 } 088 089 @Override 090 public boolean allProceduresAreCallable() throws SQLException { 091 try { return _meta.allProceduresAreCallable(); } 092 catch (SQLException e) { handleException(e); return false; } 093 } 094 095 @Override 096 public boolean allTablesAreSelectable() throws SQLException { 097 try { return _meta.allTablesAreSelectable(); } 098 catch (SQLException e) { handleException(e); return false; } 099 } 100 101 @Override 102 public boolean dataDefinitionCausesTransactionCommit() throws SQLException { 103 try { return _meta.dataDefinitionCausesTransactionCommit(); } 104 catch (SQLException e) { handleException(e); return false; } 105 } 106 107 @Override 108 public boolean dataDefinitionIgnoredInTransactions() throws SQLException { 109 try { return _meta.dataDefinitionIgnoredInTransactions(); } 110 catch (SQLException e) { handleException(e); return false; } 111 } 112 113 @Override 114 public boolean deletesAreDetected(int type) throws SQLException { 115 try { return _meta.deletesAreDetected(type); } 116 catch (SQLException e) { handleException(e); return false; } 117 } 118 119 @Override 120 public boolean doesMaxRowSizeIncludeBlobs() throws SQLException { 121 try { return _meta.doesMaxRowSizeIncludeBlobs(); } 122 catch (SQLException e) { handleException(e); return false; } 123 } 124 125 @Override 126 public ResultSet getAttributes(String catalog, String schemaPattern, 127 String typeNamePattern, String attributeNamePattern) 128 throws SQLException { 129 _conn.checkOpen(); 130 try { 131 return DelegatingResultSet.wrapResultSet(_conn,_meta.getAttributes( 132 catalog, schemaPattern, typeNamePattern, 133 attributeNamePattern)); 134 } 135 catch (SQLException e) { 136 handleException(e); 137 throw new AssertionError(); 138 } 139 } 140 141 @Override 142 public ResultSet getBestRowIdentifier(String catalog, String schema, 143 String table, int scope, boolean nullable) throws SQLException { 144 _conn.checkOpen(); 145 try { 146 return DelegatingResultSet.wrapResultSet(_conn, 147 _meta.getBestRowIdentifier(catalog, schema, table, scope, 148 nullable)); 149 } 150 catch (SQLException e) { 151 handleException(e); 152 throw new AssertionError(); 153 } 154 } 155 156 @Override 157 public String getCatalogSeparator() throws SQLException { 158 try { return _meta.getCatalogSeparator(); } 159 catch (SQLException e) { handleException(e); throw new AssertionError(); } 160 } 161 162 @Override 163 public String getCatalogTerm() throws SQLException { 164 try { return _meta.getCatalogTerm(); } 165 catch (SQLException e) { handleException(e); throw new AssertionError(); } 166 } 167 168 @Override 169 public ResultSet getCatalogs() throws SQLException { 170 _conn.checkOpen(); 171 try { 172 return DelegatingResultSet.wrapResultSet(_conn, 173 _meta.getCatalogs()); 174 } 175 catch (SQLException e) { 176 handleException(e); 177 throw new AssertionError(); 178 } 179 } 180 181 @Override 182 public ResultSet getColumnPrivileges(String catalog, String schema, 183 String table, String columnNamePattern) throws SQLException { 184 _conn.checkOpen(); 185 try { 186 return DelegatingResultSet.wrapResultSet(_conn, 187 _meta.getColumnPrivileges(catalog, schema, table, 188 columnNamePattern)); 189 } 190 catch (SQLException e) { 191 handleException(e); 192 throw new AssertionError(); 193 } 194 } 195 196 @Override 197 public ResultSet getColumns(String catalog, String schemaPattern, 198 String tableNamePattern, String columnNamePattern) 199 throws SQLException { 200 _conn.checkOpen(); 201 try { 202 return DelegatingResultSet.wrapResultSet(_conn, 203 _meta.getColumns(catalog, schemaPattern, tableNamePattern, 204 columnNamePattern)); 205 } 206 catch (SQLException e) { 207 handleException(e); 208 throw new AssertionError(); 209 } 210 } 211 212 @Override 213 public Connection getConnection() throws SQLException { 214 return _conn; 215 } 216 217 @Override 218 public ResultSet getCrossReference(String parentCatalog, 219 String parentSchema, String parentTable, String foreignCatalog, 220 String foreignSchema, String foreignTable) throws SQLException { 221 _conn.checkOpen(); 222 try { 223 return DelegatingResultSet.wrapResultSet(_conn, 224 _meta.getCrossReference(parentCatalog, parentSchema, 225 parentTable, foreignCatalog, foreignSchema, 226 foreignTable)); 227 } 228 catch (SQLException e) { 229 handleException(e); 230 throw new AssertionError(); 231 } 232 } 233 234 @Override 235 public int getDatabaseMajorVersion() throws SQLException { 236 try { return _meta.getDatabaseMajorVersion(); } 237 catch (SQLException e) { handleException(e); return 0; } 238 } 239 240 @Override 241 public int getDatabaseMinorVersion() throws SQLException { 242 try { return _meta.getDatabaseMinorVersion(); } 243 catch (SQLException e) { handleException(e); return 0; } 244 } 245 246 @Override 247 public String getDatabaseProductName() throws SQLException { 248 try { return _meta.getDatabaseProductName(); } 249 catch (SQLException e) { handleException(e); throw new AssertionError(); } 250 } 251 252 @Override 253 public String getDatabaseProductVersion() throws SQLException { 254 try { return _meta.getDatabaseProductVersion(); } 255 catch (SQLException e) { handleException(e); throw new AssertionError(); } 256 } 257 258 @Override 259 public int getDefaultTransactionIsolation() throws SQLException { 260 try { return _meta.getDefaultTransactionIsolation(); } 261 catch (SQLException e) { handleException(e); return 0; } 262 } 263 264 @Override 265 public int getDriverMajorVersion() {return _meta.getDriverMajorVersion();} 266 267 @Override 268 public int getDriverMinorVersion() {return _meta.getDriverMinorVersion();} 269 270 @Override 271 public String getDriverName() throws SQLException { 272 try { return _meta.getDriverName(); } 273 catch (SQLException e) { handleException(e); throw new AssertionError(); } 274 } 275 276 @Override 277 public String getDriverVersion() throws SQLException { 278 try { return _meta.getDriverVersion(); } 279 catch (SQLException e) { handleException(e); throw new AssertionError(); } 280 } 281 282 @Override 283 public ResultSet getExportedKeys(String catalog, String schema, String table) 284 throws SQLException { 285 _conn.checkOpen(); 286 try { 287 return DelegatingResultSet.wrapResultSet(_conn, 288 _meta.getExportedKeys(catalog, schema, table)); 289 } 290 catch (SQLException e) { 291 handleException(e); 292 throw new AssertionError(); 293 } 294 } 295 296 @Override 297 public String getExtraNameCharacters() throws SQLException { 298 try { return _meta.getExtraNameCharacters(); } 299 catch (SQLException e) { handleException(e); throw new AssertionError(); } 300 } 301 302 @Override 303 public String getIdentifierQuoteString() throws SQLException { 304 try { return _meta.getIdentifierQuoteString(); } 305 catch (SQLException e) { handleException(e); throw new AssertionError(); } 306 } 307 308 @Override 309 public ResultSet getImportedKeys(String catalog, String schema, String table) 310 throws SQLException { 311 _conn.checkOpen(); 312 try { 313 return DelegatingResultSet.wrapResultSet(_conn, 314 _meta.getImportedKeys(catalog, schema, table)); 315 } 316 catch (SQLException e) { 317 handleException(e); 318 throw new AssertionError(); 319 } 320 } 321 322 @Override 323 public ResultSet getIndexInfo(String catalog, String schema, String table, 324 boolean unique, boolean approximate) throws SQLException { 325 _conn.checkOpen(); 326 try { 327 return DelegatingResultSet.wrapResultSet(_conn, 328 _meta.getIndexInfo(catalog, schema, table, unique, 329 approximate)); 330 } 331 catch (SQLException e) { 332 handleException(e); 333 throw new AssertionError(); 334 } 335 } 336 337 @Override 338 public int getJDBCMajorVersion() throws SQLException { 339 try { return _meta.getJDBCMajorVersion(); } 340 catch (SQLException e) { handleException(e); return 0; } 341 } 342 343 @Override 344 public int getJDBCMinorVersion() throws SQLException { 345 try { return _meta.getJDBCMinorVersion(); } 346 catch (SQLException e) { handleException(e); return 0; } 347 } 348 349 @Override 350 public int getMaxBinaryLiteralLength() throws SQLException { 351 try { return _meta.getMaxBinaryLiteralLength(); } 352 catch (SQLException e) { handleException(e); return 0; } 353 } 354 355 @Override 356 public int getMaxCatalogNameLength() throws SQLException { 357 try { return _meta.getMaxCatalogNameLength(); } 358 catch (SQLException e) { handleException(e); return 0; } 359 } 360 361 @Override 362 public int getMaxCharLiteralLength() throws SQLException { 363 try { return _meta.getMaxCharLiteralLength(); } 364 catch (SQLException e) { handleException(e); return 0; } 365 } 366 367 @Override 368 public int getMaxColumnNameLength() throws SQLException { 369 try { return _meta.getMaxColumnNameLength(); } 370 catch (SQLException e) { handleException(e); return 0; } 371 } 372 373 @Override 374 public int getMaxColumnsInGroupBy() throws SQLException { 375 try { return _meta.getMaxColumnsInGroupBy(); } 376 catch (SQLException e) { handleException(e); return 0; } 377 } 378 379 @Override 380 public int getMaxColumnsInIndex() throws SQLException { 381 try { return _meta.getMaxColumnsInIndex(); } 382 catch (SQLException e) { handleException(e); return 0; } 383 } 384 385 @Override 386 public int getMaxColumnsInOrderBy() throws SQLException { 387 try { return _meta.getMaxColumnsInOrderBy(); } 388 catch (SQLException e) { handleException(e); return 0; } 389 } 390 391 @Override 392 public int getMaxColumnsInSelect() throws SQLException { 393 try { return _meta.getMaxColumnsInSelect(); } 394 catch (SQLException e) { handleException(e); return 0; } 395 } 396 397 @Override 398 public int getMaxColumnsInTable() throws SQLException { 399 try { return _meta.getMaxColumnsInTable(); } 400 catch (SQLException e) { handleException(e); return 0; } 401 } 402 403 @Override 404 public int getMaxConnections() throws SQLException { 405 try { return _meta.getMaxConnections(); } 406 catch (SQLException e) { handleException(e); return 0; } 407 } 408 409 @Override 410 public int getMaxCursorNameLength() throws SQLException { 411 try { return _meta.getMaxCursorNameLength(); } 412 catch (SQLException e) { handleException(e); return 0; } 413 } 414 415 @Override 416 public int getMaxIndexLength() throws SQLException { 417 try { return _meta.getMaxIndexLength(); } 418 catch (SQLException e) { handleException(e); return 0; } 419 } 420 421 @Override 422 public int getMaxProcedureNameLength() throws SQLException { 423 try { return _meta.getMaxProcedureNameLength(); } 424 catch (SQLException e) { handleException(e); return 0; } 425 } 426 427 @Override 428 public int getMaxRowSize() throws SQLException { 429 try { return _meta.getMaxRowSize(); } 430 catch (SQLException e) { handleException(e); return 0; } 431 } 432 433 @Override 434 public int getMaxSchemaNameLength() throws SQLException { 435 try { return _meta.getMaxSchemaNameLength(); } 436 catch (SQLException e) { handleException(e); return 0; } 437 } 438 439 @Override 440 public int getMaxStatementLength() throws SQLException { 441 try { return _meta.getMaxStatementLength(); } 442 catch (SQLException e) { handleException(e); return 0; } 443 } 444 445 @Override 446 public int getMaxStatements() throws SQLException { 447 try { return _meta.getMaxStatements(); } 448 catch (SQLException e) { handleException(e); return 0; } 449 } 450 451 @Override 452 public int getMaxTableNameLength() throws SQLException { 453 try { return _meta.getMaxTableNameLength(); } 454 catch (SQLException e) { handleException(e); return 0; } 455 } 456 457 @Override 458 public int getMaxTablesInSelect() throws SQLException { 459 try { return _meta.getMaxTablesInSelect(); } 460 catch (SQLException e) { handleException(e); return 0; } 461 } 462 463 @Override 464 public int getMaxUserNameLength() throws SQLException { 465 try { return _meta.getMaxUserNameLength(); } 466 catch (SQLException e) { handleException(e); return 0; } 467 } 468 469 @Override 470 public String getNumericFunctions() throws SQLException { 471 try { return _meta.getNumericFunctions(); } 472 catch (SQLException e) { handleException(e); throw new AssertionError(); } 473 } 474 475 @Override 476 public ResultSet getPrimaryKeys(String catalog, String schema, String table) 477 throws SQLException { 478 _conn.checkOpen(); 479 try { 480 return DelegatingResultSet.wrapResultSet(_conn, 481 _meta.getPrimaryKeys(catalog, schema, table)); 482 } 483 catch (SQLException e) { 484 handleException(e); 485 throw new AssertionError(); 486 } 487 } 488 489 @Override 490 public ResultSet getProcedureColumns(String catalog, String schemaPattern, 491 String procedureNamePattern, String columnNamePattern) 492 throws SQLException { 493 _conn.checkOpen(); 494 try { 495 return DelegatingResultSet.wrapResultSet(_conn, 496 _meta.getProcedureColumns(catalog, schemaPattern, 497 procedureNamePattern, columnNamePattern)); 498 } 499 catch (SQLException e) { 500 handleException(e); 501 throw new AssertionError(); 502 } 503 } 504 505 @Override 506 public String getProcedureTerm() throws SQLException { 507 try { return _meta.getProcedureTerm(); } 508 catch (SQLException e) { handleException(e); throw new AssertionError(); } 509 } 510 511 @Override 512 public ResultSet getProcedures(String catalog, String schemaPattern, 513 String procedureNamePattern) throws SQLException { 514 _conn.checkOpen(); 515 try { 516 return DelegatingResultSet.wrapResultSet(_conn, 517 _meta.getProcedures(catalog, schemaPattern, 518 procedureNamePattern)); 519 } 520 catch (SQLException e) { 521 handleException(e); 522 throw new AssertionError(); 523 } 524 } 525 526 @Override 527 public int getResultSetHoldability() throws SQLException { 528 try { return _meta.getResultSetHoldability(); } 529 catch (SQLException e) { handleException(e); return 0; } 530 } 531 532 @Override 533 public String getSQLKeywords() throws SQLException { 534 try { return _meta.getSQLKeywords(); } 535 catch (SQLException e) { handleException(e); throw new AssertionError(); } 536 } 537 538 @Override 539 public int getSQLStateType() throws SQLException { 540 try { return _meta.getSQLStateType(); } 541 catch (SQLException e) { handleException(e); return 0; } 542 } 543 544 @Override 545 public String getSchemaTerm() throws SQLException { 546 try { return _meta.getSchemaTerm(); } 547 catch (SQLException e) { handleException(e); throw new AssertionError(); } 548 } 549 550 @Override 551 public ResultSet getSchemas() throws SQLException { 552 _conn.checkOpen(); 553 try { 554 return DelegatingResultSet.wrapResultSet(_conn, 555 _meta.getSchemas()); 556 } 557 catch (SQLException e) { 558 handleException(e); 559 throw new AssertionError(); 560 } 561 } 562 563 @Override 564 public String getSearchStringEscape() throws SQLException { 565 try { return _meta.getSearchStringEscape(); } 566 catch (SQLException e) { handleException(e); throw new AssertionError(); } 567 } 568 569 @Override 570 public String getStringFunctions() throws SQLException { 571 try { return _meta.getStringFunctions(); } 572 catch (SQLException e) { handleException(e); throw new AssertionError(); } 573 } 574 575 @Override 576 public ResultSet getSuperTables(String catalog, String schemaPattern, 577 String tableNamePattern) throws SQLException { 578 _conn.checkOpen(); 579 try { 580 return DelegatingResultSet.wrapResultSet(_conn, 581 _meta.getSuperTables(catalog, schemaPattern, 582 tableNamePattern)); 583 } 584 catch (SQLException e) { 585 handleException(e); 586 throw new AssertionError(); 587 } 588 } 589 590 @Override 591 public ResultSet getSuperTypes(String catalog, String schemaPattern, 592 String typeNamePattern) throws SQLException { 593 _conn.checkOpen(); 594 try { 595 return DelegatingResultSet.wrapResultSet(_conn, 596 _meta.getSuperTypes(catalog, schemaPattern, 597 typeNamePattern)); 598 } 599 catch (SQLException e) { 600 handleException(e); 601 throw new AssertionError(); 602 } 603 } 604 605 @Override 606 public String getSystemFunctions() throws SQLException { 607 try { return _meta.getSystemFunctions(); } 608 catch (SQLException e) { handleException(e); throw new AssertionError(); } 609 } 610 611 @Override 612 public ResultSet getTablePrivileges(String catalog, String schemaPattern, 613 String tableNamePattern) throws SQLException { 614 _conn.checkOpen(); 615 try { 616 return DelegatingResultSet.wrapResultSet(_conn, 617 _meta.getTablePrivileges(catalog, schemaPattern, 618 tableNamePattern)); 619 } 620 catch (SQLException e) { 621 handleException(e); 622 throw new AssertionError(); 623 } 624 } 625 626 @Override 627 public ResultSet getTableTypes() throws SQLException { 628 _conn.checkOpen(); 629 try { 630 return DelegatingResultSet.wrapResultSet(_conn, 631 _meta.getTableTypes()); 632 } 633 catch (SQLException e) { 634 handleException(e); 635 throw new AssertionError(); 636 } 637 } 638 639 @Override 640 public ResultSet getTables(String catalog, String schemaPattern, 641 String tableNamePattern, String[] types) throws SQLException { 642 _conn.checkOpen(); 643 try { 644 return DelegatingResultSet.wrapResultSet(_conn, 645 _meta.getTables(catalog, schemaPattern, tableNamePattern, 646 types)); 647 } 648 catch (SQLException e) { 649 handleException(e); 650 throw new AssertionError(); 651 } 652 } 653 654 @Override 655 public String getTimeDateFunctions() throws SQLException { 656 try { return _meta.getTimeDateFunctions(); } 657 catch (SQLException e) { handleException(e); throw new AssertionError(); } 658 } 659 660 @Override 661 public ResultSet getTypeInfo() throws SQLException { 662 _conn.checkOpen(); 663 try { 664 return DelegatingResultSet.wrapResultSet(_conn, 665 _meta.getTypeInfo()); 666 } 667 catch (SQLException e) { 668 handleException(e); 669 throw new AssertionError(); 670 } 671 } 672 673 @Override 674 public ResultSet getUDTs(String catalog, String schemaPattern, 675 String typeNamePattern, int[] types) throws SQLException { 676 _conn.checkOpen(); 677 try { 678 return DelegatingResultSet.wrapResultSet(_conn, 679 _meta.getUDTs(catalog, schemaPattern, typeNamePattern, 680 types)); 681 } 682 catch (SQLException e) { 683 handleException(e); 684 throw new AssertionError(); 685 } 686 } 687 688 @Override 689 public String getURL() throws SQLException { 690 try { return _meta.getURL(); } 691 catch (SQLException e) { handleException(e); throw new AssertionError(); } 692 } 693 694 @Override 695 public String getUserName() throws SQLException { 696 try { return _meta.getUserName(); } 697 catch (SQLException e) { handleException(e); throw new AssertionError(); } 698 } 699 700 @Override 701 public ResultSet getVersionColumns(String catalog, String schema, 702 String table) throws SQLException { 703 _conn.checkOpen(); 704 try { 705 return DelegatingResultSet.wrapResultSet(_conn, 706 _meta.getVersionColumns(catalog, schema, table)); 707 } 708 catch (SQLException e) { 709 handleException(e); 710 throw new AssertionError(); 711 } 712 } 713 714 @Override 715 public boolean insertsAreDetected(int type) throws SQLException { 716 try { return _meta.insertsAreDetected(type); } 717 catch (SQLException e) { handleException(e); return false; } 718 } 719 720 @Override 721 public boolean isCatalogAtStart() throws SQLException { 722 try { return _meta.isCatalogAtStart(); } 723 catch (SQLException e) { handleException(e); return false; } 724 } 725 726 @Override 727 public boolean isReadOnly() throws SQLException { 728 try { return _meta.isReadOnly(); } 729 catch (SQLException e) { handleException(e); return false; } 730 } 731 732 @Override 733 public boolean locatorsUpdateCopy() throws SQLException { 734 try { return _meta.locatorsUpdateCopy(); } 735 catch (SQLException e) { handleException(e); return false; } 736 } 737 738 @Override 739 public boolean nullPlusNonNullIsNull() throws SQLException { 740 try { return _meta.nullPlusNonNullIsNull(); } 741 catch (SQLException e) { handleException(e); return false; } 742 } 743 744 @Override 745 public boolean nullsAreSortedAtEnd() throws SQLException { 746 try { return _meta.nullsAreSortedAtEnd(); } 747 catch (SQLException e) { handleException(e); return false; } 748 } 749 750 @Override 751 public boolean nullsAreSortedAtStart() throws SQLException { 752 try { return _meta.nullsAreSortedAtStart(); } 753 catch (SQLException e) { handleException(e); return false; } 754 } 755 756 @Override 757 public boolean nullsAreSortedHigh() throws SQLException { 758 try { return _meta.nullsAreSortedHigh(); } 759 catch (SQLException e) { handleException(e); return false; } 760 } 761 762 @Override 763 public boolean nullsAreSortedLow() throws SQLException { 764 try { return _meta.nullsAreSortedLow(); } 765 catch (SQLException e) { handleException(e); return false; } 766 } 767 768 @Override 769 public boolean othersDeletesAreVisible(int type) throws SQLException { 770 try { return _meta.othersDeletesAreVisible(type); } 771 catch (SQLException e) { handleException(e); return false; } 772 } 773 774 @Override 775 public boolean othersInsertsAreVisible(int type) throws SQLException { 776 try { return _meta.othersInsertsAreVisible(type); } 777 catch (SQLException e) { handleException(e); return false; } 778 } 779 780 @Override 781 public boolean othersUpdatesAreVisible(int type) throws SQLException { 782 try { return _meta.othersUpdatesAreVisible(type); } 783 catch (SQLException e) { handleException(e); return false; } 784 } 785 786 @Override 787 public boolean ownDeletesAreVisible(int type) throws SQLException { 788 try { return _meta.ownDeletesAreVisible(type); } 789 catch (SQLException e) { handleException(e); return false; } 790 } 791 792 @Override 793 public boolean ownInsertsAreVisible(int type) throws SQLException { 794 try { return _meta.ownInsertsAreVisible(type); } 795 catch (SQLException e) { handleException(e); return false; } 796 } 797 798 @Override 799 public boolean ownUpdatesAreVisible(int type) throws SQLException { 800 try { return _meta.ownUpdatesAreVisible(type); } 801 catch (SQLException e) { handleException(e); return false; } 802 } 803 804 @Override 805 public boolean storesLowerCaseIdentifiers() throws SQLException { 806 try { return _meta.storesLowerCaseIdentifiers(); } 807 catch (SQLException e) { handleException(e); return false; } 808 } 809 810 @Override 811 public boolean storesLowerCaseQuotedIdentifiers() throws SQLException { 812 try { return _meta.storesLowerCaseQuotedIdentifiers(); } 813 catch (SQLException e) { handleException(e); return false; } 814 } 815 816 @Override 817 public boolean storesMixedCaseIdentifiers() throws SQLException { 818 try { return _meta.storesMixedCaseIdentifiers(); } 819 catch (SQLException e) { handleException(e); return false; } 820 } 821 822 @Override 823 public boolean storesMixedCaseQuotedIdentifiers() throws SQLException { 824 try { return _meta.storesMixedCaseQuotedIdentifiers(); } 825 catch (SQLException e) { handleException(e); return false; } 826 } 827 828 @Override 829 public boolean storesUpperCaseIdentifiers() throws SQLException { 830 try { return _meta.storesUpperCaseIdentifiers(); } 831 catch (SQLException e) { handleException(e); return false; } 832 } 833 834 @Override 835 public boolean storesUpperCaseQuotedIdentifiers() throws SQLException { 836 try { return _meta.storesUpperCaseQuotedIdentifiers(); } 837 catch (SQLException e) { handleException(e); return false; } 838 } 839 840 @Override 841 public boolean supportsANSI92EntryLevelSQL() throws SQLException { 842 try { return _meta.supportsANSI92EntryLevelSQL(); } 843 catch (SQLException e) { handleException(e); return false; } 844 } 845 846 @Override 847 public boolean supportsANSI92FullSQL() throws SQLException { 848 try { return _meta.supportsANSI92FullSQL(); } 849 catch (SQLException e) { handleException(e); return false; } 850 } 851 852 @Override 853 public boolean supportsANSI92IntermediateSQL() throws SQLException { 854 try { return _meta.supportsANSI92IntermediateSQL(); } 855 catch (SQLException e) { handleException(e); return false; } 856 } 857 858 @Override 859 public boolean supportsAlterTableWithAddColumn() throws SQLException { 860 try { return _meta.supportsAlterTableWithAddColumn(); } 861 catch (SQLException e) { handleException(e); return false; } 862 } 863 864 @Override 865 public boolean supportsAlterTableWithDropColumn() throws SQLException { 866 try { return _meta.supportsAlterTableWithDropColumn(); } 867 catch (SQLException e) { handleException(e); return false; } 868 } 869 870 @Override 871 public boolean supportsBatchUpdates() throws SQLException { 872 try { return _meta.supportsBatchUpdates(); } 873 catch (SQLException e) { handleException(e); return false; } 874 } 875 876 @Override 877 public boolean supportsCatalogsInDataManipulation() throws SQLException { 878 try { return _meta.supportsCatalogsInDataManipulation(); } 879 catch (SQLException e) { handleException(e); return false; } 880 } 881 882 @Override 883 public boolean supportsCatalogsInIndexDefinitions() throws SQLException { 884 try { return _meta.supportsCatalogsInIndexDefinitions(); } 885 catch (SQLException e) { handleException(e); return false; } 886 } 887 888 @Override 889 public boolean supportsCatalogsInPrivilegeDefinitions() throws SQLException { 890 try { return _meta.supportsCatalogsInPrivilegeDefinitions(); } 891 catch (SQLException e) { handleException(e); return false; } 892 } 893 894 @Override 895 public boolean supportsCatalogsInProcedureCalls() throws SQLException { 896 try { return _meta.supportsCatalogsInProcedureCalls(); } 897 catch (SQLException e) { handleException(e); return false; } 898 } 899 900 @Override 901 public boolean supportsCatalogsInTableDefinitions() throws SQLException { 902 try { return _meta.supportsCatalogsInTableDefinitions(); } 903 catch (SQLException e) { handleException(e); return false; } 904 } 905 906 @Override 907 public boolean supportsColumnAliasing() throws SQLException { 908 try { return _meta.supportsColumnAliasing(); } 909 catch (SQLException e) { handleException(e); return false; } 910 } 911 912 @Override 913 public boolean supportsConvert() throws SQLException { 914 try { return _meta.supportsConvert(); } 915 catch (SQLException e) { handleException(e); return false; } 916 } 917 918 @Override 919 public boolean supportsConvert(int fromType, int toType) 920 throws SQLException { 921 try { return _meta.supportsConvert(fromType, toType); } 922 catch (SQLException e) { handleException(e); return false; } 923 } 924 925 @Override 926 public boolean supportsCoreSQLGrammar() throws SQLException { 927 try { return _meta.supportsCoreSQLGrammar(); } 928 catch (SQLException e) { handleException(e); return false; } 929 } 930 931 @Override 932 public boolean supportsCorrelatedSubqueries() throws SQLException { 933 try { return _meta.supportsCorrelatedSubqueries(); } 934 catch (SQLException e) { handleException(e); return false; } 935 } 936 937 @Override 938 public boolean supportsDataDefinitionAndDataManipulationTransactions() 939 throws SQLException { 940 try { return _meta.supportsDataDefinitionAndDataManipulationTransactions(); } 941 catch (SQLException e) { handleException(e); return false; } 942 } 943 944 @Override 945 public boolean supportsDataManipulationTransactionsOnly() 946 throws SQLException { 947 try { return _meta.supportsDataManipulationTransactionsOnly(); } 948 catch (SQLException e) { handleException(e); return false; } 949 } 950 951 @Override 952 public boolean supportsDifferentTableCorrelationNames() throws SQLException { 953 try { return _meta.supportsDifferentTableCorrelationNames(); } 954 catch (SQLException e) { handleException(e); return false; } 955 } 956 957 @Override 958 public boolean supportsExpressionsInOrderBy() throws SQLException { 959 try { return _meta.supportsExpressionsInOrderBy(); } 960 catch (SQLException e) { handleException(e); return false; } 961 } 962 963 @Override 964 public boolean supportsExtendedSQLGrammar() throws SQLException { 965 try { return _meta.supportsExtendedSQLGrammar(); } 966 catch (SQLException e) { handleException(e); return false; } 967 } 968 969 @Override 970 public boolean supportsFullOuterJoins() throws SQLException { 971 try { return _meta.supportsFullOuterJoins(); } 972 catch (SQLException e) { handleException(e); return false; } 973 } 974 975 @Override 976 public boolean supportsGetGeneratedKeys() throws SQLException { 977 try { return _meta.supportsGetGeneratedKeys(); } 978 catch (SQLException e) { handleException(e); return false; } 979 } 980 981 @Override 982 public boolean supportsGroupBy() throws SQLException { 983 try { return _meta.supportsGroupBy(); } 984 catch (SQLException e) { handleException(e); return false; } 985 } 986 987 @Override 988 public boolean supportsGroupByBeyondSelect() throws SQLException { 989 try { return _meta.supportsGroupByBeyondSelect(); } 990 catch (SQLException e) { handleException(e); return false; } 991 } 992 993 @Override 994 public boolean supportsGroupByUnrelated() throws SQLException { 995 try { return _meta.supportsGroupByUnrelated(); } 996 catch (SQLException e) { handleException(e); return false; } 997 } 998 999 @Override 1000 public boolean supportsIntegrityEnhancementFacility() throws SQLException { 1001 try { return _meta.supportsIntegrityEnhancementFacility(); } 1002 catch (SQLException e) { handleException(e); return false; } 1003 } 1004 1005 @Override 1006 public boolean supportsLikeEscapeClause() throws SQLException { 1007 try { return _meta.supportsLikeEscapeClause(); } 1008 catch (SQLException e) { handleException(e); return false; } 1009 } 1010 1011 @Override 1012 public boolean supportsLimitedOuterJoins() throws SQLException { 1013 try { return _meta.supportsLimitedOuterJoins(); } 1014 catch (SQLException e) { handleException(e); return false; } 1015 } 1016 1017 @Override 1018 public boolean supportsMinimumSQLGrammar() throws SQLException { 1019 try { return _meta.supportsMinimumSQLGrammar(); } 1020 catch (SQLException e) { handleException(e); return false; } 1021 } 1022 1023 @Override 1024 public boolean supportsMixedCaseIdentifiers() throws SQLException { 1025 try { return _meta.supportsMixedCaseIdentifiers(); } 1026 catch (SQLException e) { handleException(e); return false; } 1027 } 1028 1029 @Override 1030 public boolean supportsMixedCaseQuotedIdentifiers() throws SQLException { 1031 try { return _meta.supportsMixedCaseQuotedIdentifiers(); } 1032 catch (SQLException e) { handleException(e); return false; } 1033 } 1034 1035 @Override 1036 public boolean supportsMultipleOpenResults() throws SQLException { 1037 try { return _meta.supportsMultipleOpenResults(); } 1038 catch (SQLException e) { handleException(e); return false; } 1039 } 1040 1041 @Override 1042 public boolean supportsMultipleResultSets() throws SQLException { 1043 try { return _meta.supportsMultipleResultSets(); } 1044 catch (SQLException e) { handleException(e); return false; } 1045 } 1046 1047 @Override 1048 public boolean supportsMultipleTransactions() throws SQLException { 1049 try { return _meta.supportsMultipleTransactions(); } 1050 catch (SQLException e) { handleException(e); return false; } 1051 } 1052 1053 @Override 1054 public boolean supportsNamedParameters() throws SQLException { 1055 try { return _meta.supportsNamedParameters(); } 1056 catch (SQLException e) { handleException(e); return false; } 1057 } 1058 1059 @Override 1060 public boolean supportsNonNullableColumns() throws SQLException { 1061 try { return _meta.supportsNonNullableColumns(); } 1062 catch (SQLException e) { handleException(e); return false; } 1063 } 1064 1065 @Override 1066 public boolean supportsOpenCursorsAcrossCommit() throws SQLException { 1067 try { return _meta.supportsOpenCursorsAcrossCommit(); } 1068 catch (SQLException e) { handleException(e); return false; } 1069 } 1070 1071 @Override 1072 public boolean supportsOpenCursorsAcrossRollback() throws SQLException { 1073 try { return _meta.supportsOpenCursorsAcrossRollback(); } 1074 catch (SQLException e) { handleException(e); return false; } 1075 } 1076 1077 @Override 1078 public boolean supportsOpenStatementsAcrossCommit() throws SQLException { 1079 try { return _meta.supportsOpenStatementsAcrossCommit(); } 1080 catch (SQLException e) { handleException(e); return false; } 1081 } 1082 1083 @Override 1084 public boolean supportsOpenStatementsAcrossRollback() throws SQLException { 1085 try { return _meta.supportsOpenStatementsAcrossRollback(); } 1086 catch (SQLException e) { handleException(e); return false; } 1087 } 1088 1089 @Override 1090 public boolean supportsOrderByUnrelated() throws SQLException { 1091 try { return _meta.supportsOrderByUnrelated(); } 1092 catch (SQLException e) { handleException(e); return false; } 1093 } 1094 1095 @Override 1096 public boolean supportsOuterJoins() throws SQLException { 1097 try { return _meta.supportsOuterJoins(); } 1098 catch (SQLException e) { handleException(e); return false; } 1099 } 1100 1101 @Override 1102 public boolean supportsPositionedDelete() throws SQLException { 1103 try { return _meta.supportsPositionedDelete(); } 1104 catch (SQLException e) { handleException(e); return false; } 1105 } 1106 1107 @Override 1108 public boolean supportsPositionedUpdate() throws SQLException { 1109 try { return _meta.supportsPositionedUpdate(); } 1110 catch (SQLException e) { handleException(e); return false; } 1111 } 1112 1113 @Override 1114 public boolean supportsResultSetConcurrency(int type, int concurrency) 1115 throws SQLException { 1116 try { return _meta.supportsResultSetConcurrency(type, concurrency); } 1117 catch (SQLException e) { handleException(e); return false; } 1118 } 1119 1120 @Override 1121 public boolean supportsResultSetHoldability(int holdability) 1122 throws SQLException { 1123 try { return _meta.supportsResultSetHoldability(holdability); } 1124 catch (SQLException e) { handleException(e); return false; } 1125 } 1126 1127 @Override 1128 public boolean supportsResultSetType(int type) throws SQLException { 1129 try { return _meta.supportsResultSetType(type); } 1130 catch (SQLException e) { handleException(e); return false; } 1131 } 1132 1133 @Override 1134 public boolean supportsSavepoints() throws SQLException { 1135 try { return _meta.supportsSavepoints(); } 1136 catch (SQLException e) { handleException(e); return false; } 1137 } 1138 1139 @Override 1140 public boolean supportsSchemasInDataManipulation() throws SQLException { 1141 try { return _meta.supportsSchemasInDataManipulation(); } 1142 catch (SQLException e) { handleException(e); return false; } 1143 } 1144 1145 @Override 1146 public boolean supportsSchemasInIndexDefinitions() throws SQLException { 1147 try { return _meta.supportsSchemasInIndexDefinitions(); } 1148 catch (SQLException e) { handleException(e); return false; } 1149 } 1150 1151 @Override 1152 public boolean supportsSchemasInPrivilegeDefinitions() throws SQLException { 1153 try { return _meta.supportsSchemasInPrivilegeDefinitions(); } 1154 catch (SQLException e) { handleException(e); return false; } 1155 } 1156 1157 @Override 1158 public boolean supportsSchemasInProcedureCalls() throws SQLException { 1159 try { return _meta.supportsSchemasInProcedureCalls(); } 1160 catch (SQLException e) { handleException(e); return false; } 1161 } 1162 1163 @Override 1164 public boolean supportsSchemasInTableDefinitions() throws SQLException { 1165 try { return _meta.supportsSchemasInTableDefinitions(); } 1166 catch (SQLException e) { handleException(e); return false; } 1167 } 1168 1169 @Override 1170 public boolean supportsSelectForUpdate() throws SQLException { 1171 try { return _meta.supportsSelectForUpdate(); } 1172 catch (SQLException e) { handleException(e); return false; } 1173 } 1174 1175 @Override 1176 public boolean supportsStatementPooling() throws SQLException { 1177 try { return _meta.supportsStatementPooling(); } 1178 catch (SQLException e) { handleException(e); return false; } 1179 } 1180 1181 @Override 1182 public boolean supportsStoredProcedures() throws SQLException { 1183 try { return _meta.supportsStoredProcedures(); } 1184 catch (SQLException e) { handleException(e); return false; } 1185 } 1186 1187 @Override 1188 public boolean supportsSubqueriesInComparisons() throws SQLException { 1189 try { return _meta.supportsSubqueriesInComparisons(); } 1190 catch (SQLException e) { handleException(e); return false; } 1191 } 1192 1193 @Override 1194 public boolean supportsSubqueriesInExists() throws SQLException { 1195 try { return _meta.supportsSubqueriesInExists(); } 1196 catch (SQLException e) { handleException(e); return false; } 1197 } 1198 1199 @Override 1200 public boolean supportsSubqueriesInIns() throws SQLException { 1201 try { return _meta.supportsSubqueriesInIns(); } 1202 catch (SQLException e) { handleException(e); return false; } 1203 } 1204 1205 @Override 1206 public boolean supportsSubqueriesInQuantifieds() throws SQLException { 1207 try { return _meta.supportsSubqueriesInQuantifieds(); } 1208 catch (SQLException e) { handleException(e); return false; } 1209 } 1210 1211 @Override 1212 public boolean supportsTableCorrelationNames() throws SQLException { 1213 try { return _meta.supportsTableCorrelationNames(); } 1214 catch (SQLException e) { handleException(e); return false; } 1215 } 1216 1217 @Override 1218 public boolean supportsTransactionIsolationLevel(int level) 1219 throws SQLException { 1220 try { return _meta.supportsTransactionIsolationLevel(level); } 1221 catch (SQLException e) { handleException(e); return false; } 1222 } 1223 1224 @Override 1225 public boolean supportsTransactions() throws SQLException { 1226 try { return _meta.supportsTransactions(); } 1227 catch (SQLException e) { handleException(e); return false; } 1228 } 1229 1230 @Override 1231 public boolean supportsUnion() throws SQLException { 1232 try { return _meta.supportsUnion(); } 1233 catch (SQLException e) { handleException(e); return false; } 1234 } 1235 1236 @Override 1237 public boolean supportsUnionAll() throws SQLException { 1238 try { return _meta.supportsUnionAll(); } 1239 catch (SQLException e) { handleException(e); return false; } 1240 } 1241 1242 @Override 1243 public boolean updatesAreDetected(int type) throws SQLException { 1244 try { return _meta.updatesAreDetected(type); } 1245 catch (SQLException e) { handleException(e); return false; } 1246 } 1247 1248 @Override 1249 public boolean usesLocalFilePerTable() throws SQLException { 1250 try { return _meta.usesLocalFilePerTable(); } 1251 catch (SQLException e) { handleException(e); return false; } 1252 } 1253 1254 @Override 1255 public boolean usesLocalFiles() throws SQLException { 1256 try { return _meta.usesLocalFiles(); } 1257 catch (SQLException e) { handleException(e); return false; } 1258 } 1259 1260 /* JDBC_4_ANT_KEY_BEGIN */ 1261 1262 @Override 1263 public boolean isWrapperFor(Class<?> iface) throws SQLException { 1264 if (iface.isAssignableFrom(getClass())) { 1265 return true; 1266 } else if (iface.isAssignableFrom(_meta.getClass())) { 1267 return true; 1268 } else { 1269 return _meta.isWrapperFor(iface); 1270 } 1271 } 1272 1273 @Override 1274 public <T> T unwrap(Class<T> iface) throws SQLException { 1275 if (iface.isAssignableFrom(getClass())) { 1276 return iface.cast(this); 1277 } else if (iface.isAssignableFrom(_meta.getClass())) { 1278 return iface.cast(_meta); 1279 } else { 1280 return _meta.unwrap(iface); 1281 } 1282 } 1283 1284 @Override 1285 public RowIdLifetime getRowIdLifetime() throws SQLException { 1286 try { return _meta.getRowIdLifetime(); } 1287 catch (SQLException e) { handleException(e); throw new AssertionError(); } 1288 } 1289 1290 @Override 1291 public ResultSet getSchemas(String catalog, String schemaPattern) 1292 throws SQLException { 1293 _conn.checkOpen(); 1294 try { 1295 return DelegatingResultSet.wrapResultSet(_conn, 1296 _meta.getSchemas(catalog, schemaPattern)); 1297 } 1298 catch (SQLException e) { 1299 handleException(e); 1300 throw new AssertionError(); 1301 } 1302 } 1303 1304 @Override 1305 public boolean autoCommitFailureClosesAllResultSets() throws SQLException { 1306 try { return _meta.autoCommitFailureClosesAllResultSets(); } 1307 catch (SQLException e) { handleException(e); return false; } 1308 } 1309 1310 @Override 1311 public boolean supportsStoredFunctionsUsingCallSyntax() throws SQLException { 1312 try { return _meta.supportsStoredFunctionsUsingCallSyntax(); } 1313 catch (SQLException e) { handleException(e); return false; } 1314 } 1315 1316 @Override 1317 public ResultSet getClientInfoProperties() throws SQLException { 1318 _conn.checkOpen(); 1319 try { 1320 return DelegatingResultSet.wrapResultSet(_conn, 1321 _meta.getClientInfoProperties()); 1322 } 1323 catch (SQLException e) { 1324 handleException(e); 1325 throw new AssertionError(); 1326 } 1327 } 1328 1329 @Override 1330 public ResultSet getFunctions(String catalog, String schemaPattern, 1331 String functionNamePattern) throws SQLException { 1332 _conn.checkOpen(); 1333 try { 1334 return DelegatingResultSet.wrapResultSet(_conn, 1335 _meta.getFunctions(catalog, schemaPattern, 1336 functionNamePattern)); 1337 } 1338 catch (SQLException e) { 1339 handleException(e); 1340 throw new AssertionError(); 1341 } 1342 } 1343 1344 @Override 1345 public ResultSet getFunctionColumns(String catalog, String schemaPattern, 1346 String functionNamePattern, String columnNamePattern) 1347 throws SQLException { 1348 _conn.checkOpen(); 1349 try { 1350 return DelegatingResultSet.wrapResultSet(_conn, 1351 _meta.getFunctionColumns(catalog, schemaPattern, 1352 functionNamePattern, columnNamePattern)); 1353 } 1354 catch (SQLException e) { 1355 handleException(e); 1356 throw new AssertionError(); 1357 } 1358 } 1359 1360 /* JDBC_4_ANT_KEY_END */ 1361 1362 @Override 1363 public ResultSet getPseudoColumns(String catalog, String schemaPattern, 1364 String tableNamePattern, String columnNamePattern) 1365 throws SQLException { 1366 _conn.checkOpen(); 1367 try { 1368 return DelegatingResultSet.wrapResultSet(_conn, 1369 _meta.getPseudoColumns(catalog, schemaPattern, 1370 tableNamePattern, columnNamePattern)); 1371} 1372 catch (SQLException e) { 1373 handleException(e); 1374 throw new AssertionError(); 1375 } 1376 } 1377 1378 @Override 1379 public boolean generatedKeyAlwaysReturned() throws SQLException { 1380 _conn.checkOpen(); 1381 try { 1382 return _meta.generatedKeyAlwaysReturned(); 1383 } 1384 catch (SQLException e) { 1385 handleException(e); 1386 return false; 1387 } 1388 } 1389}