/*
* @(#)DatabaseMetaData.java 1.52 03/01/23
*
* Copyright 2003 Sun Microsystems, Inc. All rights reserved.
* SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
*/
package java.sql;
/**
* Comprehensive information about the database as a whole.
* <P>
* This interface is implemented by driver vendors to let users know the capabilities
* of a Database Management System (DBMS) in combination with
* the driver based on JDBC<sup><font size=-2>TM</font></sup> technology
* ("JDBC driver") that is used with it. Different relational DBMSs often support
* different features, implement features in different ways, and use different
* data types. In addition, a driver may implement a feature on top of what the
* DBMS offers. Information returned by methods in this interface applies
* to the capabilities of a particular driver and a particular DBMS working
* together. Note that as used in this documentation, the term "database" is
* used generically to refer to both the driver and DBMS.
* <P>
* A user for this interface is commonly a tool that needs to discover how to
* deal with the underlying DBMS. This is especially true for applications
* that are intended to be used with more than one DBMS. For example, a tool might use the method
* <code>getTypeInfo</code> to find out what data types can be used in a
* <code>CREATE TABLE</code> statement. Or a user might call the method
* <code>supportsCorrelatedSubqueries</code> to see if it is possible to use
* a correlated subquery or <code>supportsBatchUpdates</code> to see if it is
* possible to use batch updates.
* <P>
* Some <code>DatabaseMetaData</code> methods return lists of information
* in the form of <code>ResultSet</code> objects.
* Regular <code>ResultSet</code> methods, such as
* <code>getString</code> and <code>getInt</code>, can be used
* to retrieve the data from these <code>ResultSet</code> objects. If
* a given form of metadata is not available, the <code>ResultSet</code>
* getter methods throw an <code>SQLException</code>.
* <P>
* Some <code>DatabaseMetaData</code> 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 <code>null</code>, that argument's criterion will
* be dropped from the search.
* <P>
* A method that gets information about a feature that the driver does not
* support will throw an <code>SQLException</code>.
* In the case of methods that return a <code>ResultSet</code>
* object, either a <code>ResultSet</code> object (which may be empty) is
* returned or an <code>SQLException</code> is thrown.
*/
public interface DatabaseMetaData {
//----------------------------------------------------------------------
// First, a variety of minor information about the target database.
/**
* Retrieves whether the current user can call all the procedures
* returned by the method <code>getProcedures</code>.
*
* @return <code>true</code> if so; <code>false</code> otherwise
* @exception SQLException if a database access error occurs
*/
boolean allProceduresAreCallable() throws SQLException;
/**
* Retrieves whether the current user can use all the tables returned
* by the method <code>getTables</code> in a <code>SELECT</code>
* statement.
*
* @return <code>true</code> if so; <code>false</code> otherwise
* @exception SQLException if a database access error occurs
*/
boolean allTablesAreSelectable() throws SQLException;
/**
* Retrieves the URL for this DBMS.
*
* @return the URL for this DBMS or <code>null</code> if it cannot be
* generated
* @exception SQLException if a database access error occurs
*/
String getURL() throws SQLException;
/**
* Retrieves the user name as known to this database.
*
* @return the database user name
* @exception SQLException if a database access error occurs
*/
String getUserName() throws SQLException;
/**
* Retrieves whether this database is in read-only mode.
*
* @return <code>true</code> if so; <code>false</code> otherwise
* @exception SQLException if a database access error occurs
*/
boolean isReadOnly() throws SQLException;
/**
* Retrieves whether <code>NULL</code> values are sorted high.
* Sorted high means that <code>NULL</code> values
* sort higher than any other value in a domain. In an ascending order,
* if this method returns <code>true</code>, <code>NULL</code> values
* will appear at the end. By contrast, the method
* <code>nullsAreSortedAtEnd</code> indicates whether <code>NULL</code> values
* are sorted at the end regardless of sort order.
*
* @return <code>true</code> if so; <code>false</code> otherwise
* @exception SQLException if a database access error occurs
*/
boolean nullsAreSortedHigh() throws SQLException;
/**
* Retrieves whether <code>NULL</code> values are sorted low.
* Sorted low means that <code>NULL</code> values
* sort lower than any other value in a domain. In an ascending order,
* if this method returns <code>true</code>, <code>NULL</code> values
* will appear at the beginning. By contrast, the method
* <code>nullsAreSortedAtStart</code> indicates whether <code>NULL</code> values
* are sorted at the beginning regardless of sort order.
*
* @return <code>true</code> if so; <code>false</code> otherwise
* @exception SQLException if a database access error occurs
*/
boolean nullsAreSortedLow() throws SQLException;
/**
* Retrieves whether <code>NULL</code> values are sorted at the start regardless
* of sort order.
*
* @return <code>true</code> if so; <code>false</code> otherwise
* @exception SQLException if a database access error occurs
*/
boolean nullsAreSortedAtStart() throws SQLException;
/**
* Retrieves whether <code>NULL</code> values are sorted at the end regardless of
* sort order.
*
* @return <code>true</code> if so; <code>false</code> otherwise
* @exception SQLException if a database access error occurs
*/
boolean nullsAreSortedAtEnd() throws SQLException;
/**
* Retrieves the name of this database product.
*
* @return database product name
* @exception SQLException if a database access error occurs
*/
String getDatabaseProductName() throws SQLException;
/**
* Retrieves the version number of this database product.
*
* @return database version number
* @exception SQLException if a database access error occurs
*/
String getDatabaseProductVersion() throws SQLException;
/**
* Retrieves the name of this JDBC driver.
*
* @return JDBC driver name
* @exception SQLException if a database access error occurs
*/
String getDriverName() throws SQLException;
/**
* Retrieves the version number of this JDBC driver as a <code>String</code>.
*
* @return JDBC driver version
* @exception SQLException if a database access error occurs
*/
String getDriverVersion() throws SQLException;
/**
* Retrieves this JDBC driver's major version number.
*
* @return JDBC driver major version
*/
int getDriverMajorVersion();
/**
* Retrieves this JDBC driver's minor version number.
*
* @return JDBC driver minor version number
*/
int getDriverMinorVersion();
/**
* Retrieves whether this database stores tables in a local file.
*
* @return <code>true</code> if so; <code>false</code> otherwise
*