Modified: incubator/derby/code/trunk/java/client/org/apache/derby/client/am/DatabaseMetaData.java URL: http://svn.apache.org/viewcvs/incubator/derby/code/trunk/java/client/org/apache/derby/client/am/DatabaseMetaData.java?rev=165585&r1=165584&r2=165585&view=diff ============================================================================== --- incubator/derby/code/trunk/java/client/org/apache/derby/client/am/DatabaseMetaData.java (original) +++ incubator/derby/code/trunk/java/client/org/apache/derby/client/am/DatabaseMetaData.java Sun May 1 23:25:59 2005 @@ -37,2051 +37,2065 @@ // Assign an ErrorKey, ResourceKey, and Resource for each throw statement. // Save for future pass to avoid maintenance during development. -public abstract class DatabaseMetaData implements java.sql.DatabaseMetaData -{ - //----------------------------- constants ----------------------------------- - - private final static short SQL_BEST_ROWID = 1; - private final static short SQL_ROWVER = 2; - - private final static short SQL_INDEX_UNIQUE = 0; - private final static short SQL_INDEX_ALL = 1; - - //---------------------navigational members----------------------------------- - - protected Agent agent_; - protected Connection connection_; - - //-----------------------------state------------------------------------------ - - private final static int numberOfMetaDataInfoMethods__ = 108; - private Object[] metaDataInfoCache_ = new Object[numberOfMetaDataInfoMethods__]; - private boolean metaDataInfoIsCached_ = false; - - public ProductLevel productLevel_; - - private ResultSet lastGetColumnPrivilegesResultSet_ = null; - private ResultSet lastGetColumnsResultSet_ = null; - private ResultSet lastGetForeignKeysResultSet_ = null; - private ResultSet lastGetPrimaryKeysResultSet_ = null; - private ResultSet lastGetProcedureColumnsResultSet_ = null; - private ResultSet lastGetProceduresResultSet_ = null; - private ResultSet lastGetSpecialColumnsResultSet_ = null; - private ResultSet lastGetStatisticsResultSet_ = null; - private ResultSet lastGetTablePrivilegesResultSet_ = null; - private ResultSet lastGetTablesResultSet_ = null; - private ResultSet lastGetUDTsResultSet_ = null; - private ResultSet lastGetTypeInfoResultSet_ = null; - private ResultSet lastGetAttrResultSet_ = null; - private ResultSet lastGetSuperTypesResultSet_ = null; - private ResultSet lastGetSuperTablesResultSet_ = null; - - public boolean useServerXAState_ = true; - - //---------------------constructors/finalizer--------------------------------- - - protected DatabaseMetaData (Agent agent, Connection connection, ProductLevel productLevel) - { - agent_ = agent; - connection_ = connection; - productLevel_ = productLevel; - computeFeatureSet_(); - if( connection.isXAConnection() ) - { - connection.xaHostVersion_ = productLevel_.versionLevel_; - } - } - - // ---------------------------jdbc 1------------------------------------------ - - //---------------------------------------------------------------------- - // First, a variety of minor information about the target database. - - private final static int allProceduresAreCallable__ = 0; - public boolean allProceduresAreCallable () throws SqlException - { - checkForClosedConnection(); - return getMetaDataInfoBoolean (allProceduresAreCallable__); - } - - private final static int allTablesAreSelectable__ = 1; - public boolean allTablesAreSelectable () throws SqlException - { - checkForClosedConnection(); - return getMetaDataInfoBoolean (allTablesAreSelectable__); - } - - private final static int nullsAreSortedHigh__ = 2; - public boolean nullsAreSortedHigh () throws SqlException - { - checkForClosedConnection(); - return getMetaDataInfoBoolean (nullsAreSortedHigh__); - } - - private final static int nullsAreSortedLow__ = 3; - public boolean nullsAreSortedLow () throws SqlException - { - checkForClosedConnection(); - return getMetaDataInfoBoolean (nullsAreSortedLow__); - } - - private final static int nullsAreSortedAtStart__ = 4; - public boolean nullsAreSortedAtStart () throws SqlException - { - checkForClosedConnection(); - return getMetaDataInfoBoolean (nullsAreSortedAtStart__); - } - - private final static int nullsAreSortedAtEnd__ = 5; - public boolean nullsAreSortedAtEnd () throws SqlException - { - checkForClosedConnection(); - return getMetaDataInfoBoolean (nullsAreSortedAtEnd__); - } - - private final static int usesLocalFiles__ = 6; - public boolean usesLocalFiles () throws SqlException - { - checkForClosedConnection(); - return getMetaDataInfoBoolean (usesLocalFiles__); - } - - private final static int usesLocalFilePerTable__ = 7; - public boolean usesLocalFilePerTable () throws SqlException - { - checkForClosedConnection(); - return getMetaDataInfoBoolean (usesLocalFilePerTable__); - } - - private final static int storesUpperCaseIdentifiers__ = 8; - public boolean storesUpperCaseIdentifiers () throws SqlException - { - checkForClosedConnection(); - return getMetaDataInfoBoolean (storesUpperCaseIdentifiers__); - } - - - private final static int storesLowerCaseIdentifiers__ = 9; - public boolean storesLowerCaseIdentifiers () throws SqlException - { - checkForClosedConnection(); - return getMetaDataInfoBoolean (storesLowerCaseIdentifiers__); - } - - private final static int storesMixedCaseIdentifiers__ = 10; - public boolean storesMixedCaseIdentifiers () throws SqlException - { - checkForClosedConnection(); - return getMetaDataInfoBoolean (storesMixedCaseIdentifiers__); - } - - private final static int storesUpperCaseQuotedIdentifiers__ = 11; - public boolean storesUpperCaseQuotedIdentifiers () throws SqlException - { - checkForClosedConnection(); - return getMetaDataInfoBoolean (storesUpperCaseQuotedIdentifiers__); - } - - private final static int storesLowerCaseQuotedIdentifiers__ = 12; - public boolean storesLowerCaseQuotedIdentifiers () throws SqlException - { - checkForClosedConnection(); - return getMetaDataInfoBoolean (storesLowerCaseQuotedIdentifiers__); - } - - private final static int storesMixedCaseQuotedIdentifiers__ = 13; - public boolean storesMixedCaseQuotedIdentifiers () throws SqlException - { - checkForClosedConnection(); - return getMetaDataInfoBoolean (storesMixedCaseQuotedIdentifiers__); - } - - private final static int getSQLKeywords__ = 14; - public String getSQLKeywords () throws SqlException - { - checkForClosedConnection(); - return getMetaDataInfoString (getSQLKeywords__); - } - - private final static int getNumericFunctions__ = 15; - public String getNumericFunctions () throws SqlException - { - checkForClosedConnection(); - return getMetaDataInfoString (getNumericFunctions__); - } - - private final static int getStringFunctions__ = 16; - public String getStringFunctions () throws SqlException - { - checkForClosedConnection(); - return getMetaDataInfoString (getStringFunctions__); - } - - private final static int getSystemFunctions__ = 17; - public String getSystemFunctions () throws SqlException - { - checkForClosedConnection(); - return getMetaDataInfoString (getSystemFunctions__); - } - - private final static int getTimeDateFunctions__ = 18; - public String getTimeDateFunctions () throws SqlException - { - checkForClosedConnection(); - return getMetaDataInfoString (getTimeDateFunctions__); - } - - private final static int getSearchStringEscape__ = 19; - public String getSearchStringEscape () throws SqlException - { - checkForClosedConnection(); - return getMetaDataInfoString (getSearchStringEscape__); - } - private final static int getExtraNameCharacters__ = 20; - public String getExtraNameCharacters () throws SqlException - { - checkForClosedConnection(); - return getMetaDataInfoString (getExtraNameCharacters__); - } - - private final static int supportsAlterTableWithAddColumn__ = 21; - public boolean supportsAlterTableWithAddColumn () throws SqlException - { - checkForClosedConnection(); - return getMetaDataInfoBoolean (supportsAlterTableWithAddColumn__); - } - - private final static int supportsAlterTableWithDropColumn__ = 22; - public boolean supportsAlterTableWithDropColumn () throws SqlException - { - checkForClosedConnection(); - return getMetaDataInfoBoolean(supportsAlterTableWithDropColumn__); - } - - private final static int supportsConvert__ = 23; - public boolean supportsConvert () throws SqlException - { - checkForClosedConnection(); - return getMetaDataInfoBoolean(supportsConvert__); - } - - private final static int supportsConvertType__ = 24; - public boolean supportsConvert (int fromType, int toType) throws SqlException - { - checkForClosedConnection(); - return getMetaDataInfoBoolean_supportsConvert (supportsConvertType__, fromType, toType); - } - - private final static int supportsDifferentTableCorrelationNames__ = 25; - public boolean supportsDifferentTableCorrelationNames () throws SqlException - { - checkForClosedConnection(); - return getMetaDataInfoBoolean (supportsDifferentTableCorrelationNames__); - } - - private final static int supportsExpressionsInOrderBy__ = 26; - public boolean supportsExpressionsInOrderBy () throws SqlException - { - checkForClosedConnection(); - return getMetaDataInfoBoolean(supportsExpressionsInOrderBy__); - } - - private final static int supportsOrderByUnrelated__ = 27; - public boolean supportsOrderByUnrelated () throws SqlException - { - checkForClosedConnection(); - return getMetaDataInfoBoolean(supportsOrderByUnrelated__); - } - - private final static int supportsGroupBy__ = 28; - public boolean supportsGroupBy () throws SqlException - { - checkForClosedConnection(); - return getMetaDataInfoBoolean(supportsGroupBy__); - } - - private final static int supportsGroupByUnrelated__ = 29; - public boolean supportsGroupByUnrelated () throws SqlException - { - checkForClosedConnection(); - return getMetaDataInfoBoolean(supportsGroupByUnrelated__); - } - - private final static int supportsGroupByBeyondSelect__ = 30; - public boolean supportsGroupByBeyondSelect () throws SqlException - { - checkForClosedConnection(); - return getMetaDataInfoBoolean(supportsGroupByBeyondSelect__); - } - - private final static int supportsMultipleResultSets__ = 31; - public boolean supportsMultipleResultSets () throws SqlException - { - checkForClosedConnection(); - return getMetaDataInfoBoolean(supportsMultipleResultSets__); - } - - private final static int supportsMultipleTransactions__ = 32; - public boolean supportsMultipleTransactions () throws SqlException - { - checkForClosedConnection(); - return getMetaDataInfoBoolean(supportsMultipleTransactions__); - } - - private final static int supportsCoreSQLGrammar__ = 33; - public boolean supportsCoreSQLGrammar () throws SqlException - { - checkForClosedConnection(); - return getMetaDataInfoBoolean(supportsCoreSQLGrammar__); - } - - private final static int supportsExtendedSQLGrammar__ = 34; - public boolean supportsExtendedSQLGrammar () throws SqlException - { - checkForClosedConnection(); - return getMetaDataInfoBoolean(supportsExtendedSQLGrammar__); - } - - private final static int supportsANSI92IntermediateSQL__ = 35; - public boolean supportsANSI92IntermediateSQL () throws SqlException - { - checkForClosedConnection(); - return getMetaDataInfoBoolean(supportsANSI92IntermediateSQL__); - } - - private final static int supportsANSI92FullSQL__ = 36; - public boolean supportsANSI92FullSQL () throws SqlException - { - checkForClosedConnection(); - return getMetaDataInfoBoolean(supportsANSI92FullSQL__); - } - - private final static int supportsIntegrityEnhancementFacility__ = 37; - public boolean supportsIntegrityEnhancementFacility () throws SqlException - { - checkForClosedConnection(); - return getMetaDataInfoBoolean(supportsIntegrityEnhancementFacility__); - } - - private final static int supportsOuterJoins__ = 38; - public boolean supportsOuterJoins () throws SqlException - { - checkForClosedConnection(); - return getMetaDataInfoBoolean(supportsOuterJoins__); - } - - private final static int supportsFullOuterJoins__ = 39; - public boolean supportsFullOuterJoins () throws SqlException - { - checkForClosedConnection(); - return getMetaDataInfoBoolean(supportsFullOuterJoins__); - } - - private final static int supportsLimitedOuterJoins__ = 40; - public boolean supportsLimitedOuterJoins () throws SqlException - { - checkForClosedConnection(); - return getMetaDataInfoBoolean(supportsLimitedOuterJoins__); - } - - private final static int getSchemaTerm__ = 41; - public String getSchemaTerm () throws SqlException - { - checkForClosedConnection(); - return getMetaDataInfoString (getSchemaTerm__); - } - - private final static int getProcedureTerm__ = 42; - public String getProcedureTerm () throws SqlException - { - checkForClosedConnection(); - return getMetaDataInfoString (getProcedureTerm__); - } - - private final static int getCatalogTerm__ = 43; - public String getCatalogTerm () throws SqlException - { - checkForClosedConnection(); - return getMetaDataInfoString (getCatalogTerm__); - } - - private final static int isCatalogAtStart__ = 44; - public boolean isCatalogAtStart () throws SqlException - { - checkForClosedConnection(); - return getMetaDataInfoBoolean (isCatalogAtStart__); - } - - private final static int getCatalogSeparator__ = 45; - public String getCatalogSeparator () throws SqlException - { - checkForClosedConnection(); - return getMetaDataInfoString (getCatalogSeparator__); - } - - private final static int supportsSchemasInDataManipulation__ = 46; - public boolean supportsSchemasInDataManipulation () throws SqlException - { - checkForClosedConnection(); - return getMetaDataInfoBoolean(supportsSchemasInDataManipulation__); - } - - private final static int supportsSchemasInProcedureCalls__ = 47; - public boolean supportsSchemasInProcedureCalls () throws SqlException - { - checkForClosedConnection(); - return getMetaDataInfoBoolean(supportsSchemasInProcedureCalls__); - } - - private final static int supportsSchemasInTableDefinitions__ = 48; - public boolean supportsSchemasInTableDefinitions () throws SqlException - { - checkForClosedConnection(); - return getMetaDataInfoBoolean(supportsSchemasInTableDefinitions__); - } - - - private final static int supportsSchemasInIndexDefinitions__ = 49; - public boolean supportsSchemasInIndexDefinitions () throws SqlException - { - checkForClosedConnection(); - return getMetaDataInfoBoolean(supportsSchemasInIndexDefinitions__); - } - - private final static int supportsSchemasInPrivilegeDefinitions__ = 50; - public boolean supportsSchemasInPrivilegeDefinitions () throws SqlException - { - checkForClosedConnection(); - return getMetaDataInfoBoolean(supportsSchemasInPrivilegeDefinitions__); - } - - private final static int supportsCatalogsInDataManipulation__ = 51; - public boolean supportsCatalogsInDataManipulation () throws SqlException - { - checkForClosedConnection(); - return getMetaDataInfoBoolean(supportsCatalogsInDataManipulation__); - } - - private final static int supportsCatalogsInProcedureCalls__ = 52; - public boolean supportsCatalogsInProcedureCalls () throws SqlException - { - checkForClosedConnection(); - return getMetaDataInfoBoolean(supportsCatalogsInProcedureCalls__); - } - - private final static int supportsCatalogsInTableDefinitions__ = 53; - public boolean supportsCatalogsInTableDefinitions () throws SqlException - { - checkForClosedConnection(); - return getMetaDataInfoBoolean(supportsCatalogsInTableDefinitions__); - } - - private final static int supportsCatalogsInIndexDefinitions__ = 54; - public boolean supportsCatalogsInIndexDefinitions () throws SqlException - { - checkForClosedConnection(); - return getMetaDataInfoBoolean(supportsCatalogsInIndexDefinitions__); - } - - private final static int supportsCatalogsInPrivilegeDefinitions__ = 55; - public boolean supportsCatalogsInPrivilegeDefinitions () throws SqlException - { - checkForClosedConnection(); - return getMetaDataInfoBoolean(supportsCatalogsInPrivilegeDefinitions__); - } - - private final static int supportsPositionedDelete__ = 56; - public boolean supportsPositionedDelete () throws SqlException - { - checkForClosedConnection(); - return getMetaDataInfoBoolean(supportsPositionedDelete__); - } - - - private final static int supportsPositionedUpdate__ = 57; - public boolean supportsPositionedUpdate () throws SqlException - { - checkForClosedConnection(); - return getMetaDataInfoBoolean(supportsPositionedUpdate__); - } - - private final static int supportsSelectForUpdate__ = 58; - public boolean supportsSelectForUpdate () throws SqlException - { - checkForClosedConnection(); - return getMetaDataInfoBoolean(supportsSelectForUpdate__); - } - - private final static int supportsStoredProcedures__ = 59; - public boolean supportsStoredProcedures () throws SqlException - { - checkForClosedConnection(); - return getMetaDataInfoBoolean(supportsStoredProcedures__); - } - - private final static int supportsSubqueriesInComparisons__ = 60; - public boolean supportsSubqueriesInComparisons () throws SqlException - { - checkForClosedConnection(); - return getMetaDataInfoBoolean(supportsSubqueriesInComparisons__); - } - - private final static int supportsUnion__ = 61; - public boolean supportsUnion () throws SqlException - { - checkForClosedConnection(); - return getMetaDataInfoBoolean(supportsUnion__); - } - - private final static int supportsUnionAll__ = 62; - public boolean supportsUnionAll () throws SqlException - { - checkForClosedConnection(); - return getMetaDataInfoBoolean(supportsUnionAll__); - } - - private final static int supportsOpenCursorsAcrossCommit__ = 63; - public boolean supportsOpenCursorsAcrossCommit () throws SqlException - { - checkForClosedConnection(); - return getMetaDataInfoBoolean(supportsOpenCursorsAcrossCommit__); - } - - private final static int supportsOpenCursorsAcrossRollback__ = 64; - public boolean supportsOpenCursorsAcrossRollback () throws SqlException - { - checkForClosedConnection(); - return getMetaDataInfoBoolean(supportsOpenCursorsAcrossRollback__); - } - - private final static int supportsOpenStatementsAcrossCommit__ = 65; - public boolean supportsOpenStatementsAcrossCommit () throws SqlException - { - checkForClosedConnection(); - return getMetaDataInfoBoolean(supportsOpenStatementsAcrossCommit__); - } - - - private final static int supportsOpenStatementsAcrossRollback__ = 66; - public boolean supportsOpenStatementsAcrossRollback () throws SqlException - { - checkForClosedConnection(); - return getMetaDataInfoBoolean(supportsOpenStatementsAcrossRollback__); - } - //---------------------------------------------------------------------- - // The following group of methods exposes various limitations - // based on the target database with the current driver. - // Unless otherwise specified, a result of zero means there is no - // limit, or the limit is not known. - private final static int getMaxBinaryLiteralLength__ = 67; - public int getMaxBinaryLiteralLength () throws SqlException - { - checkForClosedConnection(); - return getMetaDataInfoInt (getMaxBinaryLiteralLength__); - } - - private final static int getMaxCharLiteralLength__ = 68; - public int getMaxCharLiteralLength () throws SqlException - { - checkForClosedConnection(); - return getMetaDataInfoInt(getMaxCharLiteralLength__); - } - private final static int getMaxColumnNameLength__ = 69; - - public int getMaxColumnNameLength () throws SqlException - { - checkForClosedConnection(); - return getMetaDataInfoInt(getMaxColumnNameLength__); - } - - private final static int getMaxColumnsInGroupBy__ = 70; - public int getMaxColumnsInGroupBy () throws SqlException - { - checkForClosedConnection(); - return getMetaDataInfoInt(getMaxColumnsInGroupBy__); - } - private final static int getMaxColumnsInIndex__ = 71; - public int getMaxColumnsInIndex () throws SqlException - { - checkForClosedConnection(); - return getMetaDataInfoInt(getMaxColumnsInIndex__); - } - private final static int getMaxColumnsInOrderBy__ = 72; - public int getMaxColumnsInOrderBy () throws SqlException - { - checkForClosedConnection(); - return getMetaDataInfoInt(getMaxColumnsInOrderBy__); - } - private final static int getMaxColumnsInSelect__ = 73; - public int getMaxColumnsInSelect () throws SqlException - { - checkForClosedConnection(); - return getMetaDataInfoInt(getMaxColumnsInSelect__); - } - private final static int getMaxColumnsInTable__ = 74; - public int getMaxColumnsInTable () throws SqlException - { - checkForClosedConnection(); - return getMetaDataInfoInt(getMaxColumnsInTable__); - } - - private final static int getMaxConnections__ = 75; - public int getMaxConnections () throws SqlException - { - checkForClosedConnection(); - return getMetaDataInfoInt(getMaxConnections__); - } - private final static int getMaxCursorNameLength__ = 76; - public int getMaxCursorNameLength () throws SqlException - { - checkForClosedConnection(); - return getMetaDataInfoInt(getMaxCursorNameLength__); - } - private final static int getMaxIndexLength__ = 77; - public int getMaxIndexLength () throws SqlException - { - checkForClosedConnection(); - return getMetaDataInfoInt(getMaxIndexLength__); - } - private final static int getMaxSchemaNameLength__ = 78; - public int getMaxSchemaNameLength () throws SqlException - { - checkForClosedConnection(); - return getMetaDataInfoInt(getMaxSchemaNameLength__); - } - private final static int getMaxProcedureNameLength__ = 79; - public int getMaxProcedureNameLength () throws SqlException - { - checkForClosedConnection(); - return getMetaDataInfoInt(getMaxProcedureNameLength__); - } - private final static int getMaxCatalogNameLength__ = 80; - public int getMaxCatalogNameLength () throws SqlException - { - checkForClosedConnection(); - return getMetaDataInfoInt(getMaxCatalogNameLength__); - } - - private final static int getMaxRowSize__ = 81; - public int getMaxRowSize () throws SqlException - { - checkForClosedConnection(); - return getMetaDataInfoInt(getMaxRowSize__); - } - private final static int doesMaxRowSizeIncludeBlobs__ = 82; - public boolean doesMaxRowSizeIncludeBlobs () throws SqlException - { - checkForClosedConnection(); - return getMetaDataInfoBoolean(doesMaxRowSizeIncludeBlobs__); - } - private final static int getMaxStatementLength__ = 83; - public int getMaxStatementLength () throws SqlException - { - checkForClosedConnection(); - return getMetaDataInfoInt(getMaxStatementLength__); - } - private final static int getMaxStatements__ = 84; - public int getMaxStatements () throws SqlException - { - checkForClosedConnection(); - return getMetaDataInfoInt(getMaxStatements__); - } - private final static int getMaxTableNameLength__ = 85; - public int getMaxTableNameLength () throws SqlException - { - checkForClosedConnection(); - return getMetaDataInfoInt(getMaxTableNameLength__); - } - private final static int getMaxTablesInSelect__ = 86; - public int getMaxTablesInSelect () throws SqlException - { - checkForClosedConnection(); - return getMetaDataInfoInt(getMaxTablesInSelect__); - } - private final static int getMaxUserNameLength__ = 87; - public int getMaxUserNameLength () throws SqlException - { - checkForClosedConnection(); - return getMetaDataInfoInt(getMaxUserNameLength__); - } - - private final static int getDefaultTransactionIsolation__ = 88; - public int getDefaultTransactionIsolation () throws SqlException - { - checkForClosedConnection(); - return getMetaDataInfoInt(getDefaultTransactionIsolation__); - } - - private final static int supportsTransactions__ = 89; - public boolean supportsTransactions () throws SqlException - { - checkForClosedConnection(); - return getMetaDataInfoBoolean(supportsTransactions__); - } - - // Stored Procedure will return a String containing a - // comma seperated list of all supported levels - private final static int supportsTransactionIsolationLevel__ = 90; - public boolean supportsTransactionIsolationLevel (int level) throws SqlException - { - checkForClosedConnection(); - return getMetaDataInfoBooleanWithType (supportsTransactionIsolationLevel__, level); - } - - - private final static int supportsDataDefinitionAndDataManipulationTransactions__ = 91; - public boolean supportsDataDefinitionAndDataManipulationTransactions () throws SqlException - { - checkForClosedConnection(); - return getMetaDataInfoBoolean(supportsDataDefinitionAndDataManipulationTransactions__); - } - - private final static int supportsDataManipulationTransactionsOnly__ = 92; - public boolean supportsDataManipulationTransactionsOnly () throws SqlException - { - checkForClosedConnection(); - return getMetaDataInfoBoolean(supportsDataManipulationTransactionsOnly__); - } - private final static int dataDefinitionCausesTransactionCommit__ = 93; - public boolean dataDefinitionCausesTransactionCommit () throws SqlException - { - checkForClosedConnection(); - return getMetaDataInfoBoolean(dataDefinitionCausesTransactionCommit__); - } - - private final static int dataDefinitionIgnoredInTransactions__ = 94; - public boolean dataDefinitionIgnoredInTransactions () throws SqlException - { - checkForClosedConnection(); - return getMetaDataInfoBoolean(dataDefinitionIgnoredInTransactions__); - } - - // Stored Procedure will return a String containing a - // comma seperated list of all the supported resultSet types - private final static int supportsResultSetType__ = 95; - public boolean supportsResultSetType (int type) throws SqlException - { - checkForClosedConnection(); - return getMetaDataInfoBooleanWithType (supportsResultSetType__, type); - } - - private final static int supportsResultSetConcurrency__ = 96; - public boolean supportsResultSetConcurrency (int type, int concurrency) throws SqlException - { - checkForClosedConnection(); - return getMetaDataInfoInt_SupportsResultSetConcurrency (supportsResultSetConcurrency__, type, concurrency); - } - - // Stored Procedure will return a String containing a - // comma seperated list of all the supported result Set types - private final static int ownUpdatesAreVisible__ = 97; - public boolean ownUpdatesAreVisible (int type) throws SqlException - { - checkForClosedConnection(); - return getMetaDataInfoBooleanWithType (ownUpdatesAreVisible__, type); - } - - // Stored Procedure will return a String containing a - // comma seperated list of all the supported result Set types - private final static int ownDeletesAreVisible__ = 98; - public boolean ownDeletesAreVisible (int type) throws SqlException - { - checkForClosedConnection(); - return getMetaDataInfoBooleanWithType (ownDeletesAreVisible__, type); - } - - // Stored Procedure will return a String containing a - // comma seperated list all the supported result Set types - private final static int ownInsertsAreVisible__ = 99; - public boolean ownInsertsAreVisible (int type) throws SqlException - { - checkForClosedConnection(); - return getMetaDataInfoBooleanWithType (ownInsertsAreVisible__, type); - } - - // Stored Procedure will return a String containing a - // comma seperated list of all the supported result Set types - private final static int othersUpdatesAreVisible__ = 100; - public boolean othersUpdatesAreVisible (int type) throws SqlException - { - checkForClosedConnection(); - return getMetaDataInfoBooleanWithType (othersUpdatesAreVisible__, type); - } - - // Stored Procedure will return a String containing a - // comma seperated list of all the supported result Set types - private final static int othersDeletesAreVisible__ = 101; - public boolean othersDeletesAreVisible (int type) throws SqlException - { - checkForClosedConnection(); - return getMetaDataInfoBooleanWithType (othersDeletesAreVisible__, type); - } - - // Stored Procedure will return a String containing a - // comma seperated list of all the supported result Set types - private final static int othersInsertsAreVisible__ = 102; - public boolean othersInsertsAreVisible (int type) throws SqlException - { - checkForClosedConnection(); - return getMetaDataInfoBooleanWithType (othersInsertsAreVisible__, type); - } - - // Stored Procedure will return a String containing a - // comma seperated list of all the supported result Set types - private final static int updatesAreDetected__ = 103; - public boolean updatesAreDetected (int type) throws SqlException - { - checkForClosedConnection(); - return getMetaDataInfoBooleanWithType (updatesAreDetected__, type); - } - - // Stored Procedure will return a String containing a - // comma seperated list of all the supported result Set types - private final static int deletesAreDetected__ = 104; - public boolean deletesAreDetected (int type) throws SqlException - { - checkForClosedConnection(); - return getMetaDataInfoBooleanWithType (deletesAreDetected__, type); - } - - // Stored Procedure will return a String containing a - // comma seperated list of all the supported result Set types - private final static int insertsAreDetected__ = 105; - public boolean insertsAreDetected (int type) throws SqlException - { - checkForClosedConnection(); - return getMetaDataInfoBooleanWithType (insertsAreDetected__, type); - } - - private final static int supportsBatchUpdates__ = 106; - public boolean supportsBatchUpdates () throws SqlException - { - checkForClosedConnection(); - return getMetaDataInfoBoolean (supportsBatchUpdates__); - } - - public boolean supportsSavepoints () throws SqlException - { - checkForClosedConnection(); - if (productLevel_.greaterThanOrEqualTo(5,2,0)) +public abstract class DatabaseMetaData implements java.sql.DatabaseMetaData { + //----------------------------- constants ----------------------------------- + + private final static short SQL_BEST_ROWID = 1; + private final static short SQL_ROWVER = 2; + + private final static short SQL_INDEX_UNIQUE = 0; + private final static short SQL_INDEX_ALL = 1; + + //---------------------navigational members----------------------------------- + + protected Agent agent_; + protected Connection connection_; + + //-----------------------------state------------------------------------------ + + private final static int numberOfMetaDataInfoMethods__ = 108; + private Object[] metaDataInfoCache_ = new Object[numberOfMetaDataInfoMethods__]; + private boolean metaDataInfoIsCached_ = false; + + public ProductLevel productLevel_; + + private ResultSet lastGetColumnPrivilegesResultSet_ = null; + private ResultSet lastGetColumnsResultSet_ = null; + private ResultSet lastGetForeignKeysResultSet_ = null; + private ResultSet lastGetPrimaryKeysResultSet_ = null; + private ResultSet lastGetProcedureColumnsResultSet_ = null; + private ResultSet lastGetProceduresResultSet_ = null; + private ResultSet lastGetSpecialColumnsResultSet_ = null; + private ResultSet lastGetStatisticsResultSet_ = null; + private ResultSet lastGetTablePrivilegesResultSet_ = null; + private ResultSet lastGetTablesResultSet_ = null; + private ResultSet lastGetUDTsResultSet_ = null; + private ResultSet lastGetTypeInfoResultSet_ = null; + private ResultSet lastGetAttrResultSet_ = null; + private ResultSet lastGetSuperTypesResultSet_ = null; + private ResultSet lastGetSuperTablesResultSet_ = null; + + public boolean useServerXAState_ = true; + + //---------------------constructors/finalizer--------------------------------- + + protected DatabaseMetaData(Agent agent, Connection connection, ProductLevel productLevel) { + agent_ = agent; + connection_ = connection; + productLevel_ = productLevel; + computeFeatureSet_(); + if (connection.isXAConnection()) { + connection.xaHostVersion_ = productLevel_.versionLevel_; + } + } + + // ---------------------------jdbc 1------------------------------------------ + + //---------------------------------------------------------------------- + // First, a variety of minor information about the target database. + + private final static int allProceduresAreCallable__ = 0; + + public boolean allProceduresAreCallable() throws SqlException { + checkForClosedConnection(); + return getMetaDataInfoBoolean(allProceduresAreCallable__); + } + + private final static int allTablesAreSelectable__ = 1; + + public boolean allTablesAreSelectable() throws SqlException { + checkForClosedConnection(); + return getMetaDataInfoBoolean(allTablesAreSelectable__); + } + + private final static int nullsAreSortedHigh__ = 2; + + public boolean nullsAreSortedHigh() throws SqlException { + checkForClosedConnection(); + return getMetaDataInfoBoolean(nullsAreSortedHigh__); + } + + private final static int nullsAreSortedLow__ = 3; + + public boolean nullsAreSortedLow() throws SqlException { + checkForClosedConnection(); + return getMetaDataInfoBoolean(nullsAreSortedLow__); + } + + private final static int nullsAreSortedAtStart__ = 4; + + public boolean nullsAreSortedAtStart() throws SqlException { + checkForClosedConnection(); + return getMetaDataInfoBoolean(nullsAreSortedAtStart__); + } + + private final static int nullsAreSortedAtEnd__ = 5; + + public boolean nullsAreSortedAtEnd() throws SqlException { + checkForClosedConnection(); + return getMetaDataInfoBoolean(nullsAreSortedAtEnd__); + } + + private final static int usesLocalFiles__ = 6; + + public boolean usesLocalFiles() throws SqlException { + checkForClosedConnection(); + return getMetaDataInfoBoolean(usesLocalFiles__); + } + + private final static int usesLocalFilePerTable__ = 7; + + public boolean usesLocalFilePerTable() throws SqlException { + checkForClosedConnection(); + return getMetaDataInfoBoolean(usesLocalFilePerTable__); + } + + private final static int storesUpperCaseIdentifiers__ = 8; + + public boolean storesUpperCaseIdentifiers() throws SqlException { + checkForClosedConnection(); + return getMetaDataInfoBoolean(storesUpperCaseIdentifiers__); + } + + + private final static int storesLowerCaseIdentifiers__ = 9; + + public boolean storesLowerCaseIdentifiers() throws SqlException { + checkForClosedConnection(); + return getMetaDataInfoBoolean(storesLowerCaseIdentifiers__); + } + + private final static int storesMixedCaseIdentifiers__ = 10; + + public boolean storesMixedCaseIdentifiers() throws SqlException { + checkForClosedConnection(); + return getMetaDataInfoBoolean(storesMixedCaseIdentifiers__); + } + + private final static int storesUpperCaseQuotedIdentifiers__ = 11; + + public boolean storesUpperCaseQuotedIdentifiers() throws SqlException { + checkForClosedConnection(); + return getMetaDataInfoBoolean(storesUpperCaseQuotedIdentifiers__); + } + + private final static int storesLowerCaseQuotedIdentifiers__ = 12; + + public boolean storesLowerCaseQuotedIdentifiers() throws SqlException { + checkForClosedConnection(); + return getMetaDataInfoBoolean(storesLowerCaseQuotedIdentifiers__); + } + + private final static int storesMixedCaseQuotedIdentifiers__ = 13; + + public boolean storesMixedCaseQuotedIdentifiers() throws SqlException { + checkForClosedConnection(); + return getMetaDataInfoBoolean(storesMixedCaseQuotedIdentifiers__); + } + + private final static int getSQLKeywords__ = 14; + + public String getSQLKeywords() throws SqlException { + checkForClosedConnection(); + return getMetaDataInfoString(getSQLKeywords__); + } + + private final static int getNumericFunctions__ = 15; + + public String getNumericFunctions() throws SqlException { + checkForClosedConnection(); + return getMetaDataInfoString(getNumericFunctions__); + } + + private final static int getStringFunctions__ = 16; + + public String getStringFunctions() throws SqlException { + checkForClosedConnection(); + return getMetaDataInfoString(getStringFunctions__); + } + + private final static int getSystemFunctions__ = 17; + + public String getSystemFunctions() throws SqlException { + checkForClosedConnection(); + return getMetaDataInfoString(getSystemFunctions__); + } + + private final static int getTimeDateFunctions__ = 18; + + public String getTimeDateFunctions() throws SqlException { + checkForClosedConnection(); + return getMetaDataInfoString(getTimeDateFunctions__); + } + + private final static int getSearchStringEscape__ = 19; + + public String getSearchStringEscape() throws SqlException { + checkForClosedConnection(); + return getMetaDataInfoString(getSearchStringEscape__); + } + + private final static int getExtraNameCharacters__ = 20; + + public String getExtraNameCharacters() throws SqlException { + checkForClosedConnection(); + return getMetaDataInfoString(getExtraNameCharacters__); + } + + private final static int supportsAlterTableWithAddColumn__ = 21; + + public boolean supportsAlterTableWithAddColumn() throws SqlException { + checkForClosedConnection(); + return getMetaDataInfoBoolean(supportsAlterTableWithAddColumn__); + } + + private final static int supportsAlterTableWithDropColumn__ = 22; + + public boolean supportsAlterTableWithDropColumn() throws SqlException { + checkForClosedConnection(); + return getMetaDataInfoBoolean(supportsAlterTableWithDropColumn__); + } + + private final static int supportsConvert__ = 23; + + public boolean supportsConvert() throws SqlException { + checkForClosedConnection(); + return getMetaDataInfoBoolean(supportsConvert__); + } + + private final static int supportsConvertType__ = 24; + + public boolean supportsConvert(int fromType, int toType) throws SqlException { + checkForClosedConnection(); + return getMetaDataInfoBoolean_supportsConvert(supportsConvertType__, fromType, toType); + } + + private final static int supportsDifferentTableCorrelationNames__ = 25; + + public boolean supportsDifferentTableCorrelationNames() throws SqlException { + checkForClosedConnection(); + return getMetaDataInfoBoolean(supportsDifferentTableCorrelationNames__); + } + + private final static int supportsExpressionsInOrderBy__ = 26; + + public boolean supportsExpressionsInOrderBy() throws SqlException { + checkForClosedConnection(); + return getMetaDataInfoBoolean(supportsExpressionsInOrderBy__); + } + + private final static int supportsOrderByUnrelated__ = 27; + + public boolean supportsOrderByUnrelated() throws SqlException { + checkForClosedConnection(); + return getMetaDataInfoBoolean(supportsOrderByUnrelated__); + } + + private final static int supportsGroupBy__ = 28; + + public boolean supportsGroupBy() throws SqlException { + checkForClosedConnection(); + return getMetaDataInfoBoolean(supportsGroupBy__); + } + + private final static int supportsGroupByUnrelated__ = 29; + + public boolean supportsGroupByUnrelated() throws SqlException { + checkForClosedConnection(); + return getMetaDataInfoBoolean(supportsGroupByUnrelated__); + } + + private final static int supportsGroupByBeyondSelect__ = 30; + + public boolean supportsGroupByBeyondSelect() throws SqlException { + checkForClosedConnection(); + return getMetaDataInfoBoolean(supportsGroupByBeyondSelect__); + } + + private final static int supportsMultipleResultSets__ = 31; + + public boolean supportsMultipleResultSets() throws SqlException { + checkForClosedConnection(); + return getMetaDataInfoBoolean(supportsMultipleResultSets__); + } + + private final static int supportsMultipleTransactions__ = 32; + + public boolean supportsMultipleTransactions() throws SqlException { + checkForClosedConnection(); + return getMetaDataInfoBoolean(supportsMultipleTransactions__); + } + + private final static int supportsCoreSQLGrammar__ = 33; + + public boolean supportsCoreSQLGrammar() throws SqlException { + checkForClosedConnection(); + return getMetaDataInfoBoolean(supportsCoreSQLGrammar__); + } + + private final static int supportsExtendedSQLGrammar__ = 34; + + public boolean supportsExtendedSQLGrammar() throws SqlException { + checkForClosedConnection(); + return getMetaDataInfoBoolean(supportsExtendedSQLGrammar__); + } + + private final static int supportsANSI92IntermediateSQL__ = 35; + + public boolean supportsANSI92IntermediateSQL() throws SqlException { + checkForClosedConnection(); + return getMetaDataInfoBoolean(supportsANSI92IntermediateSQL__); + } + + private final static int supportsANSI92FullSQL__ = 36; + + public boolean supportsANSI92FullSQL() throws SqlException { + checkForClosedConnection(); + return getMetaDataInfoBoolean(supportsANSI92FullSQL__); + } + + private final static int supportsIntegrityEnhancementFacility__ = 37; + + public boolean supportsIntegrityEnhancementFacility() throws SqlException { + checkForClosedConnection(); + return getMetaDataInfoBoolean(supportsIntegrityEnhancementFacility__); + } + + private final static int supportsOuterJoins__ = 38; + + public boolean supportsOuterJoins() throws SqlException { + checkForClosedConnection(); + return getMetaDataInfoBoolean(supportsOuterJoins__); + } + + private final static int supportsFullOuterJoins__ = 39; + + public boolean supportsFullOuterJoins() throws SqlException { + checkForClosedConnection(); + return getMetaDataInfoBoolean(supportsFullOuterJoins__); + } + + private final static int supportsLimitedOuterJoins__ = 40; + + public boolean supportsLimitedOuterJoins() throws SqlException { + checkForClosedConnection(); + return getMetaDataInfoBoolean(supportsLimitedOuterJoins__); + } + + private final static int getSchemaTerm__ = 41; + + public String getSchemaTerm() throws SqlException { + checkForClosedConnection(); + return getMetaDataInfoString(getSchemaTerm__); + } + + private final static int getProcedureTerm__ = 42; + + public String getProcedureTerm() throws SqlException { + checkForClosedConnection(); + return getMetaDataInfoString(getProcedureTerm__); + } + + private final static int getCatalogTerm__ = 43; + + public String getCatalogTerm() throws SqlException { + checkForClosedConnection(); + return getMetaDataInfoString(getCatalogTerm__); + } + + private final static int isCatalogAtStart__ = 44; + + public boolean isCatalogAtStart() throws SqlException { + checkForClosedConnection(); + return getMetaDataInfoBoolean(isCatalogAtStart__); + } + + private final static int getCatalogSeparator__ = 45; + + public String getCatalogSeparator() throws SqlException { + checkForClosedConnection(); + return getMetaDataInfoString(getCatalogSeparator__); + } + + private final static int supportsSchemasInDataManipulation__ = 46; + + public boolean supportsSchemasInDataManipulation() throws SqlException { + checkForClosedConnection(); + return getMetaDataInfoBoolean(supportsSchemasInDataManipulation__); + } + + private final static int supportsSchemasInProcedureCalls__ = 47; + + public boolean supportsSchemasInProcedureCalls() throws SqlException { + checkForClosedConnection(); + return getMetaDataInfoBoolean(supportsSchemasInProcedureCalls__); + } + + private final static int supportsSchemasInTableDefinitions__ = 48; + + public boolean supportsSchemasInTableDefinitions() throws SqlException { + checkForClosedConnection(); + return getMetaDataInfoBoolean(supportsSchemasInTableDefinitions__); + } + + + private final static int supportsSchemasInIndexDefinitions__ = 49; + + public boolean supportsSchemasInIndexDefinitions() throws SqlException { + checkForClosedConnection(); + return getMetaDataInfoBoolean(supportsSchemasInIndexDefinitions__); + } + + private final static int supportsSchemasInPrivilegeDefinitions__ = 50; + + public boolean supportsSchemasInPrivilegeDefinitions() throws SqlException { + checkForClosedConnection(); + return getMetaDataInfoBoolean(supportsSchemasInPrivilegeDefinitions__); + } + + private final static int supportsCatalogsInDataManipulation__ = 51; + + public boolean supportsCatalogsInDataManipulation() throws SqlException { + checkForClosedConnection(); + return getMetaDataInfoBoolean(supportsCatalogsInDataManipulation__); + } + + private final static int supportsCatalogsInProcedureCalls__ = 52; + + public boolean supportsCatalogsInProcedureCalls() throws SqlException { + checkForClosedConnection(); + return getMetaDataInfoBoolean(supportsCatalogsInProcedureCalls__); + } + + private final static int supportsCatalogsInTableDefinitions__ = 53; + + public boolean supportsCatalogsInTableDefinitions() throws SqlException { + checkForClosedConnection(); + return getMetaDataInfoBoolean(supportsCatalogsInTableDefinitions__); + } + + private final static int supportsCatalogsInIndexDefinitions__ = 54; + + public boolean supportsCatalogsInIndexDefinitions() throws SqlException { + checkForClosedConnection(); + return getMetaDataInfoBoolean(supportsCatalogsInIndexDefinitions__); + } + + private final static int supportsCatalogsInPrivilegeDefinitions__ = 55; + + public boolean supportsCatalogsInPrivilegeDefinitions() throws SqlException { + checkForClosedConnection(); + return getMetaDataInfoBoolean(supportsCatalogsInPrivilegeDefinitions__); + } + + private final static int supportsPositionedDelete__ = 56; + + public boolean supportsPositionedDelete() throws SqlException { + checkForClosedConnection(); + return getMetaDataInfoBoolean(supportsPositionedDelete__); + } + + + private final static int supportsPositionedUpdate__ = 57; + + public boolean supportsPositionedUpdate() throws SqlException { + checkForClosedConnection(); + return getMetaDataInfoBoolean(supportsPositionedUpdate__); + } + + private final static int supportsSelectForUpdate__ = 58; + + public boolean supportsSelectForUpdate() throws SqlException { + checkForClosedConnection(); + return getMetaDataInfoBoolean(supportsSelectForUpdate__); + } + + private final static int supportsStoredProcedures__ = 59; + + public boolean supportsStoredProcedures() throws SqlException { + checkForClosedConnection(); + return getMetaDataInfoBoolean(supportsStoredProcedures__); + } + + private final static int supportsSubqueriesInComparisons__ = 60; + + public boolean supportsSubqueriesInComparisons() throws SqlException { + checkForClosedConnection(); + return getMetaDataInfoBoolean(supportsSubqueriesInComparisons__); + } + + private final static int supportsUnion__ = 61; + + public boolean supportsUnion() throws SqlException { + checkForClosedConnection(); + return getMetaDataInfoBoolean(supportsUnion__); + } + + private final static int supportsUnionAll__ = 62; + + public boolean supportsUnionAll() throws SqlException { + checkForClosedConnection(); + return getMetaDataInfoBoolean(supportsUnionAll__); + } + + private final static int supportsOpenCursorsAcrossCommit__ = 63; + + public boolean supportsOpenCursorsAcrossCommit() throws SqlException { + checkForClosedConnection(); + return getMetaDataInfoBoolean(supportsOpenCursorsAcrossCommit__); + } + + private final static int supportsOpenCursorsAcrossRollback__ = 64; + + public boolean supportsOpenCursorsAcrossRollback() throws SqlException { + checkForClosedConnection(); + return getMetaDataInfoBoolean(supportsOpenCursorsAcrossRollback__); + } + + private final static int supportsOpenStatementsAcrossCommit__ = 65; + + public boolean supportsOpenStatementsAcrossCommit() throws SqlException { + checkForClosedConnection(); + return getMetaDataInfoBoolean(supportsOpenStatementsAcrossCommit__); + } + + + private final static int supportsOpenStatementsAcrossRollback__ = 66; + + public boolean supportsOpenStatementsAcrossRollback() throws SqlException { + checkForClosedConnection(); + return getMetaDataInfoBoolean(supportsOpenStatementsAcrossRollback__); + } + + //---------------------------------------------------------------------- + // The following group of methods exposes various limitations + // based on the target database with the current driver. + // Unless otherwise specified, a result of zero means there is no + // limit, or the limit is not known. + private final static int getMaxBinaryLiteralLength__ = 67; + + public int getMaxBinaryLiteralLength() throws SqlException { + checkForClosedConnection(); + return getMetaDataInfoInt(getMaxBinaryLiteralLength__); + } + + private final static int getMaxCharLiteralLength__ = 68; + + public int getMaxCharLiteralLength() throws SqlException { + checkForClosedConnection(); + return getMetaDataInfoInt(getMaxCharLiteralLength__); + } + + private final static int getMaxColumnNameLength__ = 69; + + public int getMaxColumnNameLength() throws SqlException { + checkForClosedConnection(); + return getMetaDataInfoInt(getMaxColumnNameLength__); + } + + private final static int getMaxColumnsInGroupBy__ = 70; + + public int getMaxColumnsInGroupBy() throws SqlException { + checkForClosedConnection(); + return getMetaDataInfoInt(getMaxColumnsInGroupBy__); + } + + private final static int getMaxColumnsInIndex__ = 71; + + public int getMaxColumnsInIndex() throws SqlException { + checkForClosedConnection(); + return getMetaDataInfoInt(getMaxColumnsInIndex__); + } + + private final static int getMaxColumnsInOrderBy__ = 72; + + public int getMaxColumnsInOrderBy() throws SqlException { + checkForClosedConnection(); + return getMetaDataInfoInt(getMaxColumnsInOrderBy__); + } + + private final static int getMaxColumnsInSelect__ = 73; + + public int getMaxColumnsInSelect() throws SqlException { + checkForClosedConnection(); + return getMetaDataInfoInt(getMaxColumnsInSelect__); + } + + private final static int getMaxColumnsInTable__ = 74; + + public int getMaxColumnsInTable() throws SqlException { + checkForClosedConnection(); + return getMetaDataInfoInt(getMaxColumnsInTable__); + } + + private final static int getMaxConnections__ = 75; + + public int getMaxConnections() throws SqlException { + checkForClosedConnection(); + return getMetaDataInfoInt(getMaxConnections__); + } + + private final static int getMaxCursorNameLength__ = 76; + + public int getMaxCursorNameLength() throws SqlException { + checkForClosedConnection(); + return getMetaDataInfoInt(getMaxCursorNameLength__); + } + + private final static int getMaxIndexLength__ = 77; + + public int getMaxIndexLength() throws SqlException { + checkForClosedConnection(); + return getMetaDataInfoInt(getMaxIndexLength__); + } + + private final static int getMaxSchemaNameLength__ = 78; + + public int getMaxSchemaNameLength() throws SqlException { + checkForClosedConnection(); + return getMetaDataInfoInt(getMaxSchemaNameLength__); + } + + private final static int getMaxProcedureNameLength__ = 79; + + public int getMaxProcedureNameLength() throws SqlException { + checkForClosedConnection(); + return getMetaDataInfoInt(getMaxProcedureNameLength__); + } + + private final static int getMaxCatalogNameLength__ = 80; + + public int getMaxCatalogNameLength() throws SqlException { + checkForClosedConnection(); + return getMetaDataInfoInt(getMaxCatalogNameLength__); + } + + private final static int getMaxRowSize__ = 81; + + public int getMaxRowSize() throws SqlException { + checkForClosedConnection(); + return getMetaDataInfoInt(getMaxRowSize__); + } + + private final static int doesMaxRowSizeIncludeBlobs__ = 82; + + public boolean doesMaxRowSizeIncludeBlobs() throws SqlException { + checkForClosedConnection(); + return getMetaDataInfoBoolean(doesMaxRowSizeIncludeBlobs__); + } + + private final static int getMaxStatementLength__ = 83; + + public int getMaxStatementLength() throws SqlException { + checkForClosedConnection(); + return getMetaDataInfoInt(getMaxStatementLength__); + } + + private final static int getMaxStatements__ = 84; + + public int getMaxStatements() throws SqlException { + checkForClosedConnection(); + return getMetaDataInfoInt(getMaxStatements__); + } + + private final static int getMaxTableNameLength__ = 85; + + public int getMaxTableNameLength() throws SqlException { + checkForClosedConnection(); + return getMetaDataInfoInt(getMaxTableNameLength__); + } + + private final static int getMaxTablesInSelect__ = 86; + + public int getMaxTablesInSelect() throws SqlException { + checkForClosedConnection(); + return getMetaDataInfoInt(getMaxTablesInSelect__); + } + + private final static int getMaxUserNameLength__ = 87; + + public int getMaxUserNameLength() throws SqlException { + checkForClosedConnection(); + return getMetaDataInfoInt(getMaxUserNameLength__); + } + + private final static int getDefaultTransactionIsolation__ = 88; + + public int getDefaultTransactionIsolation() throws SqlException { + checkForClosedConnection(); + return getMetaDataInfoInt(getDefaultTransactionIsolation__); + } + + private final static int supportsTransactions__ = 89; + + public boolean supportsTransactions() throws SqlException { + checkForClosedConnection(); + return getMetaDataInfoBoolean(supportsTransactions__); + } + + // Stored Procedure will return a String containing a + // comma seperated list of all supported levels + private final static int supportsTransactionIsolationLevel__ = 90; + + public boolean supportsTransactionIsolationLevel(int level) throws SqlException { + checkForClosedConnection(); + return getMetaDataInfoBooleanWithType(supportsTransactionIsolationLevel__, level); + } + + + private final static int supportsDataDefinitionAndDataManipulationTransactions__ = 91; + + public boolean supportsDataDefinitionAndDataManipulationTransactions() throws SqlException { + checkForClosedConnection(); + return getMetaDataInfoBoolean(supportsDataDefinitionAndDataManipulationTransactions__); + } + + private final static int supportsDataManipulationTransactionsOnly__ = 92; + + public boolean supportsDataManipulationTransactionsOnly() throws SqlException { + checkForClosedConnection(); + return getMetaDataInfoBoolean(supportsDataManipulationTransactionsOnly__); + } + + private final static int dataDefinitionCausesTransactionCommit__ = 93; + + public boolean dataDefinitionCausesTransactionCommit() throws SqlException { + checkForClosedConnection(); + return getMetaDataInfoBoolean(dataDefinitionCausesTransactionCommit__); + } + + private final static int dataDefinitionIgnoredInTransactions__ = 94; + + public boolean dataDefinitionIgnoredInTransactions() throws SqlException { + checkForClosedConnection(); + return getMetaDataInfoBoolean(dataDefinitionIgnoredInTransactions__); + } + + // Stored Procedure will return a String containing a + // comma seperated list of all the supported resultSet types + private final static int supportsResultSetType__ = 95; + + public boolean supportsResultSetType(int type) throws SqlException { + checkForClosedConnection(); + return getMetaDataInfoBooleanWithType(supportsResultSetType__, type); + } + + private final static int supportsResultSetConcurrency__ = 96; + + public boolean supportsResultSetConcurrency(int type, int concurrency) throws SqlException { + checkForClosedConnection(); + return getMetaDataInfoInt_SupportsResultSetConcurrency(supportsResultSetConcurrency__, type, concurrency); + } + + // Stored Procedure will return a String containing a + // comma seperated list of all the supported result Set types + private final static int ownUpdatesAreVisible__ = 97; + + public boolean ownUpdatesAreVisible(int type) throws SqlException { + checkForClosedConnection(); + return getMetaDataInfoBooleanWithType(ownUpdatesAreVisible__, type); + } + + // Stored Procedure will return a String containing a + // comma seperated list of all the supported result Set types + private final static int ownDeletesAreVisible__ = 98; + + public boolean ownDeletesAreVisible(int type) throws SqlException { + checkForClosedConnection(); + return getMetaDataInfoBooleanWithType(ownDeletesAreVisible__, type); + } + + // Stored Procedure will return a String containing a + // comma seperated list all the supported result Set types + private final static int ownInsertsAreVisible__ = 99; + + public boolean ownInsertsAreVisible(int type) throws SqlException { + checkForClosedConnection(); + return getMetaDataInfoBooleanWithType(ownInsertsAreVisible__, type); + } + + // Stored Procedure will return a String containing a + // comma seperated list of all the supported result Set types + private final static int othersUpdatesAreVisible__ = 100; + + public boolean othersUpdatesAreVisible(int type) throws SqlException { + checkForClosedConnection(); + return getMetaDataInfoBooleanWithType(othersUpdatesAreVisible__, type); + } + + // Stored Procedure will return a String containing a + // comma seperated list of all the supported result Set types + private final static int othersDeletesAreVisible__ = 101; + + public boolean othersDeletesAreVisible(int type) throws SqlException { + checkForClosedConnection(); + return getMetaDataInfoBooleanWithType(othersDeletesAreVisible__, type); + } + + // Stored Procedure will return a String containing a + // comma seperated list of all the supported result Set types + private final static int othersInsertsAreVisible__ = 102; + + public boolean othersInsertsAreVisible(int type) throws SqlException { + checkForClosedConnection(); + return getMetaDataInfoBooleanWithType(othersInsertsAreVisible__, type); + } + + // Stored Procedure will return a String containing a + // comma seperated list of all the supported result Set types + private final static int updatesAreDetected__ = 103; + + public boolean updatesAreDetected(int type) throws SqlException { + checkForClosedConnection(); + return getMetaDataInfoBooleanWithType(updatesAreDetected__, type); + } + + // Stored Procedure will return a String containing a + // comma seperated list of all the supported result Set types + private final static int deletesAreDetected__ = 104; + + public boolean deletesAreDetected(int type) throws SqlException { + checkForClosedConnection(); + return getMetaDataInfoBooleanWithType(deletesAreDetected__, type); + } + + // Stored Procedure will return a String containing a + // comma seperated list of all the supported result Set types + private final static int insertsAreDetected__ = 105; + + public boolean insertsAreDetected(int type) throws SqlException { + checkForClosedConnection(); + return getMetaDataInfoBooleanWithType(insertsAreDetected__, type); + } + + private final static int supportsBatchUpdates__ = 106; + + public boolean supportsBatchUpdates() throws SqlException { + checkForClosedConnection(); + return getMetaDataInfoBoolean(supportsBatchUpdates__); + } + + public boolean supportsSavepoints() throws SqlException { + checkForClosedConnection(); + if (productLevel_.greaterThanOrEqualTo(5, 2, 0)) { + return true; + } + + return false; + } + + // start tagging all abstract methods with an underscore like this !! + abstract public String getURL_() throws SqlException; + + public String getURL() throws SqlException { + checkForClosedConnection(); + return getURL_(); + } + + public String getUserName() throws SqlException { + checkForClosedConnection(); + return connection_.user_; + } + + public boolean isReadOnly() throws SqlException { + return false; + } + + public String getDatabaseProductName() throws SqlException { + checkForClosedConnection(); + return productLevel_.databaseProductName_; + } + + public String getDatabaseProductVersion() throws SqlException { + checkForClosedConnection(); + return productLevel_.databaseProductVersion_; + + } + + public String getDriverName() throws SqlException { + checkForClosedConnection(); + return Configuration.dncDriverName; + } + + public String getDriverVersion() throws SqlException { + checkForClosedConnection(); + return Version.getDriverVersion(); + } + + // JDBC signature also does not throw SqlException, so we don't check for closed connection. + public int getDriverMajorVersion() { + return Version.getMajorVersion(); + } + + // JDBC signature also does not throw SqlException, so we don't check for closed connection. + public int getDriverMinorVersion() { + return Version.getMinorVersion(); + } + + //All JDBC Drivers must return false for this method. For this reason we choose + //to return FALSE + public boolean supportsMixedCaseIdentifiers() throws SqlException { + checkForClosedConnection(); + return false; + } + + public boolean supportsMixedCaseQuotedIdentifiers() throws SqlException { + checkForClosedConnection(); + return true; + } + + public String getIdentifierQuoteString() throws SqlException { + checkForClosedConnection(); + return "\""; + } + + public boolean supportsColumnAliasing() throws SqlException { + checkForClosedConnection(); + return true; + } + + public boolean nullPlusNonNullIsNull() throws SqlException { + checkForClosedConnection(); + return true; + } + + public boolean supportsTableCorrelationNames() throws SqlException { + checkForClosedConnection(); + return true; + } + + public boolean supportsLikeEscapeClause() throws SqlException { + checkForClosedConnection(); + return true; + } + + public boolean supportsNonNullableColumns() throws SqlException { + checkForClosedConnection(); + return true; + } + + public boolean supportsMinimumSQLGrammar() throws SqlException { + checkForClosedConnection(); + return true; + } + + public boolean supportsANSI92EntryLevelSQL() throws SqlException { + checkForClosedConnection(); + return true; + } + + public boolean supportsSubqueriesInExists() throws SqlException { + checkForClosedConnection(); + return true; + } + + public boolean supportsSubqueriesInIns() throws SqlException { + checkForClosedConnection(); + return true; + } + + public boolean supportsSubqueriesInQuantifieds() throws SqlException { + checkForClosedConnection(); + return true; + } + + public boolean supportsCorrelatedSubqueries() throws SqlException { + checkForClosedConnection(); return true; + } + + + //------------------------catalog query methods follow-------------------------------------------- + + // call stored procedure SQLProcedures + // SYSIBM.SQLProcedures( + // CatalogName varchar(128), + // SchemaName varchar(128), + // ProcName varchar(128), + // Options varchar(4000)) + // + public java.sql.ResultSet getProcedures(String catalog, + String schemaPattern, + String procedureNamePattern) throws SqlException { + synchronized (connection_) { + if (agent_.loggingEnabled()) { + agent_.logWriter_.traceEntry(this, "getProcedures", catalog, schemaPattern, procedureNamePattern); + } + return getProceduresX(catalog, schemaPattern, procedureNamePattern); + } + } - return false; - } - // start tagging all abstract methods with an underscore like this !! - abstract public String getURL_ () throws SqlException; - public String getURL () throws SqlException - { - checkForClosedConnection(); - return getURL_(); - } - - public String getUserName () throws SqlException - { - checkForClosedConnection(); - return connection_.user_; - } - - public boolean isReadOnly () throws SqlException - { - return false; - } - - public String getDatabaseProductName () throws SqlException - { - checkForClosedConnection(); - return productLevel_.databaseProductName_; - } - - public String getDatabaseProductVersion () throws SqlException - { - checkForClosedConnection(); - return productLevel_.databaseProductVersion_; - - } - - public String getDriverName () throws SqlException - { - checkForClosedConnection(); - return Configuration.dncDriverName; - } - - public String getDriverVersion () throws SqlException - { - checkForClosedConnection(); - return Version.getDriverVersion(); - } - - // JDBC signature also does not throw SqlException, so we don't check for closed connection. - public int getDriverMajorVersion () - { - return Version.getMajorVersion(); - } - - // JDBC signature also does not throw SqlException, so we don't check for closed connection. - public int getDriverMinorVersion () - { - return Version.getMinorVersion(); - } - - //All JDBC Drivers must return false for this method. For this reason we choose - //to return FALSE - public boolean supportsMixedCaseIdentifiers () throws SqlException - { - checkForClosedConnection(); - return false; - } - - public boolean supportsMixedCaseQuotedIdentifiers () throws SqlException - { - checkForClosedConnection(); - return true; - } - - public String getIdentifierQuoteString () throws SqlException - { - checkForClosedConnection(); - return "\""; - } - - public boolean supportsColumnAliasing () throws SqlException - { - checkForClosedConnection(); - return true; - } - - public boolean nullPlusNonNullIsNull () throws SqlException - { - checkForClosedConnection(); - return true; - } - - public boolean supportsTableCorrelationNames () throws SqlException - { - checkForClosedConnection(); - return true; - } - - public boolean supportsLikeEscapeClause () throws SqlException - { - checkForClosedConnection(); - return true; - } - - public boolean supportsNonNullableColumns () throws SqlException - { - checkForClosedConnection(); - return true; - } - - public boolean supportsMinimumSQLGrammar () throws SqlException - { - checkForClosedConnection(); - return true; - } - - public boolean supportsANSI92EntryLevelSQL () throws SqlException - { - checkForClosedConnection(); - return true; - } - - public boolean supportsSubqueriesInExists () throws SqlException - { - checkForClosedConnection(); - return true; - } - - public boolean supportsSubqueriesInIns () throws SqlException - { - checkForClosedConnection(); - return true; - } - - public boolean supportsSubqueriesInQuantifieds () throws SqlException - { - checkForClosedConnection(); - return true; - } - - public boolean supportsCorrelatedSubqueries () throws SqlException - { - checkForClosedConnection(); - return true; - } - - - //------------------------catalog query methods follow-------------------------------------------- - - // call stored procedure SQLProcedures - // SYSIBM.SQLProcedures( - // CatalogName varchar(128), - // SchemaName varchar(128), - // ProcName varchar(128), - // Options varchar(4000)) - // - public java.sql.ResultSet getProcedures (String catalog, + private ResultSet getProceduresX(String catalog, + String schemaPattern, + String procedureNamePattern) throws SqlException { + checkForClosedConnection(); + ; + + PreparedStatement cs = prepareMetaDataQuery("SYSIBM.SQLPROCEDURES(?,?,?,?)"); + + cs.setStringX(1, catalog); + cs.setStringX(2, schemaPattern); + cs.setStringX(3, procedureNamePattern); + cs.setStringX(4, getOptions()); + lastGetProceduresResultSet_ = executeCatalogQuery(cs); + return lastGetProceduresResultSet_; + } + + + // call stored procedure SQLProcedureCols + // SYSIBM.SQLProcedureCols( + // CatalogName varchar(128), + // SchemaName varchar(128), + // ProcName varchar(128), + // ParamName varchar(128), + // Options varchar(4000)) + // + public java.sql.ResultSet getProcedureColumns(String catalog, + String schemaPattern, + String procedureNamePattern, + String columnNamePattern) throws SqlException { + synchronized (connection_) { + if (agent_.loggingEnabled()) { + agent_.logWriter_.traceEntry(this, "getProcedureColumns", catalog, schemaPattern, procedureNamePattern, columnNamePattern); + } + return getProcedureColumnsX(catalog, schemaPattern, procedureNamePattern, columnNamePattern); + } + } + + private ResultSet getProcedureColumnsX(String catalog, String schemaPattern, - String procedureNamePattern) throws SqlException - { - synchronized (connection_) { - if (agent_.loggingEnabled()) agent_.logWriter_.traceEntry (this, "getProcedures", catalog, schemaPattern, procedureNamePattern); - return getProceduresX (catalog, schemaPattern, procedureNamePattern); - } - } - - - private ResultSet getProceduresX (String catalog, - String schemaPattern, - String procedureNamePattern) throws SqlException - { - checkForClosedConnection();; - - PreparedStatement cs = prepareMetaDataQuery("SYSIBM.SQLPROCEDURES(?,?,?,?)"); - - cs.setStringX (1, catalog); - cs.setStringX (2, schemaPattern); - cs.setStringX (3, procedureNamePattern); - cs.setStringX (4, getOptions()); - lastGetProceduresResultSet_ = executeCatalogQuery (cs); - return lastGetProceduresResultSet_; - } - - - // call stored procedure SQLProcedureCols - // SYSIBM.SQLProcedureCols( - // CatalogName varchar(128), - // SchemaName varchar(128), - // ProcName varchar(128), - // ParamName varchar(128), - // Options varchar(4000)) - // - public java.sql.ResultSet getProcedureColumns (String catalog, - String schemaPattern, - String procedureNamePattern, - String columnNamePattern) throws SqlException - { - synchronized (connection_) { - if (agent_.loggingEnabled()) agent_.logWriter_.traceEntry (this, "getProcedureColumns", catalog, schemaPattern, procedureNamePattern, columnNamePattern); - return getProcedureColumnsX (catalog, schemaPattern, procedureNamePattern, columnNamePattern); + String procedureNamePattern, + String columnNamePattern) throws SqlException { + checkForClosedConnection(); + ; + + PreparedStatement cs = prepareMetaDataQuery("SYSIBM.SQLPROCEDURECOLS(?,?,?,?,?)"); + + cs.setStringX(1, catalog); + cs.setStringX(2, schemaPattern); + cs.setStringX(3, procedureNamePattern); + cs.setStringX(4, columnNamePattern); + cs.setStringX(5, getOptions()); + lastGetProcedureColumnsResultSet_ = executeCatalogQuery(cs); + return lastGetProcedureColumnsResultSet_; } - } - private ResultSet getProcedureColumnsX (String catalog, - String schemaPattern, - String procedureNamePattern, - String columnNamePattern) throws SqlException - { - checkForClosedConnection();; - - PreparedStatement cs = prepareMetaDataQuery("SYSIBM.SQLPROCEDURECOLS(?,?,?,?,?)"); - - cs.setStringX (1, catalog); - cs.setStringX (2, schemaPattern); - cs.setStringX (3, procedureNamePattern); - cs.setStringX (4, columnNamePattern); - cs.setStringX (5, getOptions()); - lastGetProcedureColumnsResultSet_ = executeCatalogQuery (cs); - return lastGetProcedureColumnsResultSet_; - } - - - // call stored procedure SQLTables - // SYSIBM.SQLTables( - // CatalogName varchar(128), - // SchemaName varchar(128), - // TableName varchar(128), - // TaleType varchar(4000), - // Options varchar(4000)) - // - public java.sql.ResultSet getTables (String catalog, - String schemaPattern, - String tableNamePattern, - String types[]) throws SqlException - { - synchronized (connection_) { - if (agent_.loggingEnabled()) agent_.logWriter_.traceEntry (this, "getTables", catalog, schemaPattern, tableNamePattern, types); - return getTablesX (catalog, schemaPattern, tableNamePattern, types); - } - } - - private ResultSet getTablesX (String catalog, - String schemaPattern, - String tableNamePattern, - String types[]) throws SqlException - { - checkForClosedConnection(); - - PreparedStatement cs = prepareMetaDataQuery ("SYSIBM.SQLTABLES(?,?,?,?,?)"); - - if (catalog == null) cs.setNullX (1, java.sql.Types.VARCHAR); - else cs.setStringX (1, catalog); - - if (schemaPattern == null) cs.setNullX (2, java.sql.Types.VARCHAR); - else cs.setStringX (2, schemaPattern); - - if (tableNamePattern == null) cs.setNullX (3, java.sql.Types.VARCHAR); - else cs.setStringX (3, tableNamePattern); - - String tableTypes = new String(); - int i=0; - if (types == null) - cs.setNullX (4,java.sql.Types.VARCHAR); - else if (types.length == 1 && (types[0].trim()).equals("%")) - cs.setStringX (4, types[0]); - else { - while (i < types.length) { - if (i>0) tableTypes = tableTypes.concat (","); - tableTypes = tableTypes.concat ("'" + types[i] + "'"); - i++; - } - cs.setStringX (4, tableTypes ); - } - cs.setStringX (5, getOptions()); - lastGetTablesResultSet_ = executeCatalogQuery (cs); - return lastGetTablesResultSet_; - } - - // call stored procedure SQLTables - // SYSIBM.SQLTables( - // CatalogName varchar(128), - // SchemaName varchar(128), - // TableName varchar(128), - // TaleType varchar(4000), - // Options varchar(4000)) - // - public java.sql.ResultSet getSchemas () throws SqlException - { - synchronized (connection_) { - if (agent_.loggingEnabled()) agent_.logWriter_.traceEntry (this, "getSchemas"); - return getSchemasX(); - } - } - - private ResultSet getSchemasX () throws SqlException - { - checkForClosedConnection();; - - PreparedStatement cs = prepareMetaDataQuery ("SYSIBM.SQLTABLES('', '', '', '', 'GETSCHEMAS=1')"); - return (ResultSet) cs.executeQueryX(); - } - - - // DERBY does not have the notion of a catalog, so we return a result set with no rows. - public java.sql.ResultSet getCatalogs () throws SqlException - { - synchronized (connection_) { - if (agent_.loggingEnabled()) agent_.logWriter_.traceEntry (this, "getCatalogs"); - return getCatalogsX(); - } - } - - private ResultSet getCatalogsX () throws SqlException - { - checkForClosedConnection(); - - PreparedStatement cs = prepareMetaDataQuery ("SYSIBM.SQLTABLES('', '', '', '', 'GETCATALOGS=1')"); - return (ResultSet) cs.executeQueryX(); - } - - // call stored procedure SQLTables - // SYSIBM.SQLTables( - // CatalogName varchar(128), - // SchemaName varchar(128), - // TableName varchar(128), - // TableType varchar(4000), - // Options varchar(4000)) - public java.sql.ResultSet getTableTypes () throws SqlException - { - synchronized (connection_) { - if (agent_.loggingEnabled()) agent_.logWriter_.traceEntry (this, "getTableTypes"); - return getTableTypesX(); - } - } - - private ResultSet getTableTypesX () throws SqlException - { - checkForClosedConnection();; - - PreparedStatement cs = null; - cs = prepareMetaDataQuery("SYSIBM.SQLTABLES(?,?,?,?,?)"); - - cs.setStringX (1, ""); - cs.setStringX (2, ""); - cs.setStringX (3, ""); - cs.setStringX (4, "%"); - int cursorHold; - if (connection_.resultSetHoldability_ == ClientDataSource.HOLD_CURSORS_OVER_COMMIT) - cursorHold = 1; - else - cursorHold = 0; - cs.setStringX (5, "DATATYPE='JDBC';GETTABLETYPES=1; CURSORHOLD="+cursorHold); - lastGetTablesResultSet_ = executeCatalogQuery (cs); - return lastGetTablesResultSet_; - } - - - // call stored procedure SQLColumns - // SYSIBM.SQLColumns( - // CatalogName varchar(128), - // SchemaName varchar(128), - // TableName varchar(128), - // ColumnName varchar(128), - // Options varchar(4000)) - // - public java.sql.ResultSet getColumns (String catalog, + + // call stored procedure SQLTables + // SYSIBM.SQLTables( + // CatalogName varchar(128), + // SchemaName varchar(128), + // TableName varchar(128), + // TaleType varchar(4000), + // Options varchar(4000)) + // + public java.sql.ResultSet getTables(String catalog, String schemaPattern, String tableNamePattern, - String columnNamePattern) throws SqlException - { - synchronized (connection_) { - if (agent_.loggingEnabled()) agent_.logWriter_.traceEntry (this, "getColumns", catalog, schemaPattern, tableNamePattern, columnNamePattern); - checkForClosedConnection(); - return getColumnsX (catalog, schemaPattern, tableNamePattern, columnNamePattern); + String types[]) throws SqlException { + synchronized (connection_) { + if (agent_.loggingEnabled()) { + agent_.logWriter_.traceEntry(this, "getTables", catalog, schemaPattern, tableNamePattern, types); + } + return getTablesX(catalog, schemaPattern, tableNamePattern, types); + } } - } - private ResultSet getColumnsX (String catalog, - String schemaPattern, - String tableNamePattern, - String columnNamePattern) throws SqlException - { - checkForClosedConnection(); - - PreparedStatement cs = prepareMetaDataQuery("SYSIBM.SQLCOLUMNS(?,?,?,?,?)"); - - cs.setStringX (1, catalog); - cs.setStringX (2, schemaPattern); - cs.setStringX (3, tableNamePattern); - cs.setStringX (4, columnNamePattern); //Always null for JDBC - cs.setStringX (5, getOptions()); - lastGetColumnsResultSet_ = executeCatalogQuery (cs); - return lastGetColumnsResultSet_; - } - - - // call stored procedure SQLColumnPrivileges - // SYSIBM.SQLColPrivileges( - // CatalogName varchar(128), - // SchemaName varchar(128), - // TableName varchar(128), - // ColumnName varchar(128), - // Options varchar(4000)) - // - public java.sql.ResultSet getColumnPrivileges (String catalog, - String schema, - String table, - String columnNamePattern) throws SqlException - { - synchronized (connection_) { - if (agent_.loggingEnabled()) agent_.logWriter_.traceEntry (this, "getColumnPrivileges", catalog, schema, table, columnNamePattern); - return getColumnPrivilegesX (catalog, schema, table, columnNamePattern); - } - } - - private ResultSet getColumnPrivilegesX (String catalog, - String schema, - String table, - String columnNamePattern) throws SqlException - { - checkForClosedConnection(); - // check input params, table and columnNamePattern cannot be null - if ( table == null ) { - throw new SqlException (agent_.logWriter_, "getColumnPrivileges(): null not allowed for table name" ); - } - - PreparedStatement cs = prepareMetaDataQuery("SYSIBM.SQLCOLPRIVILEGES(?,?,?,?,?)"); - - cs.setStringX (1, catalog); - cs.setStringX (2, schema); - cs.setStringX (3, table); - cs.setStringX (4, columnNamePattern); - cs.setStringX (5, getOptions()); - lastGetColumnPrivilegesResultSet_ = executeCatalogQuery (cs); - return lastGetColumnPrivilegesResultSet_; - } - - - // call stored procedure SQLTablePrivileges - // SYSIBM.SQLTablePrivileges( - // CatalogName varchar(128), - // SchemaName varchar(128), - // TableName varchar(128), - // Options varchar(4000)) - // - public java.sql.ResultSet getTablePrivileges (String catalog, - String schemaPattern, - String tableNamePattern) throws SqlException - { - synchronized (connection_) { - if (agent_.loggingEnabled()) agent_.logWriter_.traceEntry (this, "getTablePrivileges", catalog, schemaPattern, tableNamePattern); - return getTablePrivilegesX (catalog, schemaPattern, tableNamePattern); + private ResultSet getTablesX(String catalog, + String schemaPattern, + String tableNamePattern, + String types[]) throws SqlException { + checkForClosedConnection(); + + PreparedStatement cs = prepareMetaDataQuery("SYSIBM.SQLTABLES(?,?,?,?,?)"); + + if (catalog == null) { + cs.setNullX(1, java.sql.Types.VARCHAR); + } else { + cs.setStringX(1, catalog); + } + + if (schemaPattern == null) { + cs.setNullX(2, java.sql.Types.VARCHAR); + } else { + cs.setStringX(2, schemaPattern); + } + + if (tableNamePattern == null) { + cs.setNullX(3, java.sql.Types.VARCHAR); + } else { + cs.setStringX(3, tableNamePattern); + } + + String tableTypes = new String(); + int i = 0; + if (types == null) { + cs.setNullX(4, java.sql.Types.VARCHAR); + } else if (types.length == 1 && (types[0].trim()).equals("%")) { + cs.setStringX(4, types[0]); + } else { + while (i < types.length) { + if (i > 0) { + tableTypes = tableTypes.concat(","); + } + tableTypes = tableTypes.concat("'" + types[i] + "'"); + i++; + } + cs.setStringX(4, tableTypes); + } + cs.setStringX(5, getOptions()); + lastGetTablesResultSet_ = executeCatalogQuery(cs); + return lastGetTablesResultSet_; + } + + // call stored procedure SQLTables + // SYSIBM.SQLTables( + // CatalogName varchar(128), + // SchemaName varchar(128), + // TableName varchar(128), + // TaleType varchar(4000), + // Options varchar(4000)) + // + public java.sql.ResultSet getSchemas() throws SqlException { + synchronized (connection_) { + if (agent_.loggingEnabled()) { + agent_.logWriter_.traceEntry(this, "getSchemas"); + } + return getSchemasX(); + } + } + + private ResultSet getSchemasX() throws SqlException { + checkForClosedConnection(); + ; + + PreparedStatement cs = prepareMetaDataQuery("SYSIBM.SQLTABLES('', '', '', '', 'GETSCHEMAS=1')"); + return (ResultSet) cs.executeQueryX(); + } + + + // DERBY does not have the notion of a catalog, so we return a result set with no rows. + public java.sql.ResultSet getCatalogs() throws SqlException { + synchronized (connection_) { + if (agent_.loggingEnabled()) { + agent_.logWriter_.traceEntry(this, "getCatalogs"); + } + return getCatalogsX(); + } + } + + private ResultSet getCatalogsX() throws SqlException { + checkForClosedConnection(); + + PreparedStatement cs = prepareMetaDataQuery("SYSIBM.SQLTABLES('', '', '', '', 'GETCATALOGS=1')"); + return (ResultSet) cs.executeQueryX(); + } + + // call stored procedure SQLTables + // SYSIBM.SQLTables( + // CatalogName varchar(128), + // SchemaName varchar(128), + // TableName varchar(128), + // TableType varchar(4000), + // Options varchar(4000)) + public java.sql.ResultSet getTableTypes() throws SqlException { + synchronized (connection_) { + if (agent_.loggingEnabled()) { + agent_.logWriter_.traceEntry(this, "getTableTypes"); + } + return getTableTypesX(); + } + } + + private ResultSet getTableTypesX() throws SqlException { + checkForClosedConnection(); + ; + + PreparedStatement cs = null; + cs = prepareMetaDataQuery("SYSIBM.SQLTABLES(?,?,?,?,?)"); + + cs.setStringX(1, ""); + cs.setStringX(2, ""); + cs.setStringX(3, ""); + cs.setStringX(4, "%"); + int cursorHold; + if (connection_.resultSetHoldability_ == ClientDataSource.HOLD_CURSORS_OVER_COMMIT) { + cursorHold = 1; + } else { + cursorHold = 0; + } + cs.setStringX(5, "DATATYPE='JDBC';GETTABLETYPES=1; CURSORHOLD=" + cursorHold); + lastGetTablesResultSet_ = executeCatalogQuery(cs); + return lastGetTablesResultSet_; } - } - private ResultSet getTablePrivilegesX (String catalog, + + // call stored procedure SQLColumns + // SYSIBM.SQLColumns( + // CatalogName varchar(128), + // SchemaName varchar(128), + // TableName varchar(128), + // ColumnName varchar(128), + // Options varchar(4000)) + // + public java.sql.ResultSet getColumns(String catalog, String schemaPattern, - String tableNamePattern) throws SqlException - { - checkForClosedConnection();; - - PreparedStatement cs = prepareMetaDataQuery("SYSIBM.SQLTABLEPRIVILEGES(?,?,?,?)"); - - cs.setStringX (1, catalog); - cs.setStringX (2, schemaPattern); - cs.setStringX (3, tableNamePattern);
[... 1572 lines stripped ...]