001 package com.mockrunner.mock.jdbc; 002 003 import java.sql.Connection; 004 import java.sql.DatabaseMetaData; 005 import java.sql.ResultSet; 006 import java.sql.SQLException; 007 import java.util.ArrayList; 008 import java.util.Arrays; 009 import java.util.HashMap; 010 import java.util.Iterator; 011 import java.util.List; 012 import java.util.Map; 013 014 import com.mockrunner.util.common.StringUtil; 015 016 /** 017 * Mock implementation of <code>DatabaseMetaData</code>. 018 */ 019 public class MockDatabaseMetaData implements DatabaseMetaData 020 { 021 private boolean caseSensitive = false; 022 private int databaseMajorVersion = 1; 023 private int databaseMinorVersion = 0; 024 private int defaultTransactionLevel = Connection.TRANSACTION_READ_COMMITTED; 025 private int driverMajorVersion = 1; 026 private int driverMinorVersion = 0; 027 private int jdbcMajorVersion = 3; 028 private int jdbcMinorVersion = 0; 029 private int maxBinaryLiteralLength = 0; 030 private int maxCatalogNameLength = 0; 031 private int maxCharLiteralLength = 0; 032 private int maxColumnNameLength = 0; 033 private int maxColumnsInGroupBy = 0; 034 private int maxColumnsInIndex = 0; 035 private int maxColumnsInOrderBy = 0; 036 private int maxColumnsInSelect = 0; 037 private int maxColumnsInTable = 0; 038 private int maxConnections = 0; 039 private int maxCursorNameLength = 0; 040 private int maxIndexLength = 0; 041 private int maxProcedureNameLength = 0; 042 private int maxRowSize = 0; 043 private int maxSchemaNameLength = 0; 044 private int maxStatementLength = 0; 045 private int maxStatements = 0; 046 private int maxTableNameLength = 0; 047 private int maxTablesInSelect = 0; 048 private int maxUserNameLength = 0; 049 private int resultSetHoldability = ResultSet.CONCUR_READ_ONLY; 050 private int sqlStateType = sqlStateSQL99; 051 private boolean allProceduresAreCallable = true; 052 private boolean allTablesAreSelectable = true; 053 private boolean dataDefinitionCausesTransactionCommit = false; 054 private boolean dataDefinitionIgnoredInTransactions = false; 055 private boolean doesMaxRowSizeIncludeBlobs = false; 056 private boolean isCatalogAtStart = false; 057 private boolean isReadOnly = false; 058 private boolean locatorsUpdateCopy = false; 059 private boolean nullPlusNonNullIsNull = false; 060 private boolean nullsAreSortedAtEnd = false; 061 private boolean nullsAreSortedAtStart = false; 062 private boolean nullsAreSortedHigh = false; 063 private boolean nullsAreSortedLow = false; 064 private boolean storesLowerCaseIdentifiers = true; 065 private boolean storesLowerCaseQuotedIdentifiers = true; 066 private boolean storesMixedCaseIdentifiers = true; 067 private boolean storesMixedCaseQuotedIdentifiers = true; 068 private boolean storesUpperCaseIdentifiers = true; 069 private boolean storesUpperCaseQuotedIdentifiers = true; 070 private boolean supportsANSI92EntryLevelSQL = true; 071 private boolean supportsANSI92FullSQL = true; 072 private boolean supportsANSI92IntermediateSQL = true; 073 private boolean supportsAlterTableWithAddColumn = true; 074 private boolean supportsAlterTableWithDropColumn = true; 075 private boolean supportsBatchUpdates = true; 076 private boolean supportsCatalogsInDataManipulation = true; 077 private boolean supportsCatalogsInIndexDefinitions = true; 078 private boolean supportsCatalogsInPrivilegeDefinitions = true; 079 private boolean supportsCatalogsInProcedureCalls = true; 080 private boolean supportsCatalogsInTableDefinitions = true; 081 private boolean supportsColumnAliasing = true; 082 private boolean supportsConvert = true; 083 private boolean supportsCoreSQLGrammar = true; 084 private boolean supportsCorrelatedSubqueries = true; 085 private boolean supportsDataDefinitionAndDataManipulationTransactions = true; 086 private boolean supportsDataManipulationTransactionsOnly = false; 087 private boolean supportsDifferentTableCorrelationNames; 088 private boolean supportsExpressionsInOrderBy = true; 089 private boolean supportsExtendedSQLGrammar = true; 090 private boolean supportsFullOuterJoins = true; 091 private boolean supportsGetGeneratedKeys = true; 092 private boolean supportsGroupBy = true; 093 private boolean supportsGroupByBeyondSelect = true; 094 private boolean supportsGroupByUnrelated = true; 095 private boolean supportsIntegrityEnhancementFacility = true; 096 private boolean supportsLikeEscapeClause = true; 097 private boolean supportsLimitedOuterJoins = true; 098 private boolean supportsMinimumSQLGrammar = true;; 099 private boolean supportsMixedCaseIdentifiers = true; 100 private boolean supportsMixedCaseQuotedIdentifiers = true; 101 private boolean supportsMultipleOpenResults = true; 102 private boolean supportsMultipleResultSets = true; 103 private boolean supportsMultipleTransactions = true; 104 private boolean supportsNamedParameters = true; 105 private boolean supportsNonNullableColumns = true; 106 private boolean supportsOpenCursorsAcrossCommit = true; 107 private boolean supportsOpenCursorsAcrossRollback = true; 108 private boolean supportsOpenStatementsAcrossCommit = true; 109 private boolean supportsOpenStatementsAcrossRollback = true; 110 private boolean supportsOrderByUnrelated = true; 111 private boolean supportsOuterJoins = true; 112 private boolean supportsPositionedDelete = true; 113 private boolean supportsPositionedUpdate = true; 114 private boolean supportsSavepoints = true; 115 private boolean supportsSchemasInDataManipulation = true; 116 private boolean supportsSchemasInIndexDefinitions = true; 117 private boolean supportsSchemasInPrivilegeDefinitions = true; 118 private boolean supportsSchemasInProcedureCalls = true; 119 private boolean supportsSchemasInTableDefinitions = true; 120 private boolean supportsSelectForUpdate = true; 121 private boolean supportsStatementPooling = true; 122 private boolean supportsStoredProcedures = true; 123 private boolean supportsSubqueriesInComparisons = true; 124 private boolean supportsSubqueriesInExists = true; 125 private boolean supportsSubqueriesInIns = true; 126 private boolean supportsSubqueriesInQuantifieds = true; 127 private boolean supportsTableCorrelationNames = true; 128 private boolean supportsTransactions = true;; 129 private boolean supportsUnion = true; 130 private boolean supportsUnionAll = true; 131 private boolean usesLocalFilePerTable = false; 132 private boolean usesLocalFiles = true; 133 private boolean deletesAreDetected = true; 134 private boolean insertsAreDetected = true; 135 private boolean othersDeletesAreVisible = true; 136 private boolean othersInsertsAreVisible = true; 137 private boolean othersUpdatesAreVisible = true; 138 private boolean ownDeletesAreVisible = true; 139 private boolean ownInsertsAreVisible = true; 140 private boolean ownUpdatesAreVisible = true; 141 private boolean supportsResultSetHoldability = true; 142 private boolean supportsResultSetType = true; 143 private boolean supportsTransactionIsolationLevel = true; 144 private boolean updatesAreDetected = true; 145 private boolean supportsResultSetConcurrency = true; 146 private String catalogSeparator = "."; 147 private String catalogTerm = "database"; 148 private String databaseProductName = "MockDatabase"; 149 private String databaseProductVersion = "1.0"; 150 private String driverName = MockDriver.class.getName(); 151 private String driverVersion = "1.0"; 152 private String extraNameCharacters = ""; 153 private String identifierQuoteString = " "; 154 private String numericFunctions = ""; 155 private String procedureTerm = ""; 156 private String sqlKeywords = ""; 157 private String schemaTerm = ""; 158 private String searchStringEscape = "\\"; 159 private String stringFunctions = ""; 160 private String systemFunctions = ""; 161 private String timeDateFunctions = ""; 162 private String url; 163 private String userName; 164 private Connection connection; 165 private ResultSet catalogs; 166 private ResultSet schemas; 167 private ResultSet tableTypes; 168 private ResultSet typeInfo; 169 private Map exportedKeysMap = new HashMap(); 170 private Map importedKeysMap = new HashMap(); 171 private Map primaryKeysMap = new HashMap(); 172 private Map proceduresMap = new HashMap(); 173 private Map superTablesMap = new HashMap(); 174 private Map superTypesMap = new HashMap(); 175 private Map tablePrivilegesMap = new HashMap(); 176 private Map versionColumnsMap = new HashMap(); 177 private Map bestRowIdentifierMap = new HashMap(); 178 private Map indexInfoMap = new HashMap(); 179 private Map udtsMap = new HashMap(); 180 private Map attributesMap = new HashMap(); 181 private Map columnPrivilegesMap = new HashMap(); 182 private Map columnsMap = new HashMap(); 183 private Map procedureColumnsMap = new HashMap(); 184 private Map tablesMap = new HashMap(); 185 private Map crossReferenceMap = new HashMap(); 186 187 /** 188 * Set if matching of catalogs, schemas, tables and columns 189 * is case sensitive. Defaults to <code>false</code>. 190 * @param caseSensitive is matching case sensitive 191 */ 192 public void setCaseSensitive(boolean caseSensitive) 193 { 194 this.caseSensitive = caseSensitive; 195 } 196 197 public int getDatabaseMajorVersion() throws SQLException 198 { 199 return databaseMajorVersion; 200 } 201 202 public void setDatabaseMajorVersion(int version) 203 { 204 databaseMajorVersion = version; 205 } 206 207 public int getDatabaseMinorVersion() throws SQLException 208 { 209 return databaseMinorVersion; 210 } 211 212 public void setDatabaseMinorVersion(int version) 213 { 214 databaseMinorVersion = version; 215 } 216 217 public int getDefaultTransactionIsolation() throws SQLException 218 { 219 return defaultTransactionLevel; 220 } 221 222 public void setDefaultTransactionIsolation(int defaultTransactionLevel) 223 { 224 this.defaultTransactionLevel = defaultTransactionLevel; 225 } 226 227 public int getDriverMajorVersion() 228 { 229 return driverMajorVersion; 230 } 231 232 public void setDriverMajorVersion(int driverMajorVersion) 233 { 234 this.driverMajorVersion = driverMajorVersion; 235 } 236 237 public int getDriverMinorVersion() 238 { 239 return driverMinorVersion; 240 } 241 242 public void setDriverMinorVersion(int driverMinorVersion) 243 { 244 this.driverMinorVersion = driverMinorVersion; 245 } 246 247 public int getJDBCMajorVersion() throws SQLException 248 { 249 return jdbcMajorVersion; 250 } 251 252 public void setJDBCMajorVersion(int jdbcMajorVersion) 253 { 254 this.jdbcMajorVersion = jdbcMajorVersion; 255 } 256 257 public int getJDBCMinorVersion() throws SQLException 258 { 259 return jdbcMinorVersion; 260 } 261 262 public void setJDBCMinorVersion(int jdbcMinorVersion) 263 { 264 this.jdbcMinorVersion = jdbcMinorVersion; 265 } 266 267 public int getMaxBinaryLiteralLength() throws SQLException 268 { 269 return maxBinaryLiteralLength; 270 } 271 272 public void setMaxBinaryLiteralLength(int maxBinaryLiteralLength) 273 { 274 this.maxBinaryLiteralLength = maxBinaryLiteralLength; 275 } 276 277 public int getMaxCatalogNameLength() throws SQLException 278 { 279 return maxCatalogNameLength; 280 } 281 282 public void setetMaxCatalogNameLength(int maxCatalogNameLength) 283 { 284 this.maxCatalogNameLength = maxCatalogNameLength; 285 } 286 287 public int getMaxCharLiteralLength() throws SQLException 288 { 289 return maxCharLiteralLength; 290 } 291 292 public void setMaxCharLiteralLength(int maxCharLiteralLength) 293 { 294 this.maxCharLiteralLength = maxCharLiteralLength; 295 } 296 297 public int getMaxColumnNameLength() throws SQLException 298 { 299 return maxColumnNameLength; 300 } 301 302 public void setMaxColumnNameLength(int maxColumnNameLength) 303 { 304 this.maxColumnNameLength = maxColumnNameLength; 305 } 306 307 public int getMaxColumnsInGroupBy() throws SQLException 308 { 309 return maxColumnsInGroupBy; 310 } 311 312 public void setMaxColumnsInGroupBy(int maxColumnsInGroupBy) 313 { 314 this.maxColumnsInGroupBy = maxColumnsInGroupBy; 315 } 316 317 public int getMaxColumnsInIndex() throws SQLException 318 { 319 return maxColumnsInIndex; 320 } 321 322 public void setMaxColumnsInIndex(int maxColumnsInIndex) 323 { 324 this.maxColumnsInIndex = maxColumnsInIndex; 325 } 326 327 public int getMaxColumnsInOrderBy() throws SQLException 328 { 329 return maxColumnsInOrderBy; 330 } 331 332 public void setMaxColumnsInOrderBy(int maxColumnsInOrderBy) 333 { 334 this.maxColumnsInOrderBy = maxColumnsInOrderBy; 335 } 336 337 public int getMaxColumnsInSelect() throws SQLException 338 { 339 return maxColumnsInSelect; 340 } 341 342 public void setMaxColumnsInSelect(int maxColumnsInSelect) 343 { 344 this.maxColumnsInSelect = maxColumnsInSelect; 345 } 346 347 public int getMaxColumnsInTable() throws SQLException 348 { 349 return maxColumnsInTable; 350 } 351 352 public void setMaxColumnsInTable(int maxColumnsInTable) 353 { 354 this.maxColumnsInTable = maxColumnsInTable; 355 } 356 357 public int getMaxConnections() throws SQLException 358 { 359 return maxConnections; 360 } 361 362 public void setMaxConnections(int maxConnections) 363 { 364 this.maxConnections = maxConnections; 365 } 366 367 public int getMaxCursorNameLength() throws SQLException 368 { 369 return maxCursorNameLength; 370 } 371 372 public void setMaxCursorNameLength(int maxCursorNameLength) 373 { 374 this.maxCursorNameLength = maxCursorNameLength; 375 } 376 377 public int getMaxIndexLength() throws SQLException 378 { 379 return maxIndexLength; 380 } 381 382 public void setMaxIndexLength(int maxIndexLength) 383 { 384 this.maxIndexLength = maxIndexLength; 385 } 386 387 public int getMaxProcedureNameLength() throws SQLException 388 { 389 return maxProcedureNameLength; 390 } 391 392 public void setMaxProcedureNameLength(int maxProcedureNameLength) 393 { 394 this.maxProcedureNameLength = maxProcedureNameLength; 395 } 396 397 public int getMaxRowSize() throws SQLException 398 { 399 return maxRowSize; 400 } 401 402 public void setMaxRowSize(int maxRowSize) 403 { 404 this.maxRowSize = maxRowSize; 405 } 406 407 public int getMaxSchemaNameLength() throws SQLException 408 { 409 return maxSchemaNameLength; 410 } 411 412 public void setMaxSchemaNameLength(int maxSchemaNameLength) 413 { 414 this.maxSchemaNameLength = maxSchemaNameLength; 415 } 416 417 public int getMaxStatementLength() throws SQLException 418 { 419 return maxStatementLength; 420 } 421 422 public void setMaxStatementLength(int maxStatementLength) 423 { 424 this.maxStatementLength = maxStatementLength; 425 } 426 427 public int getMaxStatements() throws SQLException 428 { 429 return maxStatements; 430 } 431 432 public void setMaxStatements(int maxStatements) 433 { 434 this.maxStatements = maxStatements; 435 } 436 437 public int getMaxTableNameLength() throws SQLException 438 { 439 return maxTableNameLength; 440 } 441 442 public void setMaxTableNameLength(int maxTableNameLength) 443 { 444 this.maxTableNameLength = maxTableNameLength; 445 } 446 447 public int getMaxTablesInSelect() throws SQLException 448 { 449 return maxTablesInSelect; 450 } 451 452 public void setMaxTablesInSelect(int maxTablesInSelect) 453 { 454 this.maxTablesInSelect = maxTablesInSelect; 455 } 456 457 public int getMaxUserNameLength() throws SQLException 458 { 459 return maxUserNameLength; 460 } 461 462 public void setMaxUserNameLength(int maxUserNameLength) 463 { 464 this.maxUserNameLength = maxUserNameLength; 465 } 466 467 public int getResultSetHoldability() throws SQLException 468 { 469 return resultSetHoldability; 470 } 471 472 public void setResultSetHoldability(int resultSetHoldability) 473 { 474 this.resultSetHoldability = resultSetHoldability; 475 } 476 477 public int getSQLStateType() throws SQLException 478 { 479 return sqlStateType; 480 } 481 482 public void setSQLStateType(int sqlStateType) 483 { 484 this.sqlStateType = sqlStateType; 485 } 486 487 public boolean allProceduresAreCallable() throws SQLException 488 { 489 return allProceduresAreCallable; 490 } 491 492 public void setAllProceduresAreCallable(boolean callable) 493 { 494 allProceduresAreCallable = callable; 495 } 496 497 public boolean allTablesAreSelectable() throws SQLException 498 { 499 return allTablesAreSelectable; 500 } 501 502 public void setAllTablesAreSelectable(boolean selectable) 503 { 504 allTablesAreSelectable = selectable; 505 } 506 507 public boolean dataDefinitionCausesTransactionCommit() throws SQLException 508 { 509 return dataDefinitionCausesTransactionCommit; 510 } 511 512 public void setDataDefinitionCausesTransactionCommit(boolean causesCommit) 513 { 514 dataDefinitionCausesTransactionCommit = causesCommit; 515 } 516 517 public boolean dataDefinitionIgnoredInTransactions() throws SQLException 518 { 519 return dataDefinitionIgnoredInTransactions; 520 } 521 522 public void setDataDefinitionIgnoredInTransactions(boolean ignored) 523 { 524 dataDefinitionIgnoredInTransactions = ignored; 525 } 526 527 public boolean doesMaxRowSizeIncludeBlobs() throws SQLException 528 { 529 return doesMaxRowSizeIncludeBlobs; 530 } 531 532 public void setDoesMaxRowSizeIncludeBlobs(boolean includeBlobs) 533 { 534 doesMaxRowSizeIncludeBlobs = includeBlobs; 535 } 536 537 public boolean isCatalogAtStart() throws SQLException 538 { 539 return isCatalogAtStart; 540 } 541 542 public void setIsCatalogAtStart(boolean isCatalogAtStart) 543 { 544 this.isCatalogAtStart = isCatalogAtStart; 545 } 546 547 public boolean isReadOnly() throws SQLException 548 { 549 return isReadOnly; 550 } 551 552 public void setIsReadOnly(boolean isReadOnly) 553 { 554 this.isReadOnly = isReadOnly; 555 } 556 557 public boolean locatorsUpdateCopy() throws SQLException 558 { 559 return locatorsUpdateCopy; 560 } 561 562 public void setLocatorsUpdateCopy(boolean locatorsUpdateCopy) 563 { 564 this.locatorsUpdateCopy = locatorsUpdateCopy; 565 } 566 567 public boolean nullPlusNonNullIsNull() throws SQLException 568 { 569 return nullPlusNonNullIsNull; 570 } 571 572 public void setNullPlusNonNullIsNull(boolean nullPlusNonNullIsNull) 573 { 574 this.nullPlusNonNullIsNull = nullPlusNonNullIsNull; 575 } 576 577 public boolean nullsAreSortedAtEnd() throws SQLException 578 { 579 return nullsAreSortedAtEnd; 580 } 581 582 public void setNullsAreSortedAtEnd(boolean nullsAreSortedAtEnd) 583 { 584 this.nullsAreSortedAtEnd = nullsAreSortedAtEnd; 585 } 586 587 public boolean nullsAreSortedAtStart() throws SQLException 588 { 589 return nullsAreSortedAtStart; 590 } 591 592 public void setNullsAreSortedAtStart(boolean nullsAreSortedAtStart) 593 { 594 this.nullsAreSortedAtStart = nullsAreSortedAtStart; 595 } 596 597 public boolean nullsAreSortedHigh() throws SQLException 598 { 599 return nullsAreSortedHigh; 600 } 601 602 public void setNullsAreSortedHigh(boolean nullsAreSortedHigh) 603 { 604 this.nullsAreSortedHigh = nullsAreSortedHigh; 605 } 606 607 public boolean nullsAreSortedLow() throws SQLException 608 { 609 return nullsAreSortedLow; 610 } 611 612 public void setNullsAreSortedLow(boolean nullsAreSortedLow) 613 { 614 this.nullsAreSortedLow = nullsAreSortedLow; 615 } 616 617 public boolean storesLowerCaseIdentifiers() throws SQLException 618 { 619 return storesLowerCaseIdentifiers; 620 } 621 622 public void setStoresLowerCaseIdentifiers(boolean storesLowerCaseIdentifiers) 623 { 624 this.storesLowerCaseIdentifiers = storesLowerCaseIdentifiers; 625 } 626 627 public boolean storesLowerCaseQuotedIdentifiers() throws SQLException 628 { 629 return storesLowerCaseQuotedIdentifiers; 630 } 631 632 public void setStoresLowerCaseQuotedIdentifiers(boolean storesLowerCaseQuotedIdentifiers) 633 { 634 this.storesLowerCaseQuotedIdentifiers = storesLowerCaseQuotedIdentifiers; 635 } 636 637 public boolean storesMixedCaseIdentifiers() throws SQLException 638 { 639 return storesMixedCaseIdentifiers; 640 } 641 642 public void setStoresMixedCaseIdentifiers(boolean storesMixedCaseIdentifiers) 643 { 644 this.storesMixedCaseIdentifiers = storesMixedCaseIdentifiers; 645 } 646 647 public boolean storesMixedCaseQuotedIdentifiers() throws SQLException 648 { 649 return storesMixedCaseQuotedIdentifiers; 650 } 651 652 public void setStoresMixedCaseQuotedIdentifiers(boolean storesMixedCaseQuotedIdentifiers) 653 { 654 this.storesMixedCaseQuotedIdentifiers = storesMixedCaseQuotedIdentifiers; 655 } 656 657 public boolean storesUpperCaseIdentifiers() throws SQLException 658 { 659 return storesUpperCaseIdentifiers; 660 } 661 662 public void setStoresUpperCaseIdentifiers(boolean storesUpperCaseIdentifiers) 663 { 664 this.storesUpperCaseIdentifiers = storesUpperCaseIdentifiers; 665 } 666 667 public boolean storesUpperCaseQuotedIdentifiers() throws SQLException 668 { 669 return storesUpperCaseQuotedIdentifiers; 670 } 671 672 public void setStoresUpperCaseQuotedIdentifiers(boolean storesUpperCaseQuotedIdentifiers) 673 { 674 this.storesUpperCaseQuotedIdentifiers = storesUpperCaseQuotedIdentifiers; 675 } 676 677 public boolean supportsANSI92EntryLevelSQL() throws SQLException 678 { 679 return supportsANSI92EntryLevelSQL; 680 } 681 682 public void setSupportsANSI92EntryLevelSQL(boolean supportsANSI92EntryLevelSQL) 683 { 684 this.supportsANSI92EntryLevelSQL = supportsANSI92EntryLevelSQL; 685 } 686 687 public boolean supportsANSI92FullSQL() throws SQLException 688 { 689 return supportsANSI92FullSQL; 690 } 691 692 public void setSupportsANSI92FullSQL(boolean supportsANSI92FullSQL) 693 { 694 this.supportsANSI92FullSQL = supportsANSI92FullSQL; 695 } 696 697 public boolean supportsANSI92IntermediateSQL() throws SQLException 698 { 699 return supportsANSI92IntermediateSQL; 700 } 701 702 public void setSupportsANSI92IntermediateSQL(boolean supportsANSI92IntermediateSQL) 703 { 704 this.supportsANSI92IntermediateSQL = supportsANSI92IntermediateSQL; 705 } 706 707 public boolean supportsAlterTableWithAddColumn() throws SQLException 708 { 709 return supportsAlterTableWithAddColumn; 710 } 711 712 public void setSupportsAlterTableWithAddColumn(boolean supportsAlterTableWithAddColumn) 713 { 714 this.supportsAlterTableWithAddColumn = supportsAlterTableWithAddColumn; 715 } 716 717 public boolean supportsAlterTableWithDropColumn() throws SQLException 718 { 719 return supportsAlterTableWithDropColumn; 720 } 721 722 public void setSupportsAlterTableWithDropColumn(boolean supportsAlterTableWithDropColumn) 723 { 724 this.supportsAlterTableWithDropColumn = supportsAlterTableWithDropColumn; 725 } 726 727 public boolean supportsBatchUpdates() throws SQLException 728 { 729 return supportsBatchUpdates; 730 } 731 732 public void setSupportsBatchUpdates(boolean supportsBatchUpdates) 733 { 734 this.supportsBatchUpdates = supportsBatchUpdates; 735 } 736 737 public boolean supportsCatalogsInDataManipulation() throws SQLException 738 { 739 return supportsCatalogsInDataManipulation; 740 } 741 742 public void setSupportsCatalogsInDataManipulation(boolean supportsCatalogsInDataManipulation) 743 { 744 this.supportsCatalogsInDataManipulation = supportsCatalogsInDataManipulation; 745 } 746 747 public boolean supportsCatalogsInIndexDefinitions() throws SQLException 748 { 749 return supportsCatalogsInIndexDefinitions; 750 } 751 752 public void setSupportsCatalogsInIndexDefinitions(boolean supportsCatalogsInIndexDefinitions) 753 { 754 this.supportsCatalogsInIndexDefinitions = supportsCatalogsInIndexDefinitions; 755 } 756 757 public boolean supportsCatalogsInPrivilegeDefinitions() throws SQLException 758 { 759 return supportsCatalogsInPrivilegeDefinitions; 760 } 761 762 public void setSupportsCatalogsInPrivilegeDefinitions(boolean supportsCatalogsInPrivilegeDefinitions) 763 { 764 this.supportsCatalogsInPrivilegeDefinitions = supportsCatalogsInPrivilegeDefinitions; 765 } 766 767 public boolean supportsCatalogsInProcedureCalls() throws SQLException 768 { 769 return supportsCatalogsInProcedureCalls; 770 } 771 772 public void setSupportsCatalogsInProcedureCalls(boolean supportsCatalogsInProcedureCalls) 773 { 774 this.supportsCatalogsInProcedureCalls = supportsCatalogsInProcedureCalls; 775 } 776 777 public boolean supportsCatalogsInTableDefinitions() throws SQLException 778 { 779 return supportsCatalogsInTableDefinitions; 780 } 781 782 public void setSupportsCatalogsInTableDefinitions(boolean supportsCatalogsInTableDefinitions) 783 { 784 this.supportsCatalogsInTableDefinitions = supportsCatalogsInTableDefinitions; 785 } 786 787 public boolean supportsColumnAliasing() throws SQLException 788 { 789 return supportsColumnAliasing; 790 } 791 792 public void setSupportsColumnAliasing(boolean supportsColumnAliasing) 793 { 794 this.supportsColumnAliasing = supportsColumnAliasing; 795 } 796 797 public boolean supportsConvert() throws SQLException 798 { 799 return supportsConvert; 800 } 801 802 public void setSupportsConvert(boolean supportsConvert) 803 { 804 this.supportsConvert = supportsConvert; 805 } 806 807 public boolean supportsCoreSQLGrammar() throws SQLException 808 { 809 return supportsCoreSQLGrammar; 810 } 811 812 public void setSupportsCoreSQLGrammar(boolean supportsCoreSQLGrammar) 813 { 814 this.supportsCoreSQLGrammar = supportsCoreSQLGrammar; 815 } 816 817 public boolean supportsCorrelatedSubqueries() throws SQLException 818 { 819 return supportsCorrelatedSubqueries; 820 } 821 822 public void setSupportsCorrelatedSubqueries(boolean supportsCorrelatedSubqueries) 823 { 824 this.supportsCorrelatedSubqueries = supportsCorrelatedSubqueries; 825 } 826 827 public boolean supportsDataDefinitionAndDataManipulationTransactions() throws SQLException 828 { 829 return supportsDataDefinitionAndDataManipulationTransactions; 830 } 831 832 public void setSupportsDataDefinitionAndDataManipulationTransactions(boolean supportsDataDefinitionAndDataManipulationTransactions) 833 { 834 this.supportsDataDefinitionAndDataManipulationTransactions = supportsDataDefinitionAndDataManipulationTransactions; 835 } 836 837 public boolean supportsDataManipulationTransactionsOnly() throws SQLException 838 { 839 return supportsDataManipulationTransactionsOnly; 840 } 841 842 public void setSupportsDataManipulationTransactionsOnly(boolean supportsDataManipulationTransactionsOnly) 843 { 844 this.supportsDataManipulationTransactionsOnly = supportsDataManipulationTransactionsOnly; 845 } 846 847 public boolean supportsDifferentTableCorrelationNames() throws SQLException 848 { 849 return supportsDifferentTableCorrelationNames; 850 } 851 852 public void setSupportsDifferentTableCorrelationNames(boolean supportsDifferentTableCorrelationNames) 853 { 854 this.supportsDifferentTableCorrelationNames = supportsDifferentTableCorrelationNames; 855 } 856 857 public boolean supportsExpressionsInOrderBy() throws SQLException 858 { 859 return supportsExpressionsInOrderBy; 860 } 861 862 public void setSupportsExpressionsInOrderBy(boolean supportsExpressionsInOrderBy) 863 { 864 this.supportsExpressionsInOrderBy = supportsExpressionsInOrderBy; 865 } 866 867 public boolean supportsExtendedSQLGrammar() throws SQLException 868 { 869 return supportsExtendedSQLGrammar; 870 } 871 872 public void setSupportsExtendedSQLGrammar(boolean supportsExtendedSQLGrammar) 873 { 874 this.supportsExtendedSQLGrammar = supportsExtendedSQLGrammar; 875 } 876 877 public boolean supportsFullOuterJoins() throws SQLException 878 { 879 return supportsFullOuterJoins; 880 } 881 882 public void setSupportsFullOuterJoins(boolean supportsFullOuterJoins) 883 { 884 this.supportsFullOuterJoins = supportsFullOuterJoins; 885 } 886 887 public boolean supportsGetGeneratedKeys() throws SQLException 888 { 889 return supportsGetGeneratedKeys; 890 } 891 892 public void setSupportsGetGeneratedKeys(boolean supportsGetGeneratedKeys) 893 { 894 this.supportsGetGeneratedKeys = supportsGetGeneratedKeys; 895 } 896 897 public boolean supportsGroupBy() throws SQLException 898 { 899 return supportsGroupBy; 900 } 901 902 public void setSupportsGroupBy(boolean supportsGroupBy) 903 { 904 this.supportsGroupBy = supportsGroupBy; 905 } 906 907 public boolean supportsGroupByBeyondSelect() throws SQLException 908 { 909 return supportsGroupByBeyondSelect; 910 } 911 912 public void setSupportsGroupByBeyondSelect(boolean supportsGroupByBeyondSelect) 913 { 914 this.supportsGroupByBeyondSelect = supportsGroupByBeyondSelect; 915 } 916 917 public boolean supportsGroupByUnrelated() throws SQLException 918 { 919 return supportsGroupByUnrelated; 920 } 921 922 public void setSupportsGroupByUnrelated(boolean supportsGroupByUnrelated) 923 { 924 this.supportsGroupByUnrelated = supportsGroupByUnrelated; 925 } 926 927 public boolean supportsIntegrityEnhancementFacility() throws SQLException 928 { 929 return supportsIntegrityEnhancementFacility; 930 } 931 932 public void setSupportsIntegrityEnhancementFacility(boolean supportsIntegrityEnhancementFacility) 933 { 934 this.supportsIntegrityEnhancementFacility = supportsIntegrityEnhancementFacility; 935 } 936 937 public boolean supportsLikeEscapeClause() throws SQLException 938 { 939 return supportsLikeEscapeClause; 940 } 941 942 public void setSupportsLikeEscapeClause(boolean supportsLikeEscapeClause) 943 { 944 this.supportsLikeEscapeClause = supportsLikeEscapeClause; 945 } 946 947 public boolean supportsLimitedOuterJoins() throws SQLException 948 { 949 return supportsLimitedOuterJoins; 950 } 951 952 public void setSupportsLimitedOuterJoins(boolean supportsLimitedOuterJoins) 953 { 954 this.supportsLimitedOuterJoins = supportsLimitedOuterJoins; 955 } 956 957 public boolean supportsMinimumSQLGrammar() throws SQLException 958 { 959 return supportsMinimumSQLGrammar; 960 } 961 962 public void setSupportsMinimumSQLGrammar(boolean supportsMinimumSQLGrammar) 963 { 964 this.supportsMinimumSQLGrammar = supportsMinimumSQLGrammar; 965 } 966 967 public boolean supportsMixedCaseIdentifiers() throws SQLException 968 { 969 return supportsMixedCaseIdentifiers; 970 } 971 972 public void setSupportsMixedCaseIdentifiers(boolean supportsMixedCaseIdentifiers) 973 { 974 this.supportsMixedCaseIdentifiers = supportsMixedCaseIdentifiers; 975 } 976 977 public boolean supportsMixedCaseQuotedIdentifiers() throws SQLException 978 { 979 return supportsMixedCaseQuotedIdentifiers; 980 } 981 982 public void setSupportsMixedCaseQuotedIdentifiers(boolean supportsMixedCaseQuotedIdentifiers) 983 { 984 this.supportsMixedCaseQuotedIdentifiers = supportsMixedCaseQuotedIdentifiers; 985 } 986 987 public boolean supportsMultipleOpenResults() throws SQLException 988 { 989 return supportsMultipleOpenResults; 990 } 991 992 public void setSupportsMultipleOpenResults(boolean supportsMultipleOpenResults) 993 { 994 this.supportsMultipleOpenResults = supportsMultipleOpenResults; 995 } 996 997 public boolean supportsMultipleResultSets() throws SQLException 998 { 999 return supportsMultipleResultSets; 1000 } 1001 1002 public void setSupportsMultipleResultSets(boolean supportsMultipleResultSets) 1003 { 1004 this.supportsMultipleResultSets = supportsMultipleResultSets; 1005 } 1006 1007 public boolean supportsMultipleTransactions() throws SQLException 1008 { 1009 return supportsMultipleTransactions; 1010 } 1011 1012 public void setSupportsMultipleTransactions(boolean supportsMultipleTransactions) 1013 { 1014 this.supportsMultipleTransactions = supportsMultipleTransactions; 1015 } 1016 1017 public boolean supportsNamedParameters() throws SQLException 1018 { 1019 return supportsNamedParameters; 1020 } 1021 1022 public void setSupportsNamedParameters(boolean supportsNamedParameters) 1023 { 1024 this.supportsNamedParameters = supportsNamedParameters; 1025 } 1026 1027 public boolean supportsNonNullableColumns() throws SQLException 1028 { 1029 return supportsNonNullableColumns; 1030 } 1031 1032 public void setSupportsNonNullableColumns(boolean supportsNonNullableColumns) 1033 { 1034 this.supportsNonNullableColumns = supportsNonNullableColumns; 1035 } 1036 1037 public boolean supportsOpenCursorsAcrossCommit() throws SQLException 1038 { 1039 return supportsOpenCursorsAcrossCommit; 1040 } 1041 1042 public void setSupportsOpenCursorsAcrossCommit(boolean supportsOpenCursorsAcrossCommit) 1043 { 1044 this.supportsOpenCursorsAcrossCommit = supportsOpenCursorsAcrossCommit; 1045 } 1046 1047 public boolean supportsOpenCursorsAcrossRollback() throws SQLException 1048 { 1049 return supportsOpenCursorsAcrossRollback; 1050 } 1051 1052 public void setSupportsOpenCursorsAcrossRollback(boolean supportsOpenCursorsAcrossRollback) 1053 { 1054 this.supportsOpenCursorsAcrossRollback = supportsOpenCursorsAcrossRollback; 1055 } 1056 1057 public boolean supportsOpenStatementsAcrossCommit() throws SQLException 1058 { 1059 return supportsOpenStatementsAcrossCommit; 1060 } 1061 1062 public void setSupportsOpenStatementsAcrossCommit(boolean supportsOpenStatementsAcrossCommit) 1063 { 1064 this.supportsOpenStatementsAcrossCommit = supportsOpenStatementsAcrossCommit; 1065 } 1066 1067 public boolean supportsOpenStatementsAcrossRollback() throws SQLException 1068 { 1069 return supportsOpenStatementsAcrossRollback; 1070 } 1071 1072 public void setSupportsOpenStatementsAcrossRollback(boolean supportsOpenStatementsAcrossRollback) 1073 { 1074 this.supportsOpenStatementsAcrossRollback = supportsOpenStatementsAcrossRollback; 1075 } 1076 1077 public boolean supportsOrderByUnrelated() throws SQLException 1078 { 1079 return supportsOrderByUnrelated; 1080 } 1081 1082 public void setSupportsOrderByUnrelated(boolean supportsOrderByUnrelated) 1083 { 1084 this.supportsOrderByUnrelated = supportsOrderByUnrelated; 1085 } 1086 1087 public boolean supportsOuterJoins() throws SQLException 1088 { 1089 return supportsOuterJoins; 1090 } 1091 1092 public void setSupportsOuterJoins(boolean supportsOuterJoins) 1093 { 1094 this.supportsOuterJoins = supportsOuterJoins; 1095 } 1096 1097 public boolean supportsPositionedDelete() throws SQLException 1098 { 1099 return supportsPositionedDelete; 1100 } 1101 1102 public void setSupportsPositionedDelete(boolean supportsPositionedDelete) 1103 { 1104 this.supportsPositionedDelete = supportsPositionedDelete; 1105 } 1106 1107 public boolean supportsPositionedUpdate() throws SQLException 1108 { 1109 return supportsPositionedUpdate; 1110 } 1111 1112 public void setSupportsPositionedUpdate(boolean supportsPositionedUpdate) 1113 { 1114 this.supportsPositionedUpdate = supportsPositionedUpdate; 1115 } 1116 1117 public boolean supportsSavepoints() throws SQLException 1118 { 1119 return supportsSavepoints; 1120 } 1121 1122 public void setSupportsSavepoints(boolean supportsSavepoints) 1123 { 1124 this.supportsSavepoints = supportsSavepoints; 1125 } 1126 1127 public boolean supportsSchemasInDataManipulation() throws SQLException 1128 { 1129 return supportsSchemasInDataManipulation; 1130 } 1131 1132 public void setSupportsSchemasInDataManipulation(boolean supportsSchemasInDataManipulation) 1133 { 1134 this.supportsSchemasInDataManipulation = supportsSchemasInDataManipulation; 1135 } 1136 1137 public boolean supportsSchemasInIndexDefinitions() throws SQLException 1138 { 1139 return supportsSchemasInIndexDefinitions; 1140 } 1141 1142 public void setSupportsSchemasInIndexDefinitions(boolean supportsSchemasInIndexDefinitions) 1143 { 1144 this.supportsSchemasInIndexDefinitions = supportsSchemasInIndexDefinitions; 1145 } 1146 1147 public boolean supportsSchemasInPrivilegeDefinitions() throws SQLException 1148 { 1149 return supportsSchemasInPrivilegeDefinitions; 1150 } 1151 1152 public void setSupportsSchemasInPrivilegeDefinitions(boolean supportsSchemasInPrivilegeDefinitions) 1153 { 1154 this.supportsSchemasInPrivilegeDefinitions = supportsSchemasInPrivilegeDefinitions; 1155 } 1156 1157 public boolean supportsSchemasInProcedureCalls() throws SQLException 1158 { 1159 return supportsSchemasInProcedureCalls; 1160 } 1161 1162 public void setSupportsSchemasInProcedureCalls(boolean supportsSchemasInProcedureCalls) 1163 { 1164 this.supportsSchemasInProcedureCalls = supportsSchemasInProcedureCalls; 1165 } 1166 1167 public boolean supportsSchemasInTableDefinitions() throws SQLException 1168 { 1169 return supportsSchemasInTableDefinitions; 1170 } 1171 1172 public void setSupportsSchemasInTableDefinitions(boolean supportsSchemasInTableDefinitions) 1173 { 1174 this.supportsSchemasInTableDefinitions = supportsSchemasInTableDefinitions; 1175 } 1176 1177 public boolean supportsSelectForUpdate() throws SQLException 1178 { 1179 return supportsSelectForUpdate; 1180 } 1181 1182 public void setSupportsSelectForUpdate(boolean supportsSelectForUpdate) 1183 { 1184 this.supportsSelectForUpdate = supportsSelectForUpdate; 1185 } 1186 1187 public boolean supportsStatementPooling() throws SQLException 1188 { 1189 return supportsStatementPooling; 1190 } 1191 1192 public void setSupportsStatementPooling(boolean supportsStatementPooling) 1193 { 1194 this.supportsStatementPooling = supportsStatementPooling; 1195 } 1196 1197 public boolean supportsStoredProcedures() throws SQLException 1198 { 1199 return supportsStoredProcedures; 1200 } 1201 1202 public void setSupportsStoredProcedures(boolean supportsStoredProcedures) 1203 { 1204 this.supportsStoredProcedures = supportsStoredProcedures; 1205 } 1206 1207 public boolean supportsSubqueriesInComparisons() throws SQLException 1208 { 1209 return supportsSubqueriesInComparisons; 1210 } 1211 1212 public void setSupportsSubqueriesInComparisons(boolean supportsSubqueriesInComparisons) 1213 { 1214 this.supportsSubqueriesInComparisons = supportsSubqueriesInComparisons; 1215 } 1216 1217 public boolean supportsSubqueriesInExists() throws SQLException 1218 { 1219 return supportsSubqueriesInExists; 1220 } 1221 1222 public void setSupportsSubqueriesInExists(boolean supportsSubqueriesInExists) 1223 { 1224 this.supportsSubqueriesInExists = supportsSubqueriesInExists; 1225 } 1226 1227 public boolean supportsSubqueriesInIns() throws SQLException 1228 { 1229 return supportsSubqueriesInIns; 1230 } 1231 1232 public void setSupportsSubqueriesInIns(boolean supportsSubqueriesInIns) 1233 { 1234 this.supportsSubqueriesInIns = supportsSubqueriesInIns; 1235 } 1236 1237 public boolean supportsSubqueriesInQuantifieds() throws SQLException 1238 { 1239 return supportsSubqueriesInQuantifieds; 1240 } 1241 1242 public void setSupportsSubqueriesInQuantifieds(boolean supportsSubqueriesInQuantifieds) 1243 { 1244 this.supportsSubqueriesInQuantifieds = supportsSubqueriesInQuantifieds; 1245 } 1246 1247 public boolean supportsTableCorrelationNames() throws SQLException 1248 { 1249 return supportsTableCorrelationNames; 1250 } 1251 1252 public void setSupportsTableCorrelationNames(boolean supportsTableCorrelationNames) 1253 { 1254 this.supportsTableCorrelationNames = supportsTableCorrelationNames; 1255 } 1256 1257 public boolean supportsTransactions() throws SQLException 1258 { 1259 return supportsTransactions; 1260 } 1261 1262 public void setSupportsTransactions(boolean supportsTransactions) 1263 { 1264 this.supportsTransactions = supportsTransactions; 1265 } 1266 1267 public boolean supportsUnion() throws SQLException 1268 { 1269 return supportsUnion; 1270 } 1271 1272 public void setSupportsUnion(boolean supportsUnion) 1273 { 1274 this.supportsUnion = supportsUnion; 1275 } 1276 1277 public boolean supportsUnionAll() throws SQLException 1278 { 1279 return supportsUnionAll; 1280 } 1281 1282 public void setSupportsUnionAll(boolean supportsUnionAll) 1283 { 1284 this.supportsUnionAll = supportsUnionAll; 1285 } 1286 1287 public boolean usesLocalFilePerTable() throws SQLException 1288 { 1289 return usesLocalFilePerTable; 1290 } 1291 1292 public void setUsesLocalFilePerTable(boolean usesLocalFilePerTable) 1293 { 1294 this.usesLocalFilePerTable = usesLocalFilePerTable; 1295 } 1296 1297 public boolean usesLocalFiles() throws SQLException 1298 { 1299 return usesLocalFiles; 1300 } 1301 1302 public void setUsesLocalFiles(boolean usesLocalFiles) 1303 { 1304 this.usesLocalFiles = usesLocalFiles; 1305 } 1306 1307 public boolean deletesAreDetected(int type) throws SQLException 1308 { 1309 return deletesAreDetected; 1310 } 1311 1312 public void setDeletesAreDetected(boolean deletesAreDetected) 1313 { 1314 this.deletesAreDetected = deletesAreDetected; 1315 } 1316 1317 public boolean insertsAreDetected(int type) throws SQLException 1318 { 1319 return insertsAreDetected; 1320 } 1321 1322 public void setInsertsAreDetected(boolean insertsAreDetected) 1323 { 1324 this.insertsAreDetected = insertsAreDetected; 1325 } 1326 1327 public boolean othersDeletesAreVisible(int type) throws SQLException 1328 { 1329 return othersDeletesAreVisible; 1330 } 1331 1332 public void setOthersDeletesAreVisible(boolean othersDeletesAreVisible) 1333 { 1334 this.othersDeletesAreVisible = othersDeletesAreVisible; 1335 } 1336 1337 public boolean othersInsertsAreVisible(int type) throws SQLException 1338 { 1339 return othersInsertsAreVisible; 1340 } 1341 1342 public void setOthersInsertsAreVisible(boolean othersInsertsAreVisible) 1343 { 1344 this.othersInsertsAreVisible = othersInsertsAreVisible; 1345 } 1346 1347 public boolean othersUpdatesAreVisible(int type) throws SQLException 1348 { 1349 return othersUpdatesAreVisible; 1350 } 1351 1352 public void setOthersUpdatesAreVisible(boolean othersUpdatesAreVisible) 1353 { 1354 this.othersUpdatesAreVisible = othersUpdatesAreVisible; 1355 } 1356 1357 public boolean ownDeletesAreVisible(int type) throws SQLException 1358 { 1359 return ownDeletesAreVisible; 1360 } 1361 1362 public void setOwnDeletesAreVisible(boolean ownDeletesAreVisible) 1363 { 1364 this.ownDeletesAreVisible = ownDeletesAreVisible; 1365 } 1366 1367 public boolean ownInsertsAreVisible(int type) throws SQLException 1368 { 1369 return ownInsertsAreVisible; 1370 } 1371 1372 public void setOwnInsertsAreVisible(boolean ownInsertsAreVisible) 1373 { 1374 this.ownInsertsAreVisible = ownInsertsAreVisible; 1375 } 1376 1377 public boolean ownUpdatesAreVisible(int type) throws SQLException 1378 { 1379 return ownUpdatesAreVisible; 1380 } 1381 1382 public void setOwnUpdatesAreVisible(boolean ownUpdatesAreVisible) 1383 { 1384 this.ownUpdatesAreVisible = ownUpdatesAreVisible; 1385 } 1386 1387 public boolean supportsResultSetHoldability(int holdability) throws SQLException 1388 { 1389 return supportsResultSetHoldability; 1390 } 1391 1392 public void setSupportsResultSetHoldability(boolean supportsResultSetHoldability) 1393 { 1394 this.supportsResultSetHoldability = supportsResultSetHoldability; 1395 } 1396 1397 public boolean supportsResultSetType(int type) throws SQLException 1398 { 1399 return supportsResultSetType; 1400 } 1401 1402 public void setSupportsResultSetType(boolean supportsResultSetType) 1403 { 1404 this.supportsResultSetType = supportsResultSetType; 1405 } 1406 1407 public boolean supportsTransactionIsolationLevel(int level) throws SQLException 1408 { 1409 return supportsTransactionIsolationLevel; 1410 } 1411 1412 public void setSupportsTransactionIsolationLevel(boolean supportsTransactionIsolationLevel) 1413 { 1414 this.supportsTransactionIsolationLevel = supportsTransactionIsolationLevel; 1415 } 1416 1417 public boolean updatesAreDetected(int type) throws SQLException 1418 { 1419 return updatesAreDetected; 1420 } 1421 1422 public void setUpdatesAreDetected(boolean updatesAreDetected) 1423 { 1424 this.updatesAreDetected = updatesAreDetected; 1425 } 1426 1427 public boolean supportsConvert(int fromType, int toType) throws SQLException 1428 { 1429 return supportsConvert; 1430 } 1431 1432 public boolean supportsResultSetConcurrency(int type, int concurrency) throws SQLException 1433 { 1434 return supportsResultSetConcurrency; 1435 } 1436 1437 public void setSupportsResultSetConcurrency(boolean supportsResultSetConcurrency) 1438 { 1439 this.supportsResultSetConcurrency = supportsResultSetConcurrency; 1440 } 1441 1442 public String getCatalogSeparator() throws SQLException 1443 { 1444 return catalogSeparator; 1445 } 1446 1447 public void setCatalogSeparator(String catalogSeparator) 1448 { 1449 this.catalogSeparator = catalogSeparator; 1450 } 1451 1452 public String getCatalogTerm() throws SQLException 1453 { 1454 return catalogTerm; 1455 } 1456 1457 public void setCatalogTerm(String catalogTerm) 1458 { 1459 this.catalogTerm = catalogTerm; 1460 } 1461 1462 public String getDatabaseProductName() throws SQLException 1463 { 1464 return databaseProductName; 1465 } 1466 1467 public void setDatabaseProductName(String databaseProductName) 1468 { 1469 this.databaseProductName = databaseProductName; 1470 } 1471 1472 public String getDatabaseProductVersion() throws SQLException 1473 { 1474 return databaseProductVersion; 1475 } 1476 1477 public void setDatabaseProductVersion(String databaseProductVersion) 1478 { 1479 this.databaseProductVersion = databaseProductVersion; 1480 } 1481 1482 public String getDriverName() throws SQLException 1483 { 1484 return driverName; 1485 } 1486 1487 public void setDriverName(String driverName) 1488 { 1489 this.driverName = driverName; 1490 } 1491 1492 public String getDriverVersion() throws SQLException 1493 { 1494 return driverVersion; 1495 } 1496 1497 public void setDriverVersion(String driverVersion) 1498 { 1499 this.driverVersion = driverVersion; 1500 } 1501 1502 public String getExtraNameCharacters() throws SQLException 1503 { 1504 return extraNameCharacters; 1505 } 1506 1507 public void setExtraNameCharacters(String extraNameCharacters) 1508 { 1509 this.extraNameCharacters = extraNameCharacters; 1510 } 1511 1512 public String getIdentifierQuoteString() throws SQLException 1513 { 1514 return identifierQuoteString; 1515 } 1516 1517 public void setIdentifierQuoteString(String identifierQuoteString) 1518 { 1519 this.identifierQuoteString = identifierQuoteString; 1520 } 1521 1522 public String getNumericFunctions() throws SQLException 1523 { 1524 return numericFunctions; 1525 } 1526 1527 public void setNumericFunctions(String numericFunctions) 1528 { 1529 this.numericFunctions = numericFunctions; 1530 } 1531 1532 public String getProcedureTerm() throws SQLException 1533 { 1534 return procedureTerm; 1535 } 1536 1537 public void setProcedureTerm(String procedureTerm) 1538 { 1539 this.procedureTerm = procedureTerm; 1540 } 1541 1542 public String getSQLKeywords() throws SQLException 1543 { 1544 return sqlKeywords; 1545 } 1546 1547 public void setSQLKeywords(String sqlKeywords) 1548 { 1549 this.sqlKeywords = sqlKeywords; 1550 } 1551 1552 public String getSchemaTerm() throws SQLException 1553 { 1554 return schemaTerm; 1555 } 1556 1557 public void setSchemaTerm(String schemaTerm) 1558 { 1559 this.schemaTerm = schemaTerm; 1560 } 1561 1562 public String getSearchStringEscape() throws SQLException 1563 { 1564 return searchStringEscape; 1565 } 1566 1567 public void setSearchStringEscape(String searchStringEscape) 1568 { 1569 this.searchStringEscape = searchStringEscape; 1570 } 1571 1572 public String getStringFunctions() throws SQLException 1573 { 1574 return stringFunctions; 1575 } 1576 1577 public void setStringFunctions(String stringFunctions) 1578 { 1579 this.stringFunctions = stringFunctions; 1580 } 1581 1582 public String getSystemFunctions() throws SQLException 1583 { 1584 return systemFunctions; 1585 } 1586 1587 public void setSystemFunctions(String systemFunctions) 1588 { 1589 this.systemFunctions = systemFunctions; 1590 } 1591 1592 public String getTimeDateFunctions() throws SQLException 1593 { 1594 return timeDateFunctions; 1595 } 1596 1597 public void setTimeDateFunctions(String timeDateFunctions) 1598 { 1599 this.timeDateFunctions = timeDateFunctions; 1600 } 1601 1602 public String getURL() throws SQLException 1603 { 1604 return url; 1605 } 1606 1607 public void setURL(String url) 1608 { 1609 this.url = url; 1610 } 1611 1612 public String getUserName() throws SQLException 1613 { 1614 return userName; 1615 } 1616 1617 public void setUserName(String userName) 1618 { 1619 this.userName = userName; 1620 } 1621 1622 public Connection getConnection() throws SQLException 1623 { 1624 return connection; 1625 } 1626 1627 public void setConnection(Connection connection) 1628 { 1629 this.connection = connection; 1630 } 1631 1632 public ResultSet getCatalogs() throws SQLException 1633 { 1634 return catalogs; 1635 } 1636 1637 public void setCatalogs(ResultSet catalogs) 1638 { 1639 this.catalogs = catalogs; 1640 } 1641 1642 public ResultSet getSchemas() throws SQLException 1643 { 1644 return schemas; 1645 } 1646 1647 public void setSchemas(ResultSet schemas) 1648 { 1649 this.schemas = schemas; 1650 } 1651 1652 public ResultSet getTableTypes() throws SQLException 1653 { 1654 return tableTypes; 1655 } 1656 1657 public void setTableTypes(ResultSet tableTypes) 1658 { 1659 this.tableTypes = tableTypes; 1660 } 1661 1662 public ResultSet getTypeInfo() throws SQLException 1663 { 1664 return typeInfo; 1665 } 1666 1667 public void setTypeInfo(ResultSet typeInfo) 1668 { 1669 this.typeInfo = typeInfo; 1670 } 1671 1672 public ResultSet getExportedKeys(String catalog, String schema, String table) throws SQLException 1673 { 1674 DatabaseIdentifier expected = new DatabaseIdentifierImpl(catalog, schema, table); 1675 return findMatchingDatabaseIdentifier(expected, exportedKeysMap); 1676 } 1677 1678 public void setExportedKeys(ResultSet exportedKeys) 1679 { 1680 exportedKeysMap.put(new DatabaseIdentifierImpl(), exportedKeys); 1681 } 1682 1683 public void setExportedKeys(String catalog, String schema, String table, ResultSet exportedKeys) 1684 { 1685 exportedKeysMap.put(new DatabaseIdentifierImpl(catalog, schema, table), exportedKeys); 1686 } 1687 1688 public void clearExportedKeys() 1689 { 1690 exportedKeysMap.clear(); 1691 } 1692 1693 public ResultSet getImportedKeys(String catalog, String schema, String table) throws SQLException 1694 { 1695 DatabaseIdentifier expected = new DatabaseIdentifierImpl(catalog, schema, table); 1696 return findMatchingDatabaseIdentifier(expected, importedKeysMap); 1697 } 1698 1699 public void setImportedKeys(ResultSet importedKeys) 1700 { 1701 importedKeysMap.put(new DatabaseIdentifierImpl(), importedKeys); 1702 } 1703 1704 public void setImportedKeys(String catalog, String schema, String table, ResultSet importedKeys) 1705 { 1706 importedKeysMap.put(new DatabaseIdentifierImpl(catalog, schema, table), importedKeys); 1707 } 1708 1709 public void clearImportedKeys() 1710 { 1711 importedKeysMap.clear(); 1712 } 1713 1714 public ResultSet getPrimaryKeys(String catalog, String schema, String table) throws SQLException 1715 { 1716 DatabaseIdentifier expected = new DatabaseIdentifierImpl(catalog, schema, table); 1717 return findMatchingDatabaseIdentifier(expected, primaryKeysMap); 1718 } 1719 1720 public void setPrimaryKeys(ResultSet primaryKeys) 1721 { 1722 primaryKeysMap.put(new DatabaseIdentifierImpl(), primaryKeys); 1723 } 1724 1725 public void setPrimaryKeys(String catalog, String schema, String table, ResultSet primaryKeys) 1726 { 1727 primaryKeysMap.put(new DatabaseIdentifierImpl(catalog, schema, table), primaryKeys); 1728 } 1729 1730 public void clearPrimaryKeys() 1731 { 1732 primaryKeysMap.clear(); 1733 } 1734 1735 public ResultSet getProcedures(String catalog, String schemaPattern, String procedureNamePattern) throws SQLException 1736 { 1737 DatabaseIdentifier expected = new DatabaseIdentifierImpl(catalog, schemaPattern, procedureNamePattern, true, true); 1738 return findMatchingDatabaseIdentifier(expected, proceduresMap); 1739 } 1740 1741 public void setProcedures(ResultSet procedures) 1742 { 1743 proceduresMap.put(new DatabaseIdentifierImpl(), procedures); 1744 } 1745 1746 public void setProcedures(String catalog, String schemaPattern, String procedureNamePattern, ResultSet procedures) 1747 { 1748 proceduresMap.put(new DatabaseIdentifierImpl(catalog, schemaPattern, procedureNamePattern), procedures); 1749 } 1750 1751 public void clearProcedures() 1752 { 1753 proceduresMap.clear(); 1754 } 1755 1756 public ResultSet getSuperTables(String catalog, String schemaPattern, String tableNamePattern) throws SQLException 1757 { 1758 DatabaseIdentifier expected = new DatabaseIdentifierImpl(catalog, schemaPattern, tableNamePattern, true, true); 1759 return findMatchingDatabaseIdentifier(expected, superTablesMap); 1760 } 1761 1762 public void setSuperTables(ResultSet superTables) 1763 { 1764 superTablesMap.put(new DatabaseIdentifierImpl(), superTables); 1765 } 1766 1767 public void setSuperTables(String catalog, String schemaPattern, String tableName, ResultSet superTables) 1768 { 1769 superTablesMap.put(new DatabaseIdentifierImpl(catalog, schemaPattern, tableName), superTables); 1770 } 1771 1772 public void clearSuperTables() 1773 { 1774 superTablesMap.clear(); 1775 } 1776 1777 public ResultSet getSuperTypes(String catalog, String schemaPattern, String typeNamePattern) throws SQLException 1778 { 1779 DatabaseIdentifier expected = new DatabaseIdentifierImpl(catalog, schemaPattern, typeNamePattern, true, true); 1780 return findMatchingDatabaseIdentifier(expected, superTypesMap); 1781 } 1782 1783 public void setSuperTypes(ResultSet superTypes) 1784 { 1785 superTypesMap.put(new DatabaseIdentifierImpl(), superTypes); 1786 } 1787 1788 public void setSuperTypes(String catalog, String schemaPattern, String typeNamePattern, ResultSet superTypes) 1789 { 1790 superTypesMap.put(new DatabaseIdentifierImpl(catalog, schemaPattern, typeNamePattern), superTypes); 1791 } 1792 1793 public void clearSuperTypes() 1794 { 1795 superTypesMap.clear(); 1796 } 1797 1798 public ResultSet getTablePrivileges(String catalog, String schemaPattern, String tableNamePattern) throws SQLException 1799 { 1800 DatabaseIdentifier expected = new DatabaseIdentifierImpl(catalog, schemaPattern, tableNamePattern, true, true); 1801 return findMatchingDatabaseIdentifier(expected, tablePrivilegesMap); 1802 } 1803 1804 public void setTablePrivileges(ResultSet tablePrivileges) 1805 { 1806 tablePrivilegesMap.put(new DatabaseIdentifierImpl(), tablePrivileges); 1807 } 1808 1809 public void setTablePrivileges(String catalog, String schemaPattern, String tableNamePattern, ResultSet tablePrivileges) 1810 { 1811 tablePrivilegesMap.put(new DatabaseIdentifierImpl(catalog, schemaPattern, tableNamePattern), tablePrivileges); 1812 } 1813 1814 public void clearTablePrivileges() 1815 { 1816 tablePrivilegesMap.clear(); 1817 } 1818 1819 public ResultSet getVersionColumns(String catalog, String schema, String table) throws SQLException 1820 { 1821 DatabaseIdentifier expected = new DatabaseIdentifierImpl(catalog, schema, table); 1822 return findMatchingDatabaseIdentifier(expected, versionColumnsMap); 1823 } 1824 1825 public void setVersionColumns(ResultSet versionColumns) 1826 { 1827 versionColumnsMap.put(new DatabaseIdentifierImpl(), versionColumns); 1828 } 1829 1830 public void setVersionColumns(String catalog, String schema, String table, ResultSet versionColumns) 1831 { 1832 versionColumnsMap.put(new DatabaseIdentifierImpl(catalog, schema, table), versionColumns); 1833 } 1834 1835 public void clearVersionColumns() 1836 { 1837 versionColumnsMap.clear(); 1838 } 1839 1840 public ResultSet getBestRowIdentifier(String catalog, String schema, String table, int scope, boolean nullable) throws SQLException 1841 { 1842 DatabaseIdentifier expected = new RowIdentifierDatabaseIdentifierImpl(catalog, schema, table, scope, nullable); 1843 return findMatchingDatabaseIdentifier(expected, bestRowIdentifierMap); 1844 } 1845 1846 public void setBestRowIdentifier(ResultSet bestRowIdentifier) 1847 { 1848 bestRowIdentifierMap.put(new RowIdentifierDatabaseIdentifierImpl(), bestRowIdentifier); 1849 } 1850 1851 public void setBestRowIdentifier(String catalog, String schema, String table, int scope, boolean nullable, ResultSet bestRowIdentifier) 1852 { 1853 bestRowIdentifierMap.put(new RowIdentifierDatabaseIdentifierImpl(catalog, schema, table, scope, nullable), bestRowIdentifier); 1854 } 1855 1856 public void clearBestRowIdentifier() 1857 { 1858 bestRowIdentifierMap.clear(); 1859 } 1860 1861 public ResultSet getIndexInfo(String catalog, String schema, String table, boolean unique, boolean approximate) throws SQLException 1862 { 1863 DatabaseIdentifier expected = new IndexInfoDatabaseIdentifierImpl(catalog, schema, table, unique, approximate); 1864 return findMatchingDatabaseIdentifier(expected, indexInfoMap); 1865 } 1866 1867 public void setIndexInfo(ResultSet indexInfo) 1868 { 1869 indexInfoMap.put(new IndexInfoDatabaseIdentifierImpl(), indexInfo); 1870 } 1871 1872 public void setIndexInfo(String catalog, String schema, String table, boolean unique, boolean approximate, ResultSet indexInfo) 1873 { 1874 indexInfoMap.put(new IndexInfoDatabaseIdentifierImpl(catalog, schema, table, unique, approximate), indexInfo); 1875 } 1876 1877 public void clearIndexInfo() 1878 { 1879 indexInfoMap.clear(); 1880 } 1881 1882 public ResultSet getUDTs(String catalog, String schemaPattern, String typeNamePattern, int[] types) throws SQLException 1883 { 1884 DatabaseIdentifier expected = new UDTDatabaseIdentifierImpl(catalog, schemaPattern, typeNamePattern, true, true, types); 1885 return findMatchingDatabaseIdentifier(expected, udtsMap); 1886 } 1887 1888 public void setUDTs(ResultSet udts) 1889 { 1890 udtsMap.put(new UDTDatabaseIdentifierImpl(), udts); 1891 } 1892 1893 public void setUDTs(String catalog, String schemaPattern, String typeNamePattern, int[] types, ResultSet udts) 1894 { 1895 udtsMap.put(new UDTDatabaseIdentifierImpl(catalog, schemaPattern, typeNamePattern, types), udts); 1896 } 1897 1898 public void clearUDTs() 1899 { 1900 udtsMap.clear(); 1901 } 1902 1903 public ResultSet getAttributes(String catalog, String schemaPattern, String typeNamePattern, String attributeNamePattern) throws SQLException 1904 { 1905 DatabaseIdentifier expected = new AttributesDatabaseIdentifierImpl(catalog, schemaPattern, typeNamePattern, true, true, attributeNamePattern); 1906 return findMatchingDatabaseIdentifier(expected, attributesMap); 1907 } 1908 1909 public void setAttributes(ResultSet attributes) 1910 { 1911 attributesMap.put(new AttributesDatabaseIdentifierImpl(), attributes); 1912 } 1913 1914 public void setAttributes(String catalog, String schemaPattern, String typeNamePattern, String attributeNamePattern, ResultSet attributes) 1915 { 1916 attributesMap.put(new AttributesDatabaseIdentifierImpl(catalog, schemaPattern, typeNamePattern, attributeNamePattern), attributes); 1917 } 1918 1919 public void clearAttributes() 1920 { 1921 attributesMap.clear(); 1922 } 1923 1924 public ResultSet getColumnPrivileges(String catalog, String schema, String table, String columnNamePattern) throws SQLException 1925 { 1926 DatabaseIdentifier expected = new ColumnDatabaseIdentifierImpl(catalog, schema, table, columnNamePattern); 1927 return findMatchingDatabaseIdentifier(expected, columnPrivilegesMap); 1928 } 1929 1930 public void setColumnPrivileges(ResultSet columnPrivileges) 1931 { 1932 columnPrivilegesMap.put(new ColumnDatabaseIdentifierImpl(), columnPrivileges); 1933 } 1934 1935 public void setColumnPrivileges(String catalog, String schema, String table, String columnNamePattern, ResultSet columnPrivileges) 1936 { 1937 columnPrivilegesMap.put(new ColumnDatabaseIdentifierImpl(catalog, schema, table, columnNamePattern), columnPrivileges); 1938 } 1939 1940 public void clearColumnPrivileges() 1941 { 1942 columnPrivilegesMap.clear(); 1943 } 1944 1945 public ResultSet getColumns(String catalog, String schemaPattern, String tableNamePattern, String columnNamePattern) throws SQLException 1946 { 1947 DatabaseIdentifier expected = new ColumnDatabaseIdentifierImpl(catalog, schemaPattern, tableNamePattern, true, true, columnNamePattern); 1948 return findMatchingDatabaseIdentifier(expected, columnsMap); 1949 } 1950 1951 public void setColumns(ResultSet columns) 1952 { 1953 columnsMap.put(new ColumnDatabaseIdentifierImpl(), columns); 1954 } 1955 1956 public void setColumns(String catalog, String schemaPattern, String tableNamePattern, String columnNamePattern, ResultSet columns) 1957 { 1958 columnsMap.put(new ColumnDatabaseIdentifierImpl(catalog, schemaPattern, tableNamePattern, columnNamePattern), columns); 1959 } 1960 1961 public void clearColumns() 1962 { 1963 columnsMap.clear(); 1964 } 1965 1966 public ResultSet getProcedureColumns(String catalog, String schemaPattern, String procedureNamePattern, String columnNamePattern) throws SQLException 1967 { 1968 DatabaseIdentifier expected = new ColumnDatabaseIdentifierImpl(catalog, schemaPattern, procedureNamePattern, true, true, columnNamePattern); 1969 return findMatchingDatabaseIdentifier(expected, procedureColumnsMap); 1970 } 1971 1972 public void setProcedureColumns(ResultSet procedureColumns) 1973 { 1974 procedureColumnsMap.put(new ColumnDatabaseIdentifierImpl(), procedureColumns); 1975 } 1976 1977 public void setProcedureColumns(String catalog, String schemaPattern, String procedureNamePattern, String columnNamePattern, ResultSet procedureColumns) 1978 { 1979 procedureColumnsMap.put(new ColumnDatabaseIdentifierImpl(catalog, schemaPattern, procedureNamePattern, columnNamePattern), procedureColumns); 1980 } 1981 1982 public void clearProcedureColumns() 1983 { 1984 procedureColumnsMap.clear(); 1985 } 1986 1987 public ResultSet getTables(String catalog, String schemaPattern, String tableNamePattern, String[] types) throws SQLException 1988 { 1989 DatabaseIdentifier expected = new TableDatabaseIdentifierImpl(catalog, schemaPattern, true, true, tableNamePattern, types); 1990 return findMatchingDatabaseIdentifier(expected, tablesMap); 1991 } 1992 1993 public void setTables(ResultSet tables) 1994 { 1995 tablesMap.put(new TableDatabaseIdentifierImpl(), tables); 1996 } 1997 1998 public void setTables(String catalog, String schemaPattern, String tableNamePattern, String[] types, ResultSet tables) 1999 { 2000 tablesMap.put(new TableDatabaseIdentifierImpl(catalog, schemaPattern, tableNamePattern, types), tables); 2001 } 2002 2003 public void clearTables() 2004 { 2005 tablesMap.clear(); 2006 } 2007 2008 public ResultSet getCrossReference(String primaryCatalog, String primarySchema, String primaryTable, String foreignCatalog, String foreignSchema, String foreignTable) throws SQLException 2009 { 2010 DatabaseIdentifier identifier1 = new DatabaseIdentifierImpl(primaryCatalog, primarySchema, primaryTable); 2011 DatabaseIdentifier identifier2 = new DatabaseIdentifierImpl(foreignCatalog, foreignSchema, foreignTable); 2012 DatabaseIdentifier expected = new DatabaseIdentifierImplWrapper(identifier1, identifier2); 2013 return findMatchingDatabaseIdentifier(expected, crossReferenceMap); 2014 } 2015 2016 public void setCrossReference(ResultSet crossReference) 2017 { 2018 DatabaseIdentifier identifier1 = new DatabaseIdentifierImpl(); 2019 DatabaseIdentifier identifier2 = new DatabaseIdentifierImpl(); 2020 crossReferenceMap.put(new DatabaseIdentifierImplWrapper(identifier1, identifier2), crossReference); 2021 } 2022 2023 public void setCrossReference(String primaryCatalog, String primarySchema, String primaryTable, String foreignCatalog, String foreignSchema, String foreignTable, ResultSet crossReference) 2024 { 2025 DatabaseIdentifier identifier1 = new DatabaseIdentifierImpl(primaryCatalog, primarySchema, primaryTable); 2026 DatabaseIdentifier identifier2 = new DatabaseIdentifierImpl(foreignCatalog, foreignSchema, foreignTable); 2027 crossReferenceMap.put(new DatabaseIdentifierImplWrapper(identifier1, identifier2), crossReference); 2028 } 2029 2030 public void clearCrossReference() 2031 { 2032 crossReferenceMap.clear(); 2033 } 2034 2035 /* 2036 * If there is only one matching DatabaseIdentifier, then return its 2037 * ResultSet otherwise return a PolyResultSet with the ResultSet of each 2038 * matching DatabaseIdentifier. 2039 */ 2040 private ResultSet findMatchingDatabaseIdentifier(DatabaseIdentifier expected, Map theMap) 2041 { 2042 List list = new ArrayList(); 2043 for(Iterator it = theMap.entrySet().iterator(); it.hasNext(); ) 2044 { 2045 Map.Entry entry = (Map.Entry)it.next(); 2046 DatabaseIdentifier next = (DatabaseIdentifier)entry.getKey(); 2047 if(next.isGlobal() || expected.matches(next)) 2048 { 2049 list.add(entry.getValue()); 2050 } 2051 } 2052 if(list.isEmpty()) return null; 2053 if(list.size() == 1) return (ResultSet)list.get(0); 2054 return new PolyResultSet(list); 2055 } 2056 2057 private interface DatabaseIdentifier 2058 { 2059 public boolean isGlobal(); 2060 2061 public boolean matches(DatabaseIdentifier other); 2062 } 2063 2064 private class DatabaseIdentifierImpl implements DatabaseIdentifier 2065 { 2066 private boolean isGlobal; 2067 private String catalog; 2068 private String schema; 2069 private String table; 2070 private boolean useSchemaPattern; 2071 private boolean useTablePattern; 2072 2073 public DatabaseIdentifierImpl() 2074 { 2075 isGlobal = true; 2076 } 2077 2078 public DatabaseIdentifierImpl(String catalog, String schema, String table) 2079 { 2080 this(catalog, schema, table, false, false); 2081 } 2082 2083 public DatabaseIdentifierImpl(String catalog, String schema, String table, boolean useSchemaPattern, boolean useTablePattern) 2084 { 2085 isGlobal = false; 2086 this.catalog = catalog; 2087 this.schema = schema; 2088 this.table = table; 2089 this.useSchemaPattern = useSchemaPattern; 2090 this.useTablePattern = useTablePattern; 2091 } 2092 2093 public String getCatalog() 2094 { 2095 return catalog; 2096 } 2097 2098 public boolean isGlobal() 2099 { 2100 return isGlobal; 2101 } 2102 2103 public String getSchema() 2104 { 2105 return schema; 2106 } 2107 2108 public String getTable() 2109 { 2110 return table; 2111 } 2112 2113 protected String convert(String name) 2114 { 2115 if(name.indexOf('%') != -1) 2116 { 2117 name = StringUtil.replaceAll(name, "%", ".*"); 2118 } 2119 if(name.indexOf('_') != -1) 2120 { 2121 name = StringUtil.replaceAll(name, "_", "."); 2122 } 2123 return name; 2124 } 2125 2126 public boolean matches(DatabaseIdentifier object) 2127 { 2128 if(null == object) return false; 2129 if(!object.getClass().equals(this.getClass())) return false; 2130 DatabaseIdentifierImpl other = (DatabaseIdentifierImpl)object; 2131 if(isGlobal != other.isGlobal()) return false; 2132 if(!matchesCatalog(other)) return false; 2133 if(!matchesSchema(other)) return false; 2134 return matchesTable(other); 2135 } 2136 2137 private boolean matchesCatalog(DatabaseIdentifierImpl other) 2138 { 2139 if(null == getCatalog()) return true; 2140 if(catalog.length() == 0) 2141 { 2142 return (other.getCatalog() == null) || (other.getCatalog().length() == 0); 2143 } 2144 else 2145 { 2146 if(other.getCatalog() == null) return false; 2147 return StringUtil.matchesExact(other.getCatalog(), catalog, caseSensitive); 2148 } 2149 } 2150 2151 private boolean matchesSchema(DatabaseIdentifierImpl other) 2152 { 2153 if(null == getSchema()) return true; 2154 if(schema.length() == 0) 2155 { 2156 return (other.getSchema() == null) || (other.getSchema().length() == 0); 2157 } 2158 else 2159 { 2160 if(other.getSchema() == null) return false; 2161 if(!useSchemaPattern) 2162 { 2163 return StringUtil.matchesExact(other.getSchema(), schema, caseSensitive); 2164 } 2165 else 2166 { 2167 return StringUtil.matchesPerl5(other.getSchema(), convert(schema), caseSensitive); 2168 } 2169 } 2170 } 2171 2172 private boolean matchesTable(DatabaseIdentifierImpl other) 2173 { 2174 if(null == table) return false; 2175 if(null == other.getTable()) return false; 2176 if(!useTablePattern) 2177 { 2178 return StringUtil.matchesExact(other.getTable(), table, caseSensitive); 2179 } 2180 else 2181 { 2182 return StringUtil.matchesPerl5(other.getTable(), convert(table), caseSensitive); 2183 } 2184 } 2185 2186 public boolean equals(Object object) 2187 { 2188 if(null == object) return false; 2189 if(!object.getClass().equals(this.getClass())) return false; 2190 DatabaseIdentifierImpl other = (DatabaseIdentifierImpl)object; 2191 if(isGlobal != other.isGlobal()) return false; 2192 if(null != catalog && !catalog.equals(other.getCatalog())) return false; 2193 if(null != other.getCatalog() && !other.getCatalog().equals(catalog)) return false; 2194 if(null != schema && !schema.equals(other.getSchema())) return false; 2195 if(null != other.getSchema() && !other.getSchema().equals(schema)) return false; 2196 if(null != table && !table.equals(other.getTable())) return false; 2197 if(null != other.getTable() && !other.getTable().equals(table)) return false; 2198 return true; 2199 } 2200 2201 public int hashCode() 2202 { 2203 int hashCode = 0; 2204 if(null != catalog) hashCode += 31 * catalog.hashCode(); 2205 if(null != schema) hashCode += 31 * schema.hashCode(); 2206 if(null != table) hashCode += 31 * table.hashCode(); 2207 return hashCode; 2208 } 2209 } 2210 2211 private class AttributesDatabaseIdentifierImpl extends DatabaseIdentifierImpl 2212 { 2213 private String attributeNamePattern; 2214 2215 public AttributesDatabaseIdentifierImpl() 2216 { 2217 2218 } 2219 2220 public AttributesDatabaseIdentifierImpl(String catalog, String schema, String table, String attributeNamePattern) 2221 { 2222 super(catalog, schema, table); 2223 this.attributeNamePattern = attributeNamePattern; 2224 } 2225 2226 public AttributesDatabaseIdentifierImpl(String catalog, String schema, String table, boolean useSchemaPattern, boolean useTablePattern, String attributeNamePattern) 2227 { 2228 super(catalog, schema, table, useSchemaPattern, useTablePattern); 2229 this.attributeNamePattern = attributeNamePattern; 2230 } 2231 2232 public String getAttributeNamePattern() 2233 { 2234 return attributeNamePattern; 2235 } 2236 2237 public boolean matches(DatabaseIdentifier object) 2238 { 2239 if(!super.matches(object)) return false; 2240 AttributesDatabaseIdentifierImpl other = (AttributesDatabaseIdentifierImpl)object; 2241 if(null == attributeNamePattern) return false; 2242 if(null == other.getAttributeNamePattern()) return false; 2243 return StringUtil.matchesPerl5(other.getAttributeNamePattern(), convert(attributeNamePattern), caseSensitive); 2244 } 2245 2246 public boolean equals(Object object) 2247 { 2248 if(!super.equals(object)) return false; 2249 AttributesDatabaseIdentifierImpl other = (AttributesDatabaseIdentifierImpl)object; 2250 if(null != attributeNamePattern && !attributeNamePattern.equals(other.getAttributeNamePattern())) return false; 2251 if(null != other.getAttributeNamePattern() && !other.getAttributeNamePattern().equals(attributeNamePattern)) return false; 2252 return true; 2253 } 2254 2255 public int hashCode() 2256 { 2257 int hashCode = super.hashCode(); 2258 if(null != attributeNamePattern) hashCode += 31 * attributeNamePattern.hashCode(); 2259 return hashCode; 2260 } 2261 } 2262 2263 private class ColumnDatabaseIdentifierImpl extends DatabaseIdentifierImpl 2264 { 2265 private String columnNamePattern; 2266 2267 public ColumnDatabaseIdentifierImpl() 2268 { 2269 2270 } 2271 2272 public ColumnDatabaseIdentifierImpl(String catalog, String schema, String table, String columnNamePattern) 2273 { 2274 super(catalog, schema, table); 2275 this.columnNamePattern = columnNamePattern; 2276 } 2277 2278 public ColumnDatabaseIdentifierImpl(String catalog, String schema, String table, boolean useSchemaPattern, boolean useTablePattern, String columnNamePattern) 2279 { 2280 super(catalog, schema, table, useSchemaPattern, useTablePattern); 2281 this.columnNamePattern = columnNamePattern; 2282 } 2283 2284 public String getColumnNamePattern() 2285 { 2286 return columnNamePattern; 2287 } 2288 2289 public boolean matches(DatabaseIdentifier object) 2290 { 2291 if(!super.matches(object)) return false; 2292 ColumnDatabaseIdentifierImpl other = (ColumnDatabaseIdentifierImpl)object; 2293 if(null == columnNamePattern) return false; 2294 if(null == other.getColumnNamePattern()) return false; 2295 return StringUtil.matchesPerl5(other.getColumnNamePattern(), convert(columnNamePattern), caseSensitive); 2296 } 2297 2298 public boolean equals(Object object) 2299 { 2300 if(!super.equals(object)) return false; 2301 ColumnDatabaseIdentifierImpl other = (ColumnDatabaseIdentifierImpl)object; 2302 if(null != columnNamePattern && !columnNamePattern.equals(other.getColumnNamePattern())) return false; 2303 if(null != other.getColumnNamePattern() && !other.getColumnNamePattern().equals(columnNamePattern)) return false; 2304 return true; 2305 } 2306 2307 public int hashCode() 2308 { 2309 int hashCode = super.hashCode(); 2310 if(null != columnNamePattern) hashCode += 31 * columnNamePattern.hashCode(); 2311 return hashCode; 2312 } 2313 } 2314 2315 private class RowIdentifierDatabaseIdentifierImpl extends DatabaseIdentifierImpl 2316 { 2317 private int scope; 2318 private boolean nullable; 2319 2320 public RowIdentifierDatabaseIdentifierImpl() 2321 { 2322 2323 } 2324 2325 public RowIdentifierDatabaseIdentifierImpl(String catalog, String schema, String table, int scope, boolean nullable) 2326 { 2327 super(catalog, schema, table); 2328 this.scope = scope; 2329 this.nullable = nullable; 2330 } 2331 2332 public boolean isNullable() 2333 { 2334 return nullable; 2335 } 2336 2337 public int getScope() 2338 { 2339 return scope; 2340 } 2341 2342 public boolean matches(DatabaseIdentifier object) 2343 { 2344 if(!super.matches(object)) return false; 2345 return isEqual(object); 2346 } 2347 2348 public boolean equals(Object object) 2349 { 2350 if(!super.equals(object)) return false; 2351 return isEqual(object); 2352 } 2353 2354 private boolean isEqual(Object object) 2355 { 2356 RowIdentifierDatabaseIdentifierImpl other = (RowIdentifierDatabaseIdentifierImpl)object; 2357 if(scope != other.getScope()) return false; 2358 if(nullable != other.isNullable()) return false; 2359 return true; 2360 } 2361 2362 public int hashCode() 2363 { 2364 int hashCode = super.hashCode() + scope; 2365 hashCode += nullable ? 31 : 62; 2366 return hashCode; 2367 } 2368 } 2369 2370 private class IndexInfoDatabaseIdentifierImpl extends DatabaseIdentifierImpl 2371 { 2372 private boolean unique; 2373 private boolean approximate; 2374 2375 public IndexInfoDatabaseIdentifierImpl() 2376 { 2377 2378 } 2379 2380 public IndexInfoDatabaseIdentifierImpl(String catalog, String schema, String table, boolean unique, boolean approximate) 2381 { 2382 super(catalog, schema, table); 2383 this.unique = unique; 2384 this.approximate = approximate; 2385 } 2386 2387 public boolean isApproximate() 2388 { 2389 return approximate; 2390 } 2391 2392 public boolean isUnique() 2393 { 2394 return unique; 2395 } 2396 2397 public boolean matches(DatabaseIdentifier object) 2398 { 2399 if(!super.matches(object)) return false; 2400 return isEqual(object); 2401 } 2402 2403 public boolean equals(Object object) 2404 { 2405 if(!super.equals(object)) return false; 2406 return isEqual(object); 2407 } 2408 2409 private boolean isEqual(Object object) 2410 { 2411 IndexInfoDatabaseIdentifierImpl other = (IndexInfoDatabaseIdentifierImpl)object; 2412 if(unique != other.isUnique()) return false; 2413 if(approximate != other.isApproximate()) return false; 2414 return true; 2415 } 2416 2417 public int hashCode() 2418 { 2419 int hashCode = super.hashCode(); 2420 hashCode += unique ? 31 : 62; 2421 hashCode += approximate ? (3 * 31) : (4 * 31); 2422 return hashCode; 2423 } 2424 } 2425 2426 private class TableDatabaseIdentifierImpl extends DatabaseIdentifierImpl 2427 { 2428 private String[] types; 2429 2430 public TableDatabaseIdentifierImpl() 2431 { 2432 2433 } 2434 2435 public TableDatabaseIdentifierImpl(String catalog, String schema, String table, String[] types) 2436 { 2437 super(catalog, schema, table); 2438 this.types = types; 2439 } 2440 2441 public TableDatabaseIdentifierImpl(String catalog, String schema, boolean useSchemaPattern, boolean useTablePattern, String table, String[] types) 2442 { 2443 super(catalog, schema, table, useSchemaPattern, useTablePattern); 2444 this.types = types; 2445 } 2446 2447 public String[] getTypes() 2448 { 2449 return types; 2450 } 2451 2452 public boolean matches(DatabaseIdentifier object) 2453 { 2454 if(!super.matches(object)) return false; 2455 TableDatabaseIdentifierImpl other = (TableDatabaseIdentifierImpl)object; 2456 if(null == types) return true; 2457 if(null == other.getTypes()) return false; 2458 return matchesTypes(other); 2459 } 2460 2461 private boolean matchesTypes(TableDatabaseIdentifierImpl other) 2462 { 2463 String[] otherTypes = other.getTypes(); 2464 for(int ii = 0; ii < types.length; ii++) 2465 { 2466 String type = types[ii]; 2467 for(int jj = 0; jj < otherTypes.length; jj++) 2468 { 2469 if(type.equals(otherTypes[jj])) return true; 2470 } 2471 } 2472 return false; 2473 } 2474 2475 public boolean equals(Object object) 2476 { 2477 if(!super.equals(object)) return false; 2478 TableDatabaseIdentifierImpl other = (TableDatabaseIdentifierImpl)object; 2479 if(null == types && null == other.getTypes()) return true; 2480 if(null == types) return false; 2481 if(null == other.getTypes()) return false; 2482 return Arrays.equals(types, other.getTypes()); 2483 } 2484 2485 public int hashCode() 2486 { 2487 int hashCode = super.hashCode(); 2488 if(null != types) 2489 { 2490 for(int ii = 0; ii < types.length; ii++) 2491 { 2492 if(null != types[ii]) 2493 { 2494 hashCode += 31 * types[ii].hashCode(); 2495 } 2496 } 2497 } 2498 return hashCode; 2499 } 2500 } 2501 2502 private class UDTDatabaseIdentifierImpl extends DatabaseIdentifierImpl 2503 { 2504 private int[] types; 2505 2506 public UDTDatabaseIdentifierImpl() 2507 { 2508 2509 } 2510 2511 public UDTDatabaseIdentifierImpl(String catalog, String schema, String table, int[] types) 2512 { 2513 super(catalog, schema, table); 2514 this.types = types; 2515 } 2516 2517 public UDTDatabaseIdentifierImpl(String catalog, String schema, String table, boolean useSchemaPattern, boolean useTablePattern, int[] types) 2518 { 2519 super(catalog, schema, table, useSchemaPattern, useTablePattern); 2520 this.types = types; 2521 } 2522 2523 public int[] getTypes() 2524 { 2525 return types; 2526 } 2527 2528 public boolean matches(DatabaseIdentifier object) 2529 { 2530 if(!super.matches(object)) return false; 2531 UDTDatabaseIdentifierImpl other = (UDTDatabaseIdentifierImpl)object; 2532 if(null == types) return true; 2533 if(null == other.getTypes()) return false; 2534 return matchesTypes(other); 2535 } 2536 2537 private boolean matchesTypes(UDTDatabaseIdentifierImpl other) 2538 { 2539 int[] otherTypes = other.getTypes(); 2540 for(int ii = 0; ii < types.length; ii++) 2541 { 2542 int type = types[ii]; 2543 for(int jj = 0; jj < otherTypes.length; jj++) 2544 { 2545 if (type == otherTypes[jj]) return true; 2546 } 2547 } 2548 return false; 2549 } 2550 2551 public boolean equals(Object object) 2552 { 2553 if(!super.equals(object)) return false; 2554 UDTDatabaseIdentifierImpl other = (UDTDatabaseIdentifierImpl)object; 2555 if(null == types && null == other.getTypes()) return true; 2556 if(null == types) return false; 2557 if(null == other.getTypes()) return false; 2558 return Arrays.equals(types, other.getTypes()); 2559 } 2560 2561 public int hashCode() 2562 { 2563 int hashCode = super.hashCode(); 2564 if(null != types) 2565 { 2566 for(int ii = 0; ii < types.length; ii++) 2567 { 2568 hashCode += 31 * types[ii]; 2569 } 2570 } 2571 return hashCode; 2572 } 2573 } 2574 2575 private class DatabaseIdentifierImplWrapper implements DatabaseIdentifier 2576 { 2577 private DatabaseIdentifier identifier1; 2578 private DatabaseIdentifier identifier2; 2579 2580 public DatabaseIdentifierImplWrapper(DatabaseIdentifier identifier1, DatabaseIdentifier identifier2) 2581 { 2582 this.identifier1 = identifier1; 2583 this.identifier2 = identifier2; 2584 } 2585 2586 public DatabaseIdentifier getIdentifier1() 2587 { 2588 return identifier1; 2589 } 2590 2591 public DatabaseIdentifier getIdentifier2() 2592 { 2593 return identifier2; 2594 } 2595 2596 public boolean isGlobal() 2597 { 2598 if(null == identifier1) return false; 2599 if(null == identifier2) return false; 2600 return (identifier1.isGlobal() && identifier1.isGlobal()); 2601 } 2602 2603 public boolean matches(DatabaseIdentifier object) 2604 { 2605 if(null == object) return false; 2606 if(!object.getClass().equals(this.getClass())) return false; 2607 DatabaseIdentifierImplWrapper other = (DatabaseIdentifierImplWrapper)object; 2608 if(null != identifier1 && !identifier1.matches(other.getIdentifier1())) return false; 2609 if(null != identifier2 && !identifier2.matches(other.getIdentifier2())) return false; 2610 return true; 2611 } 2612 2613 public boolean equals(Object object) 2614 { 2615 if(null == object) return false; 2616 if(!object.getClass().equals(this.getClass())) return false; 2617 DatabaseIdentifierImplWrapper other = (DatabaseIdentifierImplWrapper)object; 2618 if(null != identifier1 && !identifier1.equals(other.getIdentifier1())) return false; 2619 if(null != other.getIdentifier1() && !other.getIdentifier1().equals(identifier1)) return false; 2620 if(null != identifier2 && !identifier2.equals(other.getIdentifier2())) return false; 2621 if(null != other.getIdentifier2() && !other.getIdentifier2().equals(identifier2)) return false; 2622 return true; 2623 } 2624 2625 public int hashCode() 2626 { 2627 int hashCode = 0; 2628 if(null != identifier1) hashCode += 31 * identifier1.hashCode(); 2629 if(null != identifier2) hashCode += 31 * identifier2.hashCode(); 2630 return hashCode; 2631 } 2632 } 2633 } 2634