databasemetadata.java

来自「《移动Agent技术》一书的所有章节源代码。」· Java 代码 · 共 1,815 行 · 第 1/5 页

JAVA
1,815
字号
/*
 * @(#)DatabaseMetaData.java	1.8 97/02/11
 * 
 * Copyright (c) 1995, 1996 Sun Microsystems, Inc. All Rights Reserved.
 * 
 * This software is the confidential and proprietary information of Sun
 * Microsystems, Inc. ("Confidential Information").  You shall not
 * disclose such Confidential Information and shall use it only in
 * accordance with the terms of the license agreement you entered into
 * with Sun.
 * 
 * SUN MAKES NO REPRESENTATIONS OR WARRANTIES ABOUT THE SUITABILITY OF THE
 * SOFTWARE, EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
 * IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
 * PURPOSE, OR NON-INFRINGEMENT. SUN SHALL NOT BE LIABLE FOR ANY DAMAGES
 * SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR DISTRIBUTING
 * THIS SOFTWARE OR ITS DERIVATIVES.
 * 
 * CopyrightVersion 1.1_beta
 * 
 */


package java.sql;

/**
 * This class provides information about the database as a whole.
 *
 * <P>Many of the methods here return lists of information in ResultSets.
 * You can use the normal ResultSet methods such as getString and getInt 
 * to retrieve the data from these ResultSets.  If a given form of
 * metadata is not available, these methods should throw a SQLException.
 *
 * <P>Some of these methods take arguments that are String patterns.  These
 * arguments all have names such as fooPattern.  Within a pattern String, "%"
 * means match any substring of 0 or more characters, and "_" means match
 * any one character. Only metadata entries matching the search pattern 
 * are returned. If a search pattern argument is set to a null ref, it means 
 * that argument's criteria should be dropped from the search.
 * 
 * <P>A SQLException will be thrown if a driver does not support a meta
 * data method.  In the case of methods that return a ResultSet,
 * either a ResultSet (which may be empty) is returned or a
 * SQLException is thrown.
 */
public interface DatabaseMetaData {

    //----------------------------------------------------------------------
	// First, a variety of minor information about the target database.

    /**
     * Can all the procedures returned by getProcedures be called by the
     * current user?
     *
     * @return true if so
     * @exception SQLException if a database-access error occurs.
     */
	boolean allProceduresAreCallable() throws SQLException;

    /**
     * Can all the tables returned by getTable be SELECTed by the
     * current user?
     *
     * @return true if so 
     * @exception SQLException if a database-access error occurs.
     */
	boolean allTablesAreSelectable() throws SQLException;

    /**
     * What's the url for this database?
     *
     * @return the url or null if it can't be generated
     * @exception SQLException if a database-access error occurs.
     */
	String getURL() throws SQLException;

    /**
     * What's our user name as known to the database?
     *
     * @return our database user name
     * @exception SQLException if a database-access error occurs.
     */
	String getUserName() throws SQLException;

    /**
     * Is the database in read-only mode?
     *
     * @return true if so
     * @exception SQLException if a database-access error occurs.
     */
	boolean isReadOnly() throws SQLException;

    /**
     * Are NULL values sorted high?
     *
     * @return true if so
     * @exception SQLException if a database-access error occurs.
     */
	boolean nullsAreSortedHigh() throws SQLException;

    /**
     * Are NULL values sorted low?
     *
     * @return true if so
     * @exception SQLException if a database-access error occurs.
     */
	boolean nullsAreSortedLow() throws SQLException;

    /**
     * Are NULL values sorted at the start regardless of sort order?
     *
     * @return true if so 
     * @exception SQLException if a database-access error occurs.
     */
	boolean nullsAreSortedAtStart() throws SQLException;

    /**
     * Are NULL values sorted at the end regardless of sort order?
     *
     * @return true if so
     * @exception SQLException if a database-access error occurs.
     */
	boolean nullsAreSortedAtEnd() throws SQLException;

    /**
     * What's the name of this database product?
     *
     * @return database product name
     * @exception SQLException if a database-access error occurs.
     */
	String getDatabaseProductName() throws SQLException;

    /**
     * What's the version of this database product?
     *
     * @return database version
     * @exception SQLException if a database-access error occurs.
     */
	String getDatabaseProductVersion() throws SQLException;

    /**
     * What's the name of this JDBC driver?
     *
     * @return JDBC driver name
     * @exception SQLException if a database-access error occurs.
     */
	String getDriverName() throws SQLException;

    /**
     * What's the version of this JDBC driver?
     *
     * @return JDBC driver version
     * @exception SQLException if a database-access error occurs.
     */
	String getDriverVersion() throws SQLException;

    /**
     * What's this JDBC driver's major version number?
     *
     * @return JDBC driver major version
     */
	int getDriverMajorVersion();

    /**
     * What's this JDBC driver's minor version number?
     *
     * @return JDBC driver minor version number
     */
	int getDriverMinorVersion();

    /**
     * Does the database store tables in a local file?
     *
     * @return true if so
     * @exception SQLException if a database-access error occurs.
     */
	boolean usesLocalFiles() throws SQLException;

    /**
     * Does the database use a file for each table?
     *
     * @return true if the database uses a local file for each table
     * @exception SQLException if a database-access error occurs.
     */
	boolean usesLocalFilePerTable() throws SQLException;

    /**
     * Does the database treat mixed case unquoted SQL identifiers as
     * case sensitive and as a result store them in mixed case?
     *
     * A JDBC-Compliant driver will always return false.
     *
     * @return true if so 
     * @exception SQLException if a database-access error occurs.
     */
	boolean supportsMixedCaseIdentifiers() throws SQLException;

    /**
     * Does the database treat mixed case unquoted SQL identifiers as
     * case insensitive and store them in upper case?
     *
     * @return true if so 
     * @exception SQLException if a database-access error occurs.
     */
	boolean storesUpperCaseIdentifiers() throws SQLException;

    /**
     * Does the database treat mixed case unquoted SQL identifiers as
     * case insensitive and store them in lower case?
     *
     * @return true if so 
     * @exception SQLException if a database-access error occurs.
     */
	boolean storesLowerCaseIdentifiers() throws SQLException;

    /**
     * Does the database treat mixed case unquoted SQL identifiers as
     * case insensitive and store them in mixed case?
     *
     * @return true if so 
     * @exception SQLException if a database-access error occurs.
     */
	boolean storesMixedCaseIdentifiers() throws SQLException;

    /**
     * Does the database treat mixed case quoted SQL identifiers as
     * case sensitive and as a result store them in mixed case?
     *
     * A JDBC-Compliant driver will always return true.
     *
     * @return true if so
     * @exception SQLException if a database-access error occurs.
     */
	boolean supportsMixedCaseQuotedIdentifiers() throws SQLException;

    /**
     * Does the database treat mixed case quoted SQL identifiers as
     * case insensitive and store them in upper case?
     *
     * @return true if so 
     * @exception SQLException if a database-access error occurs.
     */
	boolean storesUpperCaseQuotedIdentifiers() throws SQLException;

    /**
     * Does the database treat mixed case quoted SQL identifiers as
     * case insensitive and store them in lower case?
     *
     * @return true if so 
     * @exception SQLException if a database-access error occurs.
     */
	boolean storesLowerCaseQuotedIdentifiers() throws SQLException;

    /**
     * Does the database treat mixed case quoted SQL identifiers as
     * case insensitive and store them in mixed case?
     *
     * @return true if so 
     * @exception SQLException if a database-access error occurs.
     */
	boolean storesMixedCaseQuotedIdentifiers() throws SQLException;

    /**
     * What's the string used to quote SQL identifiers?
     * This returns a space " " if identifier quoting isn't supported.
     *
     * A JDBC-Compliant driver always uses a double quote character.
     *
     * @return the quoting string
     * @exception SQLException if a database-access error occurs.
     */
	String getIdentifierQuoteString() throws SQLException;

    /**
     * Get a comma separated list of all a database's SQL keywords
     * that are NOT also SQL92 keywords.
     *
     * @return the list 
     * @exception SQLException if a database-access error occurs.
     */
	String getSQLKeywords() throws SQLException;

    /**
     * Get a comma separated list of math functions.
     *
     * @return the list
     * @exception SQLException if a database-access error occurs.
     */
	String getNumericFunctions() throws SQLException;

    /**
     * Get a comma separated list of string functions.
     *
     * @return the list
     * @exception SQLException if a database-access error occurs.
     */
	String getStringFunctions() throws SQLException;

    /**
     * Get a comma separated list of system functions.
     *
     * @return the list
     * @exception SQLException if a database-access error occurs.
     */
	String getSystemFunctions() throws SQLException;

    /**
     * Get a comma separated list of time and date functions.
     *
     * @return the list
     * @exception SQLException if a database-access error occurs.
     */
	String getTimeDateFunctions() throws SQLException;

    /**
     * This is the string that can be used to escape '_' or '%' in
     * the string pattern style catalog search parameters.
     *
     * <P>The '_' character represents any single character.
     * <P>The '%' character represents any sequence of zero or 
     * more characters.
     *
     * @return the string used to escape wildcard characters
     * @exception SQLException if a database-access error occurs.
     */
	String getSearchStringEscape() throws SQLException;

    /**
     * Get all the "extra" characters that can be used in unquoted
     * identifier names (those beyond a-z, A-Z, 0-9 and _).
     *
     * @return the string containing the extra characters 
     * @exception SQLException if a database-access error occurs.
     */
	String getExtraNameCharacters() throws SQLException;

    //--------------------------------------------------------------------
    // Functions describing which features are supported.

    /**
     * Is "ALTER TABLE" with add column supported?
     *
     * @return true if so
     * @exception SQLException if a database-access error occurs.
     */
	boolean supportsAlterTableWithAddColumn() throws SQLException;

    /**
     * Is "ALTER TABLE" with drop column supported?
     *
     * @return true if so
     * @exception SQLException if a database-access error occurs.
     */
	boolean supportsAlterTableWithDropColumn() throws SQLException;

    /**
     * Is column aliasing supported? 
     *
     * <P>If so, the SQL AS clause can be used to provide names for
     * computed columns or to provide alias names for columns as
     * required.
     *
     * A JDBC-Compliant driver always returns true.

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?