Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

com.mysql.jdbc
Class DatabaseMetaData  view DatabaseMetaData download DatabaseMetaData.java

java.lang.Object
  extended bycom.mysql.jdbc.DatabaseMetaData
All Implemented Interfaces:
java.sql.DatabaseMetaData

public class DatabaseMetaData
extends java.lang.Object
implements java.sql.DatabaseMetaData

JDBC Interface to Mysql functions

This class provides information about the database as a whole.

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 show throw a java.sql.SQLException.

Some of these methods take arguments that are String patterns. These methods 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.

Version:
$Id: DatabaseMetaData.java,v 1.27.2.44 2004/09/30 07:35:03 mmatthew Exp $

Field Summary
private  Connection conn
          The connection to the database
private  java.lang.String database
          The 'current' database name being used
private static int DEFERRABILITY
           
private static int DELETE_RULE
           
private static int FK_NAME
           
private static int FKCOLUMN_NAME
           
private static int FKTABLE_CAT
           
private static int FKTABLE_NAME
           
private static int FKTABLE_SCHEM
           
private static int KEY_SEQ
           
private static int PK_NAME
           
private static int PKCOLUMN_NAME
           
private static int PKTABLE_CAT
           
private static int PKTABLE_NAME
           
private static int PKTABLE_SCHEM
           
private  java.lang.String quotedId
          What character to use when quoting identifiers
private static java.lang.String SUPPORTS_FK
          The table type for generic tables that support foreign keys.
private static byte[] TABLE_AS_BYTES
           
private static int UPDATE_RULE
           
 
Fields inherited from interface java.sql.DatabaseMetaData
attributeNoNulls, attributeNullable, attributeNullableUnknown, bestRowNotPseudo, bestRowPseudo, bestRowSession, bestRowTemporary, bestRowTransaction, bestRowUnknown, columnNoNulls, columnNullable, columnNullableUnknown, importedKeyCascade, importedKeyInitiallyDeferred, importedKeyInitiallyImmediate, importedKeyNoAction, importedKeyNotDeferrable, importedKeyRestrict, importedKeySetDefault, importedKeySetNull, procedureColumnIn, procedureColumnInOut, procedureColumnOut, procedureColumnResult, procedureColumnReturn, procedureColumnUnknown, procedureNoNulls, procedureNoResult, procedureNullable, procedureNullableUnknown, procedureResultUnknown, procedureReturnsResult, sqlStateSQL99, sqlStateXOpen, tableIndexClustered, tableIndexHashed, tableIndexOther, tableIndexStatistic, typeNoNulls, typeNullable, typeNullableUnknown, typePredBasic, typePredChar, typePredNone, typeSearchable, versionColumnNotPseudo, versionColumnPseudo, versionColumnUnknown
 
Constructor Summary
DatabaseMetaData(Connection conn, java.lang.String database)
          Creates a new DatabaseMetaData object.
 
Method Summary
 boolean allProceduresAreCallable()
          Can all the procedures returned by getProcedures be called by the current user?
 boolean allTablesAreSelectable()
          Can all the tables returned by getTable be SELECTed by the current user?
private  java.sql.ResultSet buildResultSet(Field[] fields, java.util.ArrayList rows)
           
 boolean dataDefinitionCausesTransactionCommit()
          Does a data definition statement within a transaction force the transaction to commit?
 boolean dataDefinitionIgnoredInTransactions()
          Is a data definition statement within a transaction ignored?
 boolean deletesAreDetected(int type)
          JDBC 2.0 Determine whether or not a visible row delete can be detected by calling ResultSet.rowDeleted().
 boolean doesMaxRowSizeIncludeBlobs()
          Did getMaxRowSize() include LONGVARCHAR and LONGVARBINARY blobs?
 java.util.List extractForeignKeyForTable(java.util.ArrayList rows, java.sql.ResultSet rs, java.lang.String catalog)
          Extracts foreign key info for one table.
 java.sql.ResultSet extractForeignKeyFromCreateTable(java.sql.Connection conn, java.sql.DatabaseMetaData metadata, java.lang.String catalog, java.lang.String tableName)
          Creates a result set similar enough to 'SHOW TABLE STATUS' to allow the same code to work on extracting the foreign key data
 java.sql.ResultSet getAttributes(java.lang.String arg0, java.lang.String arg1, java.lang.String arg2, java.lang.String arg3)
           
 java.sql.ResultSet getBestRowIdentifier(java.lang.String catalog, java.lang.String schema, java.lang.String table, int scope, boolean nullable)
          Get a description of a table's optimal set of columns that uniquely identifies a row.
private  int getCascadeDeleteOption(java.lang.String cascadeOptions)
          Parses the cascade option string and returns the DBMD constant that represents it (for deletes)
private  int getCascadeUpdateOption(java.lang.String cascadeOptions)
          Parses the cascade option string and returns the DBMD constant that represents it (for Updates)
 java.sql.ResultSet getCatalogs()
          Get the catalog names available in this database.
 java.lang.String getCatalogSeparator()
          What's the separator between catalog and table name?
 java.lang.String getCatalogTerm()
          What's the database vendor's preferred term for "catalog"?
 java.sql.ResultSet getColumnPrivileges(java.lang.String catalog, java.lang.String schema, java.lang.String table, java.lang.String columnNamePattern)
          Get a description of the access rights for a table's columns.
 java.sql.ResultSet getColumns(java.lang.String catalog, java.lang.String schemaPattern, java.lang.String tableName, java.lang.String columnNamePattern)
          Get a description of table columns available in a catalog.
 java.sql.Connection getConnection()
          JDBC 2.0 Return the connection that produced this metadata object.
 java.sql.ResultSet getCrossReference(java.lang.String primaryCatalog, java.lang.String primarySchema, java.lang.String primaryTable, java.lang.String foreignCatalog, java.lang.String foreignSchema, java.lang.String foreignTable)
          Get a description of the foreign key columns in the foreign key table that reference the primary key columns of the primary key table (describe how one table imports another's key.) This should normally return a single foreign key/primary key pair (most tables only import a foreign key from a table once.) They are ordered by FKTABLE_CAT, FKTABLE_SCHEM, FKTABLE_NAME, and KEY_SEQ.
 int getDatabaseMajorVersion()
          This method returns the major version number of the database.
 int getDatabaseMinorVersion()
          This method returns the minor version number of the database.
 java.lang.String getDatabaseProductName()
          What's the name of this database product?
 java.lang.String getDatabaseProductVersion()
          What's the version of this database product?
 int getDefaultTransactionIsolation()
          What's the database's default transaction isolation level? The values are defined in java.sql.Connection.
 int getDriverMajorVersion()
          What's this JDBC driver's major version number?
 int getDriverMinorVersion()
          What's this JDBC driver's minor version number?
 java.lang.String getDriverName()
          What's the name of this JDBC driver?
 java.lang.String getDriverVersion()
          What's the version of this JDBC driver?
 java.sql.ResultSet getExportedKeys(java.lang.String catalog, java.lang.String schema, java.lang.String table)
          Get a description of a foreign key columns that reference a table's primary key columns (the foreign keys exported by a table).
private  void getExportKeyResults(java.lang.String catalog, java.lang.String exportingTable, java.lang.String keysComment, java.util.List tuples, java.lang.String fkTableName)
          Adds to the tuples list the exported keys of exportingTable based on the keysComment from the 'show table status' sql command.
 java.lang.String getExtraNameCharacters()
          Get all the "extra" characters that can be used in unquoted identifier names (those beyond a-z, 0-9 and _).
private  int[] getForeignKeyActions(java.lang.String commentString)
          Returns the DELETE and UPDATE foreign key actions from the given 'SHOW TABLE STATUS' string, with the DELETE action being the first item in the array, and the UPDATE action being the second.
 java.lang.String getIdentifierQuoteString()
          What's the string used to quote SQL identifiers? This returns a space " " if identifier quoting isn't supported.
 java.sql.ResultSet getImportedKeys(java.lang.String catalog, java.lang.String schema, java.lang.String table)
          Get a description of the primary key columns that are referenced by a table's foreign key columns (the primary keys imported by a table).
private  void getImportKeyResults(java.lang.String catalog, java.lang.String importingTable, java.lang.String keysComment, java.util.List tuples)
          Populates the tuples list with the imported keys of importingTable based on the keysComment from the 'show table status' sql command.
 java.sql.ResultSet getIndexInfo(java.lang.String catalog, java.lang.String schema, java.lang.String table, boolean unique, boolean approximate)
          Get a description of a table's indices and statistics.
 int getJDBCMajorVersion()
          This method returns the major version number of the JDBC driver.
 int getJDBCMinorVersion()
          This method returns the minor version number of the JDBC driver.
 int getMaxBinaryLiteralLength()
          How many hex characters can you have in an inline binary literal?
 int getMaxCatalogNameLength()
          What's the maximum length of a catalog name?
 int getMaxCharLiteralLength()
          What's the max length for a character literal?
 int getMaxColumnNameLength()
          What's the limit on column name length?
 int getMaxColumnsInGroupBy()
          What's the maximum number of columns in a "GROUP BY" clause?
 int getMaxColumnsInIndex()
          What's the maximum number of columns allowed in an index?
 int getMaxColumnsInOrderBy()
          What's the maximum number of columns in an "ORDER BY" clause?
 int getMaxColumnsInSelect()
          What's the maximum number of columns in a "SELECT" list?
 int getMaxColumnsInTable()
          What's maximum number of columns in a table?
 int getMaxConnections()
          How many active connections can we have at a time to this database?
 int getMaxCursorNameLength()
          What's the maximum cursor name length?
 int getMaxIndexLength()
          What's the maximum length of an index (in bytes)?
 int getMaxProcedureNameLength()
          What's the maximum length of a procedure name?
 int getMaxRowSize()
          What's the maximum length of a single row?
 int getMaxSchemaNameLength()
          What's the maximum length allowed for a schema name?
 int getMaxStatementLength()
          What's the maximum length of a SQL statement?
 int getMaxStatements()
          How many active statements can we have open at one time to this database?
 int getMaxTableNameLength()
          What's the maximum length of a table name?
 int getMaxTablesInSelect()
          What's the maximum number of tables in a SELECT?
 int getMaxUserNameLength()
          What's the maximum length of a user name?
 java.lang.String getNumericFunctions()
          Get a comma separated list of math functions.
 java.sql.ResultSet getPrimaryKeys(java.lang.String catalog, java.lang.String schema, java.lang.String table)
          Get a description of a table's primary key columns.
 java.sql.ResultSet getProcedureColumns(java.lang.String catalog, java.lang.String schemaPattern, java.lang.String procedureNamePattern, java.lang.String columnNamePattern)
          Get a description of a catalog's stored procedure parameters and result columns.
 java.sql.ResultSet getProcedures(java.lang.String catalog, java.lang.String schemaPattern, java.lang.String procedureNamePattern)
          Get a description of stored procedures available in a catalog.
 java.lang.String getProcedureTerm()
          What's the database vendor's preferred term for "procedure"?
 int getResultSetHoldability()
          This method returns the default holdability type of ResultSetS retrieved from this database.
private  void getResultsImpl(java.lang.String catalog, java.lang.String table, java.lang.String keysComment, java.util.List tuples, java.lang.String fkTableName, boolean isExport)
           
 java.sql.ResultSet getSchemas()
          Get the schema names available in this database.
 java.lang.String getSchemaTerm()
          What's the database vendor's preferred term for "schema"?
 java.lang.String getSearchStringEscape()
          This is the string that can be used to escape '_' or '%' in the string pattern style catalog search parameters.
 java.lang.String getSQLKeywords()
          Get a comma separated list of all a database's SQL keywords that are NOT also SQL92 keywords.
 int getSQLStateType()
           
 java.lang.String getStringFunctions()
          Get a comma separated list of string functions.
 java.sql.ResultSet getSuperTables(java.lang.String arg0, java.lang.String arg1, java.lang.String arg2)
           
 java.sql.ResultSet getSuperTypes(java.lang.String arg0, java.lang.String arg1, java.lang.String arg2)
           
 java.lang.String getSystemFunctions()
          Get a comma separated list of system functions.
private  java.lang.String getTableNameWithCase(java.lang.String table)
           
 java.sql.ResultSet getTablePrivileges(java.lang.String catalog, java.lang.String schemaPattern, java.lang.String tableNamePattern)
          Get a description of the access rights for each table available in a catalog.
 java.sql.ResultSet getTables(java.lang.String catalog, java.lang.String schemaPattern, java.lang.String tableNamePattern, java.lang.String[] types)
          Get a description of tables available in a catalog.
 java.sql.ResultSet getTableTypes()
          Get the table types available in this database.
 java.lang.String getTimeDateFunctions()
          Get a comma separated list of time and date functions.
 java.sql.ResultSet getTypeInfo()
          Get a description of all the standard SQL types supported by this database.
 java.sql.ResultSet getUDTs(java.lang.String catalog, java.lang.String schemaPattern, java.lang.String typeNamePattern, int[] types)
          JDBC 2.0 Get a description of the user-defined types defined in a particular schema.
 java.lang.String getURL()
          What's the url for this database?
 java.lang.String getUserName()
          What's our user name as known to the database?
 java.sql.ResultSet getVersionColumns(java.lang.String catalog, java.lang.String schema, java.lang.String table)
          Get a description of a table's columns that are automatically updated when any value in a row is updated.
 boolean insertsAreDetected(int type)
          JDBC 2.0 Determine whether or not a visible row insert can be detected by calling ResultSet.rowInserted().
 boolean isCatalogAtStart()
          Does a catalog appear at the start of a qualified table name? (Otherwise it appears at the end)
 boolean isReadOnly()
          Is the database in read-only mode?
 boolean locatorsUpdateCopy()
           
 boolean nullPlusNonNullIsNull()
          Are concatenations between NULL and non-NULL values NULL? A JDBC compliant driver always returns true.
 boolean nullsAreSortedAtEnd()
          Are NULL values sorted at the end regardless of sort order?
 boolean nullsAreSortedAtStart()
          Are NULL values sorted at the start regardless of sort order?
 boolean nullsAreSortedHigh()
          Are NULL values sorted high?
 boolean nullsAreSortedLow()
          Are NULL values sorted low?
 boolean othersDeletesAreVisible(int type)
          DOCUMENT ME!
 boolean othersInsertsAreVisible(int type)
          DOCUMENT ME!
 boolean othersUpdatesAreVisible(int type)
          JDBC 2.0 Determine whether changes made by others are visible.
 boolean ownDeletesAreVisible(int type)
          DOCUMENT ME!
 boolean ownInsertsAreVisible(int type)
          DOCUMENT ME!
 boolean ownUpdatesAreVisible(int type)
          JDBC 2.0 Determine whether a result set's own changes visible.
private  byte[] s2b(java.lang.String s)
          Converts the given string to bytes, using the connection's character encoding, or if not available, the JVM default encoding.
 boolean storesLowerCaseIdentifiers()
          Does the database store mixed case unquoted SQL identifiers in lower case?
 boolean storesLowerCaseQuotedIdentifiers()
          Does the database store mixed case quoted SQL identifiers in lower case? A JDBC compliant driver will always return false.
 boolean storesMixedCaseIdentifiers()
          Does the database store mixed case unquoted SQL identifiers in mixed case?
 boolean storesMixedCaseQuotedIdentifiers()
          Does the database store mixed case quoted SQL identifiers in mixed case? A JDBC compliant driver will always return false.
 boolean storesUpperCaseIdentifiers()
          Does the database store mixed case unquoted SQL identifiers in upper case?
 boolean storesUpperCaseQuotedIdentifiers()
          Does the database store mixed case quoted SQL identifiers in upper case? A JDBC compliant driver will always return true.
 boolean supportsAlterTableWithAddColumn()
          Is "ALTER TABLE" with add column supported?
 boolean supportsAlterTableWithDropColumn()
          Is "ALTER TABLE" with drop column supported?
 boolean supportsANSI92EntryLevelSQL()
          Is the ANSI92 entry level SQL grammar supported? All JDBC compliant drivers must return true.
 boolean supportsANSI92FullSQL()
          Is the ANSI92 full SQL grammar supported?
 boolean supportsANSI92IntermediateSQL()
          Is the ANSI92 intermediate SQL grammar supported?
 boolean supportsBatchUpdates()
          JDBC 2.0 Return true if the driver supports batch updates, else return false.
 boolean supportsCatalogsInDataManipulation()
          Can a catalog name be used in a data manipulation statement?
 boolean supportsCatalogsInIndexDefinitions()
          Can a catalog name be used in a index definition statement?
 boolean supportsCatalogsInPrivilegeDefinitions()
          Can a catalog name be used in a privilege definition statement?
 boolean supportsCatalogsInProcedureCalls()
          Can a catalog name be used in a procedure call statement?
 boolean supportsCatalogsInTableDefinitions()
          Can a catalog name be used in a table definition statement?
 boolean supportsColumnAliasing()
          Is column aliasing supported?
 boolean supportsConvert()
          Is the CONVERT function between SQL types supported?
 boolean supportsConvert(int fromType, int toType)
          Is CONVERT between the given SQL types supported?
 boolean supportsCoreSQLGrammar()
          Is the ODBC Core SQL grammar supported?
 boolean supportsCorrelatedSubqueries()
          Are correlated subqueries supported? A JDBC compliant driver always returns true.
 boolean supportsDataDefinitionAndDataManipulationTransactions()
          Are both data definition and data manipulation statements within a transaction supported?
 boolean supportsDataManipulationTransactionsOnly()
          Are only data manipulation statements within a transaction supported?
 boolean supportsDifferentTableCorrelationNames()
          If table correlation names are supported, are they restricted to be different from the names of the tables? A JDBC compliant driver always returns true.
 boolean supportsExpressionsInOrderBy()
          Are expressions in "ORDER BY" lists supported?
 boolean supportsExtendedSQLGrammar()
          Is the ODBC Extended SQL grammar supported?
 boolean supportsFullOuterJoins()
          Are full nested outer joins supported?
 boolean supportsGetGeneratedKeys()
          JDBC 3.0
 boolean supportsGroupBy()
          Is some form of "GROUP BY" clause supported?
 boolean supportsGroupByBeyondSelect()
          Can a "GROUP BY" clause add columns not in the SELECT provided it specifies all the columns in the SELECT?
 boolean supportsGroupByUnrelated()
          Can a "GROUP BY" clause use columns not in the SELECT?
 boolean supportsIntegrityEnhancementFacility()
          Is the SQL Integrity Enhancement Facility supported?
 boolean supportsLikeEscapeClause()
          Is the escape character in "LIKE" clauses supported? A JDBC compliant driver always returns true.
 boolean supportsLimitedOuterJoins()
          Is there limited support for outer joins? (This will be true if supportFullOuterJoins is true.)
 boolean supportsMinimumSQLGrammar()
          Is the ODBC Minimum SQL grammar supported? All JDBC compliant drivers must return true.
 boolean supportsMixedCaseIdentifiers()
          Does the database support mixed case unquoted SQL identifiers?
 boolean supportsMixedCaseQuotedIdentifiers()
          Does the database support mixed case quoted SQL identifiers? A JDBC compliant driver will always return true.
 boolean supportsMultipleOpenResults()
          This method tests whether the database supports returning multiple ResultSetS from a CallableStatement at once.
 boolean supportsMultipleResultSets()
          Are multiple ResultSets from a single execute supported?
 boolean supportsMultipleTransactions()
          Can we have multiple transactions open at once (on different connections)?
 boolean supportsNamedParameters()
          This method tests whether the database supports named parameters.
 boolean supportsNonNullableColumns()
          Can columns be defined as non-nullable? A JDBC compliant driver always returns true.
 boolean supportsOpenCursorsAcrossCommit()
          Can cursors remain open across commits?
 boolean supportsOpenCursorsAcrossRollback()
          Can cursors remain open across rollbacks?
 boolean supportsOpenStatementsAcrossCommit()
          Can statements remain open across commits?
 boolean supportsOpenStatementsAcrossRollback()
          Can statements remain open across rollbacks?
 boolean supportsOrderByUnrelated()
          Can an "ORDER BY" clause use columns not in the SELECT?
 boolean supportsOuterJoins()
          Is some form of outer join supported?
 boolean supportsPositionedDelete()
          Is positioned DELETE supported?
 boolean supportsPositionedUpdate()
          Is positioned UPDATE supported?
 boolean supportsResultSetConcurrency(int type, int concurrency)
          JDBC 2.0 Does the database support the concurrency type in combination with the given result set type?
 boolean supportsResultSetHoldability(int holdability)
          This method tests if the database supports the specified holdability type.
 boolean supportsResultSetType(int type)
          JDBC 2.0 Does the database support the given result set type?
 boolean supportsSavepoints()
          This method tests whether the databse supports savepoints.
 boolean supportsSchemasInDataManipulation()
          Can a schema name be used in a data manipulation statement?
 boolean supportsSchemasInIndexDefinitions()
          Can a schema name be used in an index definition statement?
 boolean supportsSchemasInPrivilegeDefinitions()
          Can a schema name be used in a privilege definition statement?
 boolean supportsSchemasInProcedureCalls()
          Can a schema name be used in a procedure call statement?
 boolean supportsSchemasInTableDefinitions()
          Can a schema name be used in a table definition statement?
 boolean supportsSelectForUpdate()
          Is SELECT for UPDATE supported?
 boolean supportsStatementPooling()
           
 boolean supportsStoredProcedures()
          Are stored procedure calls using the stored procedure escape syntax supported?
 boolean supportsSubqueriesInComparisons()
          Are subqueries in comparison expressions supported? A JDBC compliant driver always returns true.
 boolean supportsSubqueriesInExists()
          Are subqueries in exists expressions supported? A JDBC compliant driver always returns true.
 boolean supportsSubqueriesInIns()
          Are subqueries in "in" statements supported? A JDBC compliant driver always returns true.
 boolean supportsSubqueriesInQuantifieds()
          Are subqueries in quantified expressions supported? A JDBC compliant driver always returns true.
 boolean supportsTableCorrelationNames()
          Are table correlation names supported? A JDBC compliant driver always returns true.
 boolean supportsTransactionIsolationLevel(int level)
          Does the database support the given transaction isolation level?
 boolean supportsTransactions()
          Are transactions supported? If not, commit is a noop and the isolation level is TRANSACTION_NONE.
 boolean supportsUnion()
          Is SQL UNION supported? A JDBC compliant driver always returns true.
 boolean supportsUnionAll()
          Is SQL UNION ALL supported? A JDBC compliant driver always returns true.
 boolean updatesAreDetected(int type)
          JDBC 2.0 Determine whether or not a visible row update can be detected by calling ResultSet.rowUpdated().
 boolean usesLocalFilePerTable()
          Does the database use a file for each table?
 boolean usesLocalFiles()
          Does the database store tables in a local file?
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

TABLE_AS_BYTES

private static final byte[] TABLE_AS_BYTES

SUPPORTS_FK

private static final java.lang.String SUPPORTS_FK
The table type for generic tables that support foreign keys.

See Also:
Constant Field Values

PKTABLE_CAT

private static final int PKTABLE_CAT
See Also:
Constant Field Values

PKTABLE_SCHEM

private static final int PKTABLE_SCHEM
See Also:
Constant Field Values

PKTABLE_NAME

private static final int PKTABLE_NAME
See Also:
Constant Field Values

PKCOLUMN_NAME

private static final int PKCOLUMN_NAME
See Also:
Constant Field Values

FKTABLE_CAT

private static final int FKTABLE_CAT
See Also:
Constant Field Values

FKTABLE_SCHEM

private static final int FKTABLE_SCHEM
See Also:
Constant Field Values

FKTABLE_NAME

private static final int FKTABLE_NAME
See Also:
Constant Field Values

FKCOLUMN_NAME

private static final int FKCOLUMN_NAME
See Also:
Constant Field Values

KEY_SEQ

private static final int KEY_SEQ
See Also:
Constant Field Values

UPDATE_RULE

private static final int UPDATE_RULE
See Also:
Constant Field Values

DELETE_RULE

private static final int DELETE_RULE
See Also:
Constant Field Values

FK_NAME

private static final int FK_NAME
See Also:
Constant Field Values

PK_NAME

private static final int PK_NAME
See Also:
Constant Field Values

DEFERRABILITY

private static final int DEFERRABILITY
See Also:
Constant Field Values

conn

private Connection conn
The connection to the database


database

private java.lang.String database
The 'current' database name being used


quotedId

private java.lang.String quotedId
What character to use when quoting identifiers

Constructor Detail

DatabaseMetaData

public DatabaseMetaData(Connection conn,
                        java.lang.String database)
Creates a new DatabaseMetaData object.

Method Detail

getAttributes

public java.sql.ResultSet getAttributes(java.lang.String arg0,
                                        java.lang.String arg1,
                                        java.lang.String arg2,
                                        java.lang.String arg3)
                                 throws java.sql.SQLException
Specified by:
getAttributes in interface java.sql.DatabaseMetaData

getBestRowIdentifier

public java.sql.ResultSet getBestRowIdentifier(java.lang.String catalog,
                                               java.lang.String schema,
                                               java.lang.String table,
                                               int scope,
                                               boolean nullable)
                                        throws java.sql.SQLException
Get a description of a table's optimal set of columns that uniquely identifies a row. They are ordered by SCOPE.

Each column description has the following columns:

  1. SCOPE short => actual scope of result
    • bestRowTemporary - very temporary, while using row
    • bestRowTransaction - valid for remainder of current transaction
    • bestRowSession - valid for remainder of current session
  2. COLUMN_NAME String => column name
  3. DATA_TYPE short => SQL data type from java.sql.Types
  4. TYPE_NAME String => Data source dependent type name
  5. COLUMN_SIZE int => precision
  6. BUFFER_LENGTH int => not used
  7. DECIMAL_DIGITS short => scale
  8. PSEUDO_COLUMN short => is this a pseudo column like an Oracle ROWID
    • bestRowUnknown - may or may not be pseudo column
    • bestRowNotPseudo - is NOT a pseudo column
    • bestRowPseudo - is a pseudo column

Specified by:
getBestRowIdentifier in interface java.sql.DatabaseMetaData

isCatalogAtStart

public boolean isCatalogAtStart()
                         throws java.sql.SQLException
Does a catalog appear at the start of a qualified table name? (Otherwise it appears at the end)

Specified by:
isCatalogAtStart in interface java.sql.DatabaseMetaData

getCatalogSeparator

public java.lang.String getCatalogSeparator()
                                     throws java.sql.SQLException
What's the separator between catalog and table name?

Specified by:
getCatalogSeparator in interface java.sql.DatabaseMetaData

getCatalogTerm

public java.lang.String getCatalogTerm()
                                throws java.sql.SQLException
What's the database vendor's preferred term for "catalog"?

Specified by:
getCatalogTerm in interface java.sql.DatabaseMetaData

getCatalogs

public java.sql.ResultSet getCatalogs()
                               throws java.sql.SQLException
Get the catalog names available in this database. The results are ordered by catalog name.

The catalog column is:

  1. TABLE_CAT String => catalog name

Specified by:
getCatalogs in interface java.sql.DatabaseMetaData

getColumnPrivileges

public java.sql.ResultSet getColumnPrivileges(java.lang.String catalog,
                                              java.lang.String schema,
                                              java.lang.String table,
                                              java.lang.String columnNamePattern)
                                       throws java.sql.SQLException
Get a description of the access rights for a table's columns.

Only privileges matching the column name criteria are returned. They are ordered by COLUMN_NAME and PRIVILEGE.

Each privilige description has the following columns:

  1. TABLE_CAT String => table catalog (may be null)
  2. TABLE_SCHEM String => table schema (may be null)
  3. TABLE_NAME String => table name
  4. COLUMN_NAME String => column name
  5. GRANTOR => grantor of access (may be null)
  6. GRANTEE String => grantee of access
  7. PRIVILEGE String => name of access (SELECT, INSERT, UPDATE, REFRENCES, ...)
  8. IS_GRANTABLE String => "YES" if grantee is permitted to grant to others; "NO" if not; null if unknown

Specified by:
getColumnPrivileges in interface java.sql.DatabaseMetaData

getColumns

public java.sql.ResultSet getColumns(java.lang.String catalog,
                                     java.lang.String schemaPattern,
                                     java.lang.String tableName,
                                     java.lang.String columnNamePattern)
                              throws java.sql.SQLException
Get a description of table columns available in a catalog.

Only column descriptions matching the catalog, schema, table and column name criteria are returned. They are ordered by TABLE_SCHEM, TABLE_NAME and ORDINAL_POSITION.

Each column description has the following columns:

  1. TABLE_CAT String => table catalog (may be null)
  2. TABLE_SCHEM String => table schema (may be null)
  3. TABLE_NAME String => table name
  4. COLUMN_NAME String => column name
  5. DATA_TYPE short => SQL type from java.sql.Types
  6. TYPE_NAME String => Data source dependent type name
  7. COLUMN_SIZE int => column size. For char or date types this is the maximum number of characters, for numeric or decimal types this is precision.
  8. BUFFER_LENGTH is not used.
  9. DECIMAL_DIGITS int => the number of fractional digits
  10. NUM_PREC_RADIX int => Radix (typically either 10 or 2)
  11. NULLABLE int => is NULL allowed?
    • columnNoNulls - might not allow NULL values
    • columnNullable - definitely allows NULL values
    • columnNullableUnknown - nullability unknown
  12. REMARKS String => comment describing column (may be null)
  13. COLUMN_DEF String => default value (may be null)
  14. SQL_DATA_TYPE int => unused
  15. SQL_DATETIME_SUB int => unused
  16. CHAR_OCTET_LENGTH int => for char types the maximum number of bytes in the column
  17. ORDINAL_POSITION int => index of column in table (starting at 1)
  18. IS_NULLABLE String => "NO" means column definitely does not allow NULL values; "YES" means the column might allow NULL values. An empty string means nobody knows.

Specified by:
getColumns in interface java.sql.DatabaseMetaData

getConnection

public java.sql.Connection getConnection()
                                  throws java.sql.SQLException
JDBC 2.0 Return the connection that produced this metadata object.

Specified by:
getConnection in interface java.sql.DatabaseMetaData

getCrossReference

public java.sql.ResultSet getCrossReference(java.lang.String primaryCatalog,
                                            java.lang.String primarySchema,
                                            java.lang.String primaryTable,
                                            java.lang.String foreignCatalog,
                                            java.lang.String foreignSchema,
                                            java.lang.String foreignTable)
                                     throws java.sql.SQLException
Get a description of the foreign key columns in the foreign key table that reference the primary key columns of the primary key table (describe how one table imports another's key.) This should normally return a single foreign key/primary key pair (most tables only import a foreign key from a table once.) They are ordered by FKTABLE_CAT, FKTABLE_SCHEM, FKTABLE_NAME, and KEY_SEQ.

Each foreign key column description has the following columns:

  1. PKTABLE_CAT String => primary key table catalog (may be null)
  2. PKTABLE_SCHEM String => primary key table schema (may be null)
  3. PKTABLE_NAME String => primary key table name
  4. PKCOLUMN_NAME String => primary key column name
  5. FKTABLE_CAT String => foreign key table catalog (may be null) being exported (may be null)
  6. FKTABLE_SCHEM String => foreign key table schema (may be null) being exported (may be null)
  7. FKTABLE_NAME String => foreign key table name being exported
  8. FKCOLUMN_NAME String => foreign key column name being exported
  9. KEY_SEQ short => sequence number within foreign key
  10. UPDATE_RULE short => What happens to foreign key when primary is updated:
    • importedKeyCascade - change imported key to agree with primary key update
    • importedKeyRestrict - do not allow update of primary key if it has been imported
    • importedKeySetNull - change imported key to NULL if its primary key has been updated
  11. DELETE_RULE short => What happens to the foreign key when primary is deleted.
    • importedKeyCascade - delete rows that import a deleted key
    • importedKeyRestrict - do not allow delete of primary key if it has been imported
    • importedKeySetNull - change imported key to NULL if its primary key has been deleted
  12. FK_NAME String => foreign key identifier (may be null)
  13. PK_NAME String => primary key identifier (may be null)

Specified by:
getCrossReference in interface java.sql.DatabaseMetaData

getDatabaseMajorVersion

public int getDatabaseMajorVersion()
                            throws java.sql.SQLException
Description copied from interface: java.sql.DatabaseMetaData
This method returns the major version number of the database.

Specified by:
getDatabaseMajorVersion in interface java.sql.DatabaseMetaData

getDatabaseMinorVersion

public int getDatabaseMinorVersion()
                            throws java.sql.SQLException
Description copied from interface: java.sql.DatabaseMetaData
This method returns the minor version number of the database.

Specified by:
getDatabaseMinorVersion in interface java.sql.DatabaseMetaData

getDatabaseProductName

public java.lang.String getDatabaseProductName()
                                        throws java.sql.SQLException
What's the name of this database product?

Specified by:
getDatabaseProductName in interface java.sql.DatabaseMetaData

getDatabaseProductVersion

public java.lang.String getDatabaseProductVersion()
                                           throws java.sql.SQLException
What's the version of this database product?

Specified by:
getDatabaseProductVersion in interface java.sql.DatabaseMetaData

getDefaultTransactionIsolation

public int getDefaultTransactionIsolation()
                                   throws java.sql.SQLException
What's the database's default transaction isolation level? The values are defined in java