1 24 25 package org.objectweb.cjdbc.driver; 26 27 import java.sql.SQLException ; 28 import java.util.HashMap ; 29 30 import org.objectweb.cjdbc.common.sql.metadata.MetadataContainer; 31 import org.objectweb.cjdbc.common.sql.metadata.MetadataDescription; 32 import org.objectweb.cjdbc.common.util.Constants; 33 34 44 public class DatabaseMetaData implements java.sql.DatabaseMetaData 45 { 46 47 private Connection connection; 48 49 52 private HashMap metadataContainer; 53 54 59 public DatabaseMetaData(Connection conn) 60 { 61 this.connection = conn; 62 metadataContainer = new HashMap (); 63 } 64 65 78 private Object getMetadata(String methodName, Class [] parametersType, 79 Object [] arguments, boolean allowsNull) throws SQLException 80 { 81 String key = MetadataContainer.getContainerKey(methodName, parametersType, 82 arguments); 83 Object value = metadataContainer.get(key); 84 85 if (value == null) 86 { value = connection.getStaticMetadata(key); 88 if ((value == null) && !allowsNull) 89 throw new SQLException ("Unable to retrieve metadata for " + key); 90 metadataContainer.put(key, value); 91 } 92 return value; 93 } 94 95 98 public boolean allProceduresAreCallable() throws SQLException 99 { 100 return ((Boolean ) getMetadata( 101 MetadataDescription.ALL_PROCEDURES_ARE_CALLABLE, null, null, false)) 102 .booleanValue(); 103 } 104 105 108 public boolean allTablesAreSelectable() throws SQLException 109 { 110 return ((Boolean ) getMetadata( 111 MetadataDescription.ALL_TABLES_ARE_SELECTABLE, null, null, false)) 112 .booleanValue(); 113 } 114 115 118 public boolean dataDefinitionCausesTransactionCommit() throws SQLException 119 { 120 return ((Boolean ) getMetadata( 121 MetadataDescription.DATA_DEFINITION_CAUSES_TRANSACTION_COMMIT, null, 122 null, false)).booleanValue(); 123 } 124 125 128 public boolean dataDefinitionIgnoredInTransactions() throws SQLException 129 { 130 return ((Boolean ) getMetadata( 131 MetadataDescription.DATA_DEFINITION_IGNORED_IN_TRANSACTIONS, null, 132 null, false)).booleanValue(); 133 } 134 135 138 public boolean deletesAreDetected(int type) throws SQLException 139 { 140 return ((Boolean ) getMetadata(MetadataDescription.DELETES_ARE_DETECTED, 141 new Class []{Integer.TYPE}, new Object []{new Integer (type)}, false)) 142 .booleanValue(); 143 } 144 145 148 public boolean doesMaxRowSizeIncludeBlobs() throws SQLException 149 { 150 return ((Boolean ) getMetadata( 151 MetadataDescription.DOES_MAX_ROW_SIZE_INCLUDE_BLOBS, null, null, false)) 152 .booleanValue(); 153 } 154 155 159 public java.sql.ResultSet getBestRowIdentifier(String catalog, String schema, 160 String table, int scope, boolean nullable) throws SQLException 161 { 162 return connection.getBestRowIdentifier(catalog, schema, table, scope, 163 nullable); 164 } 165 166 169 public java.sql.ResultSet getCatalogs() throws SQLException 170 { 171 return connection.getCatalogs(); 172 } 173 174 177 public String getCatalogSeparator() throws SQLException 178 { 179 return ((String ) getMetadata(MetadataDescription.GET_CATALOG_SEPARATOR, 180 null, null, true)); 181 } 182 183 186 public String getCatalogTerm() throws SQLException 187 { 188 return ((String ) getMetadata(MetadataDescription.GET_CATALOG_TERM, null, 189 null, true)); 190 } 191 192 202 public java.sql.ResultSet getColumns(String catalog, String schemaPattern, 203 String tableNamePattern, String columnNamePattern) throws SQLException 204 { 205 return connection.getColumns(catalog, schemaPattern, tableNamePattern, 206 columnNamePattern); 207 } 208 209 213 public java.sql.ResultSet getColumnPrivileges(String catalog, 214 String schemaPattern, String tableNamePattern, String columnNamePattern) 215 throws SQLException 216 { 217 return connection.getColumnPrivileges(catalog, schemaPattern, 218 tableNamePattern, columnNamePattern); 219 } 220 221 228 public java.sql.Connection getConnection() throws SQLException 229 { 230 return connection; 231 } 232 233 238 public java.sql.ResultSet getCrossReference(String primaryCatalog, 239 String primarySchema, String primaryTable, String foreignCatalog, 240 String foreignSchema, String foreignTable) throws SQLException 241 { 242 return connection.getCrossReference(primaryCatalog, primarySchema, 243 primaryTable, foreignCatalog, foreignSchema, foreignTable); 244 } 245 246 255 public String getDatabaseProductName() throws SQLException 256 { 257 return connection.getDatabaseProductName(); 258 } 259 260 266 public String getDatabaseProductVersion() throws SQLException 267 { 268 return connection.getControllerVersionNumber(); 269 } 270 271 274 public int getDefaultTransactionIsolation() throws SQLException 275 { 276 return ((Integer ) getMetadata( 277 MetadataDescription.GET_DEFAULT_TRANSACTION_ISOLATION, null, null, 278 false)).intValue(); 279 } 280 281 286 public int getDriverMajorVersion() 287 { 288 return Driver.MAJOR_VERSION; 289 } 290 291 296 public int getDriverMinorVersion() 297 { 298 return Driver.MINOR_VERSION; 299 } 300 301 307 public String getDriverName() throws SQLException 308 { 309 return "C-JDBC Generic Driver"; 310 } 311 312 318 public String getDriverVersion() throws SQLException 319 { 320 return Constants.VERSION; 321 } 322 323 327 public java.sql.ResultSet getExportedKeys(String catalog, String schema, 328 String table) throws SQLException 329 { 330 return connection.getExportedKeys(catalog, schema, table); 331 } 332 333 336 public String getExtraNameCharacters() throws SQLException 337 { 338 return ((String ) getMetadata(MetadataDescription.GET_EXTRA_NAME_CHARACTERS, 339 null, null, true)); 340 } 341 342 345 public String getIdentifierQuoteString() throws SQLException 346 { 347 return ((String ) getMetadata( 348 MetadataDescription.GET_IDENTIFIER_QUOTE_STRING, null, null, true)); 349 } 350 351 355 public java.sql.ResultSet getImportedKeys(String catalog, String schema, 356 String table) throws SQLException 357 { 358 return connection.getImportedKeys(catalog, schema, table); 359 } 360 361 365 public java.sql.ResultSet getIndexInfo(String catalog, String schema, 366 String table, boolean unique, boolean approximate) throws SQLException 367 { 368 return connection.getIndexInfo(catalog, schema, table, unique, approximate); 369 } 370 371 374 public int getMaxBinaryLiteralLength() throws SQLException 375 { 376 return ((Integer ) getMetadata( 377 MetadataDescription.GET_MAX_BINARY_LITERAL_LENGTH, null, null, false)) 378 .intValue(); 379 380 } 381 382 385 public int getMaxCatalogNameLength() throws SQLException 386 { 387 return ((Integer ) getMetadata( 388 MetadataDescription.GET_MAX_CATALOG_NAME_LENGTH, null, null, false)) 389 .intValue(); 390 } 391 392 395 public int getMaxCharLiteralLength() throws SQLException 396 { 397 return ((Integer ) getMetadata( 398 MetadataDescription.GET_MAX_CHAR_LITERAL_LENGTH, null, null, false)) 399 .intValue(); 400 } 401 402 405 public int getMaxColumnNameLength() throws SQLException 406 { 407 return ((Integer ) getMetadata( 408 MetadataDescription.GET_MAX_COLUMN_NAME_LENGTH, null, null, false)) 409 .intValue(); 410 } 411 412 415 public int getMaxColumnsInGroupBy() throws SQLException 416 { 417 return ((Integer ) getMetadata( 418 MetadataDescription.GET_MAX_COLUMNS_IN_GROUP_BY, null, null, false)) 419 .intValue(); 420 } 421 422 425 public int getMaxColumnsInIndex() throws SQLException 426 { 427 return ((Integer ) getMetadata(MetadataDescription.GET_MAX_COLUMNS_IN_INDEX, 428 null, null, false)).intValue(); 429 } 430 431 434 public int getMaxColumnsInOrderBy() throws SQLException 435 { 436 return ((Integer ) getMetadata( 437 MetadataDescription.GET_MAX_COLUMNS_IN_ORDER_BY, null, null, false)) 438 .intValue(); 439 } 440 441 444 public int getMaxColumnsInSelect() throws SQLException 445 { 446 return ((Integer ) getMetadata( 447 MetadataDescription.GET_MAX_COLUMNS_IN_SELECT, null, null, false)) 448 .intValue(); 449 } 450 451 454 public int getMaxColumnsInTable() throws SQLException 455 { 456 return ((Integer ) getMetadata(MetadataDescription.GET_MAX_COLUMNS_IN_TABLE, 457 null, null, false)).intValue(); 458 } 459 460 468 public int getMaxConnections() throws SQLException 469 { 470 return ((Integer ) getMetadata(MetadataDescription.GET_MAX_CONNECTIONS, 473 null, null, false)).intValue(); 474 } 475 476 479 public int getMaxCursorNameLength() throws SQLException 480 { 481 return ((Integer ) getMetadata( 482 MetadataDescription.GET_MAX_CURSOR_NAME_LENGTH, null, null, false)) 483 .intValue(); 484 } 485 486 489 public int getMaxIndexLength() throws SQLException 490 { 491 return ((Integer ) getMetadata(MetadataDescription.GET_MAX_INDEX_LENGTH, 492 null, null, false)).intValue(); 493 } 494 495 498 public int getMaxProcedureNameLength() throws SQLException 499 { 500 return ((Integer ) getMetadata( 501 MetadataDescription.GET_MAX_PROCEDURE_NAME_LENGTH, null, null, false)) 502 .intValue(); 503 } 504 505 508 public int getMaxRowSize() throws SQLException 509 { 510 return ((Integer ) getMetadata(MetadataDescription.GET_MAX_ROW_SIZE, null, 511 null, false)).intValue(); 512 } 513 514 517 public int getMaxSchemaNameLength() throws SQLException 518 { 519 return ((Integer ) getMetadata( 520 MetadataDescription.GET_MAX_SCHEMA_NAME_LENGTH, null, null, false)) 521 .intValue(); 522 } 523 524 527 public int getMaxStatementLength() throws SQLException 528 { 529 return ((Integer ) getMetadata(MetadataDescription.GET_MAX_STATEMENT_LENGTH, 530 null, null, false)).intValue(); 531 } 532 533 536 public int getMaxStatements() throws SQLException 537 { 538 return ((Integer ) getMetadata(MetadataDescription.GET_MAX_STATEMENTS, null, 539 null, false)).intValue(); 540 } 541 542 545 public int getMaxTableNameLength() throws SQLException 546 { 547 return ((Integer ) getMetadata( 548 MetadataDescription.GET_MAX_TABLE_NAME_LENGTH, null, null, false)) 549 .intValue(); 550 } 551 552 555 public int getMaxTablesInSelect() throws SQLException 556 { 557 return ((Integer ) getMetadata(MetadataDescription.GET_MAX_TABLES_IN_SELECT, 558 null, null, false)).intValue(); 559 } 560 561 564 public int getMaxUserNameLength() throws SQLException 565 { 566 return ((Integer ) getMetadata(MetadataDescription.GET_MAX_USER_NAME_LENGTH, 567 null, null, false)).intValue(); 568 } 569 570 573 public String getNumericFunctions() throws SQLException 574 { 575 return ((String ) getMetadata(MetadataDescription.GET_NUMERIC_FUNCTIONS, 576 null, null, true)); 577 } 578 579 583 public java.sql.ResultSet getPrimaryKeys(String catalog, String schema, 584 String table) throws SQLException 585 { 586 return connection.getPrimaryKeys(catalog, schema, table); 587 } 588 589 593 public java.sql.ResultSet getProcedureColumns(String catalog, 594 String schemaPattern, String procedureNamePattern, 595 String columnNamePattern) throws SQLException 596 { 597 return connection.getProcedureColumns(catalog, schemaPattern, 598 procedureNamePattern, columnNamePattern); 599 } 600 601 605 public java.sql.ResultSet getProcedures(String catalog, String schemaPattern, 606 String procedureNamePattern) throws SQLException 607 { 608 return connection.getProcedures(catalog, schemaPattern, 609 procedureNamePattern); 610 } 611 612 615 public String getProcedureTerm() throws SQLException 616 { 617 return ((String ) getMetadata(MetadataDescription.GET_PROCEDURE_TERM, null, 618 null, true)); 619 } 620 621 624 public java.sql.ResultSet getSchemas() throws SQLException 625 { 626 return connection.getSchemas(); 627 } 628 629 632 public String getSchemaTerm() throws SQLException 633 { 634 return ((String ) getMetadata(MetadataDescription.GET_SCHEMA_TERM, null, 635 null, true)); 636 } 637 638 641 public String getSearchStringEscape() throws SQLException 642 { 643 return ((String ) getMetadata(MetadataDescription.GET_SEARCH_STRING_ESCAPE, 644 null, null, true)); 645 } 646 647 650 public String getSQLKeywords() throws SQLException 651 { 652 return ((String ) getMetadata(MetadataDescription.GET_SQL_KEYWORDS, null, 653 null, true)); 654 } 655 656 659 public String getStringFunctions() throws SQLException 660 { 661 return ((String ) getMetadata(MetadataDescription.GET_STRING_FUNCTIONS, 662 null, null, true)); 663 } 664 665 668 public String getSystemFunctions() throws SQLException 669 { 670 return ((String ) getMetadata(MetadataDescription.GET_SYSTEM_FUNCTIONS, 671 null, null, true)); 672 } 673 674 688 public java.sql.ResultSet getTables(String catalog, String schemaPattern, 689 String tableNamePattern, String [] types) throws SQLException 690 { 691 return connection 692 .getTables(catalog, schemaPattern, tableNamePattern, types); 693 } 694 695 711 public java.sql.ResultSet getTablePrivileges(String catalog, 712 String schemaPattern, String tableNamePattern) throws SQLException 713 { 714 return connection.getTablePrivileges(catalog, schemaPattern, 715 tableNamePattern); 716 } 717 718 726 public java.sql.ResultSet getTableTypes() throws SQLException 727 { 728 return connection.getTableTypes(); 729 } 730 731 734 public String getTimeDateFunctions() throws SQLException 735 { 736 return ((String ) getMetadata(MetadataDescription.GET_TIME_DATE_FUNCTIONS, 737 null, null, true)); 738 } 739 740 743 public java.sql.ResultSet getTypeInfo() throws SQLException 744 { 745 return connection.getTypeInfo(); 746 } 747 748 752 public java.sql.ResultSet getUDTs(String catalog, String schemaPattern, 753 String typeNamePattern, int[] types) throws SQLException 754 { 755 return connection.getUDTs(catalog, schemaPattern, typeNamePattern, types); 756 } 757 758 764 public String getURL() throws SQLException 765 { 766 return connection.getUrl(); 767 } 768 769 775 public String getUserName() throws SQLException 776 { 777 return connection.getUserName(); 778 } 779 780 784 public java.sql.ResultSet getVersionColumns(String catalog, String schema, 785 String table) throws SQLException 786 { 787 return connection.getVersionColumns(catalog, schema, table); 788 } 789 790 793 public boolean insertsAreDetected(int type) throws SQLException 794 { 795 return ((Boolean ) getMetadata(MetadataDescription.INSERTS_ARE_DETECTED, 796 new Class []{Integer.TYPE}, new Object []{new Integer (type)}, false)) 797 .booleanValue(); 798 } 799 800 803 public boolean isCatalogAtStart() throws SQLException 804 { 805 return ((Boolean ) getMetadata(MetadataDescription.IS_CATALOG_AT_START, 806 null, null, false)).booleanValue(); 807 } 808 809 815 public boolean isReadOnly() throws SQLException 816 { 817 return connection.isReadOnly(); 818 } 819 820 823 public boolean nullPlusNonNullIsNull() throws SQLException 824 { 825 return ((Boolean ) getMetadata( 826 MetadataDescription.NULL_PLUS_NON_NULL_IS_NULL, null, null, false)) 827 .booleanValue(); 828 } 829 830 833 public boolean nullsAreSortedAtEnd() throws SQLException 834 { 835 return ((Boolean ) getMetadata(MetadataDescription.NULLS_ARE_SORTED_AT_END, 836 null, null, false)).booleanValue(); 837 } 838 839 842 public boolean nullsAreSortedAtStart() throws SQLException 843 { 844 return ((Boolean ) getMetadata( 845 MetadataDescription.NULLS_ARE_SORTED_AT_START, null, null, false)) 846 .booleanValue(); 847 } 848 849 852 public boolean nullsAreSortedHigh() throws SQLException 853 { 854 return ((Boolean ) getMetadata(MetadataDescription.NULLS_ARE_SORTED_HIGH, 855 null, null, false)).booleanValue(); 856 } 857 858 861 public boolean nullsAreSortedLow() throws SQLException 862 { 863 return ((Boolean ) getMetadata(MetadataDescription.NULLS_ARE_SORTED_LOW, 864 null, null, false)).booleanValue(); 865 } 866 867 870 public boolean othersDeletesAreVisible(int type) throws SQLException 871 { 872 return ((Boolean ) getMetadata( 873 MetadataDescription.OTHERS_DELETES_ARE_VISIBLE, 874 new Class []{Integer.TYPE}, new Object []{new Integer (type)}, false)) 875 .booleanValue(); 876 } 877 878 881 public boolean othersInsertsAreVisible(int type) throws SQLException 882 { 883 return ((Boolean ) getMetadata( 884 MetadataDescription.OTHERS_INSERTS_ARE_VISIBLE, 885 new Class []{Integer.TYPE}, new Object []{new Integer (type)}, false)) 886 .booleanValue(); 887 } 888 889 892 public boolean othersUpdatesAreVisible(int type) throws SQLException 893 { 894 return ((Boolean ) getMetadata( 895 MetadataDescription.OTHERS_UPDATES_ARE_VISIBLE, 896 new Class []{Integer.TYPE}, new Object []{new Integer (type)}, false)) 897 .booleanValue(); 898 } 899 900 903 public boolean ownDeletesAreVisible(int type) throws SQLException 904 { 905 return ((Boolean ) getMetadata(MetadataDescription.OWN_DELETES_ARE_VISIBLE, 906 new Class []{Integer.TYPE}, new Object []{new Integer (type)}, false)) 907 .booleanValue(); 908 } 909 910 913 public boolean ownInsertsAreVisible(int type) throws SQLException 914 { 915 return ((Boolean ) getMetadata(MetadataDescription.OWN_INSERTS_ARE_VISIBLE, 916 new Class []{Integer.TYPE}, new Object []{new Integer (type)}, false)) 917 .booleanValue(); 918 919 } 920 921 924 public boolean ownUpdatesAreVisible(int type) throws SQLException 925 { 926 return ((Boolean ) getMetadata(MetadataDescription.OWN_UPDATES_ARE_VISIBLE, 927 new Class []{Integer.TYPE}, new Object []{new Integer (type)}, false)) 928 .booleanValue(); 929 } 930 931 934 public boolean storesLowerCaseIdentifiers() throws SQLException 935 { 936 return ((Boolean ) getMetadata( 937 MetadataDescription.STORES_LOWER_CASE_IDENTIFIERS, null, null, false)) 938 .booleanValue(); 939 } 940 941 944 public boolean storesLowerCaseQuotedIdentifiers() throws SQLException 945 { 946 return ((Boolean ) getMetadata( 947 MetadataDescription.STORES_LOWER_CASE_QUOTED_IDENTIFIERS, null, null, 948 false)).booleanValue(); 949 } 950 951 954 public boolean storesMixedCaseIdentifiers() throws SQLException 955 { 956 return ((Boolean ) getMetadata( 957 MetadataDescription.STORES_MIXED_CASE_IDENTIFIERS, null, null, false)) 958 .booleanValue(); 959 } 960 961 964 public boolean storesMixedCaseQuotedIdentifiers() throws SQLException 965 { 966 return ((Boolean ) getMetadata( 967 MetadataDescription.STORES_MIXED_CASE_QUOTED_IDENTIFIERS, null, null, 968 false)).booleanValue(); 969 } 970 971 974 public boolean storesUpperCaseIdentifiers() throws SQLException 975 { 976 return ((Boolean ) getMetadata( 977 MetadataDescription.STORES_UPPER_CASE_IDENTIFIERS, null, null, false)) 978 .booleanValue(); 979 } 980 981 984 public boolean storesUpperCaseQuotedIdentifiers() throws SQLException 985 { 986 return ((Boolean ) getMetadata( 987 MetadataDescription.STORES_UPPER_CASE_QUOTED_IDENTIFIERS, null, null, 988 false)).booleanValue(); 989 } 990 991 994 public boolean supportsAlterTableWithAddColumn() throws SQLException 995 { 996 return ((Boolean ) getMetadata( 997 MetadataDescription.SUPPORTS_ALTER_TABLE_WITH_ADD_COLUMN, null, null, 998 false)).booleanValue(); 999 } 1000 1001 1004 public boolean supportsAlterTableWithDropColumn() throws SQLException 1005 { 1006 return ((Boolean ) getMetadata( 1007 MetadataDescription.SUPPORTS_ALTER_TABLE_WITH_DROP_COLUMN, null, null, 1008 false)).booleanValue(); 1009 } 1010 1011 1014 public boolean supportsANSI92EntryLevelSQL() throws SQLException 1015 { 1016 return ((Boolean ) getMetadata( 1017 MetadataDescription.SUPPORTS_ANSI92_ENTRY_LEVEL_SQL, null, null, false)) 1018 .booleanValue(); 1019 } 1020 1021 1024 public boolean supportsANSI92FullSQL() throws SQLException 1025 { 1026 return ((Boolean ) getMetadata(MetadataDescription.SUPPORTS_ANSI92_FULL_SQL, 1027 null, null, false)).booleanValue(); 1028 } 1029 1030 1033 public boolean supportsANSI92IntermediateSQL() throws SQLException 1034 { 1035 return ((Boolean ) getMetadata( 1036 MetadataDescription.SUPPORTS_ANSI92_INTERMEDIATE_SQL, null, null, false)) 1037 .booleanValue(); 1038 } 1039 1040 1043 public boolean supportsBatchUpdates() throws SQLException 1044 { 1045 return ((Boolean ) getMetadata(MetadataDescription.SUPPORTS_BATCH_UPDATES, 1046 null, null, false)).booleanValue(); 1047 } 1048 1049 1052 public boolean supportsCatalogsInDataManipulation() throws SQLException 1053 { 1054 return ((Boolean ) getMetadata( 1055 MetadataDescription.SUPPORTS_CATALOGS_IN_DATA_MANIPULATION, null, null, 1056 false)).booleanValue(); 1057 } 1058 1059 1062 public boolean supportsCatalogsInIndexDefinitions() throws SQLException 1063 { 1064 return ((Boolean ) getMetadata( 1065 MetadataDescription.SUPPORTS_CATALOGS_IN_INDEX_DEFINITIONS, null, null, 1066 false)).booleanValue(); 1067 } 1068 1069 1072 public boolean supportsCatalogsInPrivilegeDefinitions() throws SQLException 1073 { 1074 return ((Boolean ) getMetadata( 1075 MetadataDescription.SUPPORTS_CATALOGS_IN_PRIVILEGE_DEFINITIONS, null, 1076 null, false)).booleanValue(); 1077 } 1078 1079 1082 public boolean supportsCatalogsInProcedureCalls() throws SQLException 1083 { 1084 return ((Boolean ) getMetadata( 1085 MetadataDescription.SUPPORTS_CATALOGS_IN_PROCEDURE_CALLS, null, null, 1086 false)).booleanValue(); 1087 } 1088 1089 1092 public boolean supportsCatalogsInTableDefinitions() throws SQLException 1093 { 1094 return ((Boolean ) getMetadata( 1095 MetadataDescription.SUPPORTS_CATALOGS_IN_TABLE_DEFINITIONS, null, null, 1096 false)).booleanValue(); 1097 } 1098 1099 1102 public boolean supportsColumnAliasing() throws SQLException 1103 { 1104 return ((Boolean ) getMetadata(MetadataDescription.SUPPORTS_COLUMN_ALIASING, 1105 null, null, false)).booleanValue(); 1106 } 1107 1108 1111 public boolean supportsConvert() throws SQLException 1112 { 1113 return ((Boolean ) getMetadata(MetadataDescription.SUPPORTS_CONVERT, null, 1114 null, false)).booleanValue(); 1115 } 1116 1117 1126 public boolean supportsConvert(int fromType, int toType) throws SQLException 1127 { 1128 return false; 1129 } 1130 1131 1134 public boolean supportsCoreSQLGrammar() throws SQLException 1135 { 1136 return ((Boolean ) getMetadata( 1137 MetadataDescription.SUPPORTS_CORE_SQL_GRAMMAR, null, null, false)) 1138 .booleanValue(); 1139 } 1140 1141 1144 public boolean supportsCorrelatedSubqueries() throws SQLException 1145 { 1146 return ((Boolean ) getMetadata( 1147 MetadataDescription.SUPPORTS_CORRELATED_SUBQUERIES, null, null, false)) 1148 .booleanValue(); 1149 } 1150 1151 1154 public boolean supportsDataDefinitionAndDataManipulationTransactions() 1155 throws SQLException 1156 { 1157 return ((Boolean ) getMetadata( 1158 MetadataDescription.SUPPORTS_DATA_DEFINITION_AND_DATA_MANIPULATION_TRANSACTIONS, 1159 null, null, false)).booleanValue(); 1160 } 1161 1162 1165 public boolean supportsDataManipulationTransactionsOnly() throws SQLException 1166 { 1167 return ((Boolean ) getMetadata( 1168 MetadataDescription.SUPPORTS_DATA_MANIPULATION_TRANSACTIONS_ONLY, null, 1169 null, false)).booleanValue(); 1170 } 1171 1172 1175 public boolean supportsDifferentTableCorrelationNames() throws SQLException 1176 { 1177 return ((Boolean ) getMetadata( 1178 MetadataDescription.SUPPORTS_DIFFERENT_TABLE_CORRELATION_NAMES, null, 1179 null, false)).booleanValue(); 1180 } 1181 1182 1185 public boolean supportsExpressionsInOrderBy() throws SQLException 1186 { 1187 return ((Boolean ) getMetadata( 1188 MetadataDescription.SUPPORTS_EXPRESSIONS_IN_ORDER_BY, null, null, false)) 1189 .booleanValue(); 1190 } 1191 1192 1195 public boolean supportsExtendedSQLGrammar() throws SQLException 1196 { 1197 return ((Boolean ) getMetadata( 1198 MetadataDescription.SUPPORTS_EXTENDED_SQL_GRAMMAR, null, null, false)) 1199 .booleanValue(); 1200 } 1201 1202 1205 public boolean supportsFullOuterJoins() throws SQLException 1206 { 1207 return ((Boolean ) getMetadata( 1208 MetadataDescription.SUPPORTS_FULL_OUTER_JOINS, null, null, false)) 1209 .booleanValue(); 1210 } 1211 1212 1215 public boolean supportsGroupBy() throws SQLException 1216 { 1217 return ((Boolean ) getMetadata(MetadataDescription.SUPPORTS_GROUP_BY, null, 1218 null, false)).booleanValue(); 1219 } 1220 1221 1224 public boolean supportsGroupByBeyondSelect() throws SQLException 1225 { 1226 return ((Boolean ) getMetadata( 1227 MetadataDescription.SUPPORTS_GROUP_BY_BEYOND_SELECT, null, null, false)) 1228 .booleanValue(); 1229 } 1230 1231 1234 public boolean supportsGroupByUnrelated() throws SQLException 1235 { 1236 return ((Boolean ) getMetadata( 1237 MetadataDescription.SUPPORTS_GROUP_BY_UNRELATED, null, null, false)) 1238 .booleanValue(); 1239 } 1240 1241 1244 public boolean supportsIntegrityEnhancementFacility() throws SQLException 1245 { 1246 return ((Boolean ) getMetadata( 1247 MetadataDescription.SUPPORTS_INTEGRITY_ENHANCEMENT_FACILITY, null, 1248 null, false)).booleanValue(); 1249 } 1250 1251 1254 public boolean supportsLikeEscapeClause() throws SQLException 1255 { 1256 return ((Boolean ) getMetadata( 1257 MetadataDescription.SUPPORTS_LIKE_ESCAPE_CLAUSE, null, null, false)) 1258 .booleanValue(); 1259 } 1260 1261 1264 public boolean supportsLimitedOuterJoins() throws SQLException 1265 { 1266 return ((Boolean ) getMetadata( 1267 MetadataDescription.SUPPORTS_LIMITED_OUTER_JOINS, null, null, false)) 1268 .booleanValue(); 1269 } 1270 1271 1274 public boolean supportsMinimumSQLGrammar() throws SQLException 1275 { 1276 return ((Boolean ) getMetadata( 1277 MetadataDescription.SUPPORTS_MINIMUM_SQL_GRAMMAR, null, null, false)) 1278 .booleanValue(); 1279 } 1280 1281 1284 public boolean supportsMixedCaseIdentifiers() throws SQLException 1285 { 1286 return ((Boolean ) getMetadata( 1287 MetadataDescription.SUPPORTS_MIXED_CASE_IDENTIFIERS, null, null, false)) 1288 .booleanValue(); 1289 } 1290 1291 1294 public boolean supportsMixedCaseQuotedIdentifiers() throws SQLException 1295 { 1296 return ((Boolean ) getMetadata( 1297 MetadataDescription.SUPPORTS_MIXED_CASE_QUOTED_IDENTIFIERS, null, null, 1298 false)).booleanValue(); 1299 } 1300 1301 1304 public boolean supportsMultipleResultSets() throws SQLException 1305 { 1306 return ((Boolean ) getMetadata( 1307 MetadataDescription.SUPPORTS_MULTIPLE_RESULTSETS, null, null, false)) 1308 .booleanValue(); 1309 } 1310 1311 1314 public boolean supportsMultipleTransactions() throws SQLException 1315 { 1316 return ((Boolean ) getMetadata( 1317 MetadataDescription.SUPPORTS_MULTIPLE_TRANSACTIONS, null, null, false)) 1318 .booleanValue(); 1319 } 1320 1321 1324 public boolean supportsNonNullableColumns() throws SQLException 1325 { 1326 return ((Boolean ) getMetadata( 1327 MetadataDescription.SUPPORTS_NON_NULLABLE_COLUMNS, null, null, false)) 1328 .booleanValue(); 1329 } 1330 1331 1334 public boolean supportsOpenCursorsAcrossCommit() throws SQLException 1335 { 1336 return ((Boolean ) getMetadata( 1337 MetadataDescription.SUPPORTS_OPEN_CURSORS_ACROSS_COMMIT, null, null, 1338 false)).booleanValue(); 1339 } 1340 1341 1344 public boolean supportsOpenCursorsAcrossRollback() throws SQLException 1345 { 1346 return ((Boolean ) getMetadata( 1347 MetadataDescription.SUPPORTS_OPEN_CURSORS_ACROSS_ROLLBACK, null, null, 1348 false)).booleanValue(); 1349 } 1350 1351 1354 public boolean supportsOpenStatementsAcrossCommit() throws SQLException 1355 { 1356 return ((Boolean ) getMetadata( 1357 MetadataDescription.SUPPORTS_OPEN_STATEMENTS_ACROSS_COMMIT, null, null, 1358 false)).booleanValue(); 1359 } 1360 1361 1364 public boolean supportsOpenStatementsAcrossRollback() throws SQLException 1365 { 1366 return ((Boolean ) getMetadata( 1367 MetadataDescription.SUPPORTS_OPEN_STATEMENTS_ACROSS_ROLLBACK, null, 1368 null, false)).booleanValue(); 1369 } 1370 1371 1374 public boolean supportsOrderByUnrelated() throws SQLException 1375 { 1376 return ((Boolean ) getMetadata( 1377 MetadataDescription.SUPPORTS_ORDER_BY_UNRELATED, null, null, false)) 1378 .booleanValue(); 1379 } 1380 1381 1384 public boolean supportsOuterJoins() throws SQLException 1385 { 1386 return ((Boolean ) getMetadata(MetadataDescription.SUPPORTS_OUTER_JOINS, 1387 null, null, false)).booleanValue(); 1388 } 1389 1390 1393 public boolean supportsPositionedDelete() throws SQLException 1394 { 1395 return ((Boolean ) getMetadata( 1396 MetadataDescription.SUPPORTS_POSITIONED_DELETE, null, null, false)) 1397 .booleanValue(); 1398 } 1399 1400 1403 public boolean supportsPositionedUpdate() throws SQLException 1404 { 1405 return ((Boolean ) getMetadata( 1406 MetadataDescription.SUPPORTS_POSITIONED_UPDATE, null, null, false)) 1407 .booleanValue(); 1408 } 1409 1410 1413 public boolean supportsResultSetConcurrency(int type, int concurrency) 1414 throws SQLException 1415 { 1416 return ((Boolean ) getMetadata( 1417 MetadataDescription.SUPPORTS_RESULT_SET_CONCURRENCY, new Class []{ 1418 Integer.TYPE, Integer.TYPE}, new Object []{new Integer (type), 1419 new Integer (concurrency)}, false)).booleanValue(); 1420 } 1421 1422 1425 public boolean supportsResultSetHoldability(int holdability) 1426 throws SQLException 1427 { 1428 return ((Boolean ) getMetadata( 1429 MetadataDescription.SUPPORTS_RESULT_SET_HOLDABILITY, 1430 new Class []{Integer.TYPE}, new Object []{new Integer (holdability)}, 1431 false)).booleanValue(); 1432 } 1433 1434 1437 public boolean supportsResultSetType(int type) throws SQLException 1438 { 1439 return ((Boolean ) getMetadata(MetadataDescription.SUPPORTS_RESULT_SET_TYPE, 1440 new Class []{Integer.TYPE}, new Object []{new Integer (type)}, false)) 1441 .booleanValue(); 1442 } 1443 1444 1447 public boolean supportsSchemasInDataManipulation() throws SQLException 1448 { 1449 return ((Boolean ) getMetadata( 1450 MetadataDescription.SUPPORTS_SCHEMAS_IN_DATA_MANIPULATION, null, null, 1451 false)).booleanValue(); 1452 } 1453 1454 1457 public boolean supportsSchemasInIndexDefinitions() throws SQLException 1458 { 1459 return ((Boolean ) getMetadata( 1460 MetadataDescription.SUPPORTS_SCHEMAS_IN_INDEX_DEFINITIONS, null, null, 1461 false)).booleanValue(); 1462 } 1463 1464 1467 public boolean supportsSchemasInPrivilegeDefinitions() throws SQLException 1468 { 1469 return ((Boolean ) getMetadata( 1470 MetadataDescription.SUPPORTS_SCHEMAS_IN_PRIVILEGE_DEFINITIONS, null, 1471 null, false)).booleanValue(); 1472 } 1473 1474 1477 public boolean supportsSchemasInProcedureCalls() throws SQLException 1478 { 1479 return ((Boolean ) getMetadata( 1480 MetadataDescription.SUPPORTS_SCHEMAS_IN_PROCEDURE_CALLS, null, null, 1481 false)).booleanValue(); 1482 } 1483 1484 1487 public boolean supportsSchemasInTableDefinitions() throws SQLException 1488 { 1489 return ((Boolean ) getMetadata( 1490 MetadataDescription.SUPPORTS_SCHEMAS_IN_TABLE_DEFINITIONS, null, null, 1491 false)).booleanValue(); 1492 } 1493 1494 1497 public boolean supportsSelectForUpdate() throws SQLException 1498 { 1499 return ((Boolean ) getMetadata( 1500 MetadataDescription.SUPPORTS_SELECT_FOR_UPDATE, null, null, false)) 1501 .booleanValue(); 1502 } 1503 1504 1507 public boolean supportsStoredProcedures() throws SQLException 1508 { 1509 return ((Boolean ) getMetadata( 1510 MetadataDescription.SUPPORTS_STORED_PROCEDURES, null, null, false)) 1511 .booleanValue(); 1512 } 1513 1514 1517 public boolean supportsSubqueriesInComparisons() throws SQLException 1518 { 1519 return ((Boolean ) getMetadata( 1520 MetadataDescription.SUPPORTS_SUB_QUERIES_IN_COMPARISONS, null, null, 1521 false)).booleanValue(); 1522 } 1523 1524 1527 public boolean supportsSubqueriesInExists() throws SQLException 1528 { 1529 return ((Boolean ) getMetadata( 1530 MetadataDescription.SUPPORTS_SUB_QUERIES_IN_EXISTS, null, null, false)) 1531 .booleanValue(); 1532 } 1533 1534 1537 public boolean supportsSubqueriesInIns() throws SQLException 1538 { 1539 return ((Boolean ) getMetadata( 1540 MetadataDescription.SUPPORTS_SUB_QUERIES_IN_INS, null, null, false)) 1541 .booleanValue(); 1542 } 1543 1544 1547 public boolean supportsSubqueriesInQuantifieds() throws SQLException 1548 { 1549 return ((Boolean ) getMetadata( 1550 MetadataDescription.SUPPORTS_SUB_QUERIES_IN_QUANTIFIEDS, null, null, 1551 false)).booleanValue(); 1552 } 1553 1554 1557 public boolean supportsTableCorrelationNames() throws SQLException 1558 { 1559 return ((Boolean ) getMetadata( 1560 MetadataDescription.SUPPORTS_TABLE_CORRELATION_NAMES, null, null, false)) 1561 .booleanValue(); 1562 } 1563 1564 1567 public boolean supportsTransactionIsolationLevel(int level) 1568 throws SQLException 1569 { 1570 return ((Boolean ) getMetadata( 1571 MetadataDescription.SUPPORTS_TRANSACTION_ISOLATION_LEVEL, 1572 new Class []{Integer.TYPE}, new Object []{new Integer (level)}, false)) 1573 .booleanValue(); 1574 } 1575 1576 1579 public boolean supportsTransactions() throws SQLException 1580 { 1581 return ((Boolean ) getMetadata(MetadataDescription.SUPPORTS_TRANSACTIONS, 1582 null, null, false)).booleanValue(); 1583 } 1584 1585 1588 public boolean supportsUnion() throws SQLException 1589 { 1590 return ((Boolean ) getMetadata(MetadataDescription.SUPPORTS_UNION, null, 1591 null, false)).booleanValue(); 1592 } 1593 1594 1597 public boolean supportsUnionAll() throws SQLException 1598 { 1599 return ((Boolean ) getMetadata(MetadataDescription.SUPPORTS_UNION_ALL, null, 1600 null, false)).booleanValue(); 1601 } 1602 1603 1606 public boolean updatesAreDetected(int type) throws SQLException 1607 { 1608 return ((Boolean ) getMetadata(MetadataDescription.UPDATES_ARE_DETECTED, 1609 new Class []{Integer.TYPE}, new Object []{new Integer (type)}, false)) 1610 .booleanValue(); 1611 } 1612 1613 1616 public boolean usesLocalFilePerTable() throws SQLException 1617 { 1618 return ((Boolean ) getMetadata( 1619 MetadataDescription.USES_LOCAL_FILE_PER_TABLE, null, null, false)) 1620 .booleanValue(); 1621 } 1622 1623 1626 public boolean usesLocalFiles() throws SQLException 1627 { 1628 return ((Boolean ) getMetadata(MetadataDescription.USES_LOCAL_FILES, null, 1629 null, false)).booleanValue(); 1630 } 1631 1632 1634 1637 public boolean supportsSavepoints() throws SQLException 1638 { 1639 return ((Boolean ) getMetadata(MetadataDescription.SUPPORTS_SAVEPOINTS, 1640 null, null, false)).booleanValue(); 1641 } 1642 1643 1646 public boolean supportsNamedParameters() throws SQLException 1647 { 1648 return ((Boolean ) getMetadata( 1649 MetadataDescription.SUPPORTS_NAMED_PARAMETERS, null, null, false)) 1650 .booleanValue(); 1651 } 1652 1653 1656 public boolean supportsMultipleOpenResults() throws SQLException 1657 { 1658 return ((Boolean ) getMetadata( 1659 MetadataDescription.SUPPORTS_MULTIPLE_OPEN_RESULTS, null, null, false)) 1660 .booleanValue(); 1661 } 1662 1663 1666 public boolean supportsGetGeneratedKeys() throws SQLException 1667 { 1668 return ((Boolean ) getMetadata( 1669 MetadataDescription.SUPPORTS_GET_GENERATED_KEYS, null, null, false)) 1670 .booleanValue(); 1671 } 1672 1673 1677 public java.sql.ResultSet getSuperTypes(String catalog, String schemaPattern, 1678 String typeNamePattern) throws SQLException 1679 { 1680 return connection.getSuperTypes(catalog, schemaPattern, typeNamePattern); 1681 } 1682 1683 1687 public java.sql.ResultSet getSuperTables(String catalog, 1688 String schemaPattern, String tableNamePattern) throws SQLException 1689 { 1690 return connection.getSuperTables(catalog, schemaPattern, tableNamePattern); 1691 } 1692 1693 1697 public java.sql.ResultSet getAttributes(String catalog, String schemaPattern, 1698 String typeNamePattern, String attributeNamePattern) throws SQLException 1699 { 1700 return connection.getAttributes(catalog, schemaPattern, typeNamePattern, 1701 attributeNamePattern); 1702 } 1703 1704 1707 public int getResultSetHoldability() throws SQLException 1708 { 1709 return ((Integer ) getMetadata( 1710 MetadataDescription.GET_RESULTSET_HOLDABILITY, null, null, false)) 1711 .intValue(); 1712 } 1713 1714 1717 public int getDatabaseMajorVersion() throws SQLException 1718 { 1719 return ((Integer ) getMetadata( 1720 MetadataDescription.GET_DATABASE_MAJOR_VERSION, null, null, false)) 1721 .intValue(); 1722 } 1723 1724 1727 public int getDatabaseMinorVersion() throws SQLException 1728 { 1729 return ((Integer ) getMetadata( 1730 MetadataDescription.GET_DATABASE_MINOR_VERSION, null, null, false)) 1731 .intValue(); 1732 } 1733 1734 1741 public int getJDBCMajorVersion() throws SQLException 1742 { 1743 return Driver.MAJOR_VERSION; 1744 } 1745 1746 1753 public int getJDBCMinorVersion() throws SQLException 1754 { 1755 return Driver.MINOR_VERSION; 1756 } 1757 1758 1761 public int getSQLStateType() throws SQLException 1762 { 1763 return ((Integer ) getMetadata(MetadataDescription.GET_SQL_STATE_TYPE, null, 1764 null, false)).intValue(); 1765 } 1766 1767 1770 public boolean locatorsUpdateCopy() throws SQLException 1771 { 1772 return ((Boolean ) getMetadata(MetadataDescription.LOCATORS_UPDATE_COPY, 1773 null, null, false)).booleanValue(); 1774 } 1775 1776 1779 public boolean supportsStatementPooling() throws SQLException 1780 { 1781 return ((Boolean ) getMetadata( 1782 MetadataDescription.SUPPORTS_STATEMENT_POOLING, null, null, false)) 1783 .booleanValue(); 1784 } 1785}
| Popular Tags
|