com.jdbwc.core
Class MySQLDBMDFromInfoSchema

java.lang.Object
  extended by com.jdbwc.core.MySQLDBMDFromInfoSchema
Direct Known Subclasses:
MySQLDatabaseMetaData

public class MySQLDBMDFromInfoSchema
extends java.lang.Object

This MetaData class is designed for MySql implementations greater than 5.x.x that use the INFORMATION_SCHEMA metadatabase.

Moved all methods that use INFORMATION_SCHEMA into this class to seperate the query logic from MySQLDatabaseMetaData and to make Driver maintenance and development a little easier.

This split logic concept is simmillar to the Connector/J structure but we are using the INFORMATION_SCHEMA database for more methods than Connector/J. The reason for that is we are aiming for max compatibility with newer MySQL 5.x.x+ versions that use a more comprehensive INFORMATION_SCHEMA metadatabase than older MySQL versions.

Version:
2008-05-29
Author:
Tim Gall (Oz-DevWorX)

Field Summary
protected  WCConnection myConnection
          The connection that created this WCDatabaseMetaData
protected static java.lang.String myTabletypes
          Known Table types supported by the MySQL database server
 
Constructor Summary
protected MySQLDBMDFromInfoSchema(WCConnection connection)
           
 
Method Summary
 java.sql.ResultSet getAttributes(java.lang.String catalog, java.lang.String schemaPattern, java.lang.String typeNamePattern, java.lang.String attributeNamePattern)
          Retrieves a description of the given attribute of the given type for a user-defined type (UDT) that is available in the given schema and catalog.

Descriptions are returned only for attributes of UDTs matching the catalog, schema, type, and attribute name criteria.
They are ordered by TYPE_CAT, TYPE_SCHEM, TYPE_NAME and ORDINAL_POSITION.
 java.sql.ResultSet getBestRowIdentifier(java.lang.String catalog, java.lang.String schema, java.lang.String table, int scope, boolean nullable)
           
 java.sql.ResultSet getCatalogs()
          Retrieves the catalog names available in this database.
 java.sql.ResultSet getClientInfoProperties()
          Retrieves a list of the client info properties that the driver supports.
 java.sql.ResultSet getColumnPrivileges(java.lang.String catalog, java.lang.String schema, java.lang.String table, java.lang.String columnNamePattern)
          Retrieves a description of the access rights for a table's columns.

Only privileges matching the column name criteria are returned.
 java.sql.ResultSet getColumns(java.lang.String catalog, java.lang.String schemaPattern, java.lang.String tableNamePattern, java.lang.String columnNamePattern)
          Retrieves a description of table columns available in the specified catalog.
 java.sql.ResultSet getCrossReference(java.lang.String parentCatalog, java.lang.String parentSchema, java.lang.String parentTable, java.lang.String foreignCatalog, java.lang.String foreignSchema, java.lang.String foreignTable)
           
 int getDefaultTransactionIsolation()
           
 java.sql.ResultSet getExportedKeys(java.lang.String catalog, java.lang.String schema, java.lang.String table)
          Retrieves a description of the foreign key columns that reference the given table's primary key columns (the foreign keys exported by a table).
They are ordered by FKTABLE_CAT, FKTABLE_SCHEM, FKTABLE_NAME, and KEY_SEQ.
 java.sql.ResultSet getFunctionColumns(java.lang.String catalog, java.lang.String schemaPattern, java.lang.String functionNamePattern, java.lang.String columnNamePattern)
          Retrieves a description of the given catalog's system or user function parameters and return type.
 java.sql.ResultSet getFunctions(java.lang.String catalog, java.lang.String schemaPattern, java.lang.String functionNamePattern)
          Retrieves a description of the system and user functions available in the given catalog.
 java.sql.ResultSet getImportedKeys(java.lang.String catalog, java.lang.String schema, java.lang.String table)
          Retrieves a description of the primary key columns that are referenced by the given table's foreign key columns (the primary keys imported by a table).
 java.sql.ResultSet getIndexInfo(java.lang.String catalog, java.lang.String schema, java.lang.String table, boolean unique, boolean approximate)
          Retrieves a description of the given table's indices and statistics.
 java.sql.ResultSet getPrimaryKeys(java.lang.String catalog, java.lang.String schema, java.lang.String table)
          Retrieves a description of the given table's primary key columns.
They are ordered by COLUMN_NAME.
 java.sql.ResultSet getProcedureColumns(java.lang.String catalog, java.lang.String schemaPattern, java.lang.String procedureNamePattern, java.lang.String columnNamePattern)
           
 java.sql.ResultSet getProcedures(java.lang.String catalog, java.lang.String schemaPattern, java.lang.String procedureNamePattern)
          Retrieves a description of the stored procedures available in the given catalog.
 java.lang.String getProcedureTerm()
          Retrieves the database vendor's preferred term for "procedure".
 java.sql.ResultSet getSchemas()
          Retrieves the schema names available in this database.
 java.sql.ResultSet getSchemas(java.lang.String catalog, java.lang.String schemaPattern)
          Retrieves the schema names available in this database.
 java.sql.ResultSet getTablePrivileges(java.lang.String catalog, java.lang.String schemaPattern, java.lang.String tableNamePattern)
          Retrieves 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)
          Retrieves a description of the tables available in the given catalog.
 java.sql.ResultSet getUDTs(java.lang.String catalog, java.lang.String schemaPattern, java.lang.String typeNamePattern, int[] types)
           
 java.sql.ResultSet getVersionColumns(java.lang.String catalog, java.lang.String schema, java.lang.String table)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

myConnection

protected transient WCConnection myConnection
The connection that created this WCDatabaseMetaData


myTabletypes

protected static final java.lang.String myTabletypes
Known Table types supported by the MySQL database server

See Also:
Constant Field Values
Constructor Detail

MySQLDBMDFromInfoSchema

protected MySQLDBMDFromInfoSchema(WCConnection connection)
                           throws java.sql.SQLException
Throws:
java.sql.SQLException
Method Detail

getAttributes

public java.sql.ResultSet getAttributes(java.lang.String catalog,
                                        java.lang.String schemaPattern,
                                        java.lang.String typeNamePattern,
                                        java.lang.String attributeNamePattern)
                                 throws java.sql.SQLException
Retrieves a description of the given attribute of the given type for a user-defined type (UDT) that is available in the given schema and catalog.

Descriptions are returned only for attributes of UDTs matching the catalog, schema, type, and attribute name criteria.
They are ordered by TYPE_CAT, TYPE_SCHEM, TYPE_NAME and ORDINAL_POSITION. This description does not contain inherited attributes.

The ResultSet object that is returned has the following columns:
  1. TYPE_CAT String => type catalog (may be null)
  2. TYPE_SCHEM String => type schema (may be null)
  3. TYPE_NAME String => type name
  4. ATTR_NAME String => attribute name
  5. DATA_TYPE int => attribute type SQL type from java.sql.Types
  6. ATTR_TYPE_NAME String => Data source dependent type name. For a UDT, the type name is fully qualified. For a REF, the type name is fully qualified and represents the target type of the reference type.
  7. ATTR_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. DECIMAL_DIGITS int => the number of fractional digits. Null is returned for data types where DECIMAL_DIGITS is not applicable.
  9. NUM_PREC_RADIX int => Radix (typically either 10 or 2)
  10. NULLABLE int => whether NULL is allowed
    • attributeNoNulls - might not allow NULL values
    • attributeNullable - definitely allows NULL values
    • attributeNullableUnknown - nullability unknown
  11. REMARKS String => comment describing column (may be null)
  12. ATTR_DEF String => default value (may be null)
  13. SQL_DATA_TYPE int => unused
  14. SQL_DATETIME_SUB int => unused
  15. CHAR_OCTET_LENGTH int => for char types the maximum number of bytes in the column
  16. ORDINAL_POSITION int => index of the attribute in the UDT (starting at 1)
  17. IS_NULLABLE String => ISO rules are used to determine the nullability for a attribute.
    • YES --- if the attribute can include NULLs
    • NO --- if the attribute cannot include NULLs
    • empty string --- if the nullability for the attribute is unknown
  18. SCOPE_CATALOG String => catalog of table that is the scope of a reference attribute (null if DATA_TYPE isn't REF)
  19. SCOPE_SCHEMA String => schema of table that is the scope of a reference attribute (null if DATA_TYPE isn't REF)
  20. SCOPE_TABLE String => table name that is the scope of a reference attribute (null if the DATA_TYPE isn't REF)
  21. SOURCE_DATA_TYPE short => source type of a distinct type or user-generated Ref type,SQL type from java.sql.Types (null if DATA_TYPE isn't DISTINCT or user-generated REF)

Parameters:
catalog - a catalog name; must match the catalog name as it is stored in the database; "" retrieves those without a catalog; null means that the catalog name should not be used to narrow the search
schemaPattern - a schema name pattern; must match the schema name as it is stored in the database; "" retrieves those without a schema; null means that the schema name should not be used to narrow the search
typeNamePattern - a type name pattern; must match the type name as it is stored in the database
attributeNamePattern - an attribute name pattern; must match the attribute name as it is declared in the database
Returns:
a ResultSet object in which each row is an attribute description
Throws:
java.sql.SQLException - if a database access error occurs
Since:
1.4
See Also:
DatabaseMetaData.getSearchStringEscape()

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
Throws:
java.sql.SQLException

getCatalogs

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

The catalog column is:

  1. TABLE_CAT String => catalog name

Returns:
a ResultSet object in which each row has a single String column that is a catalog name
Throws:
java.sql.SQLException - if a database access error occurs

getClientInfoProperties

public java.sql.ResultSet getClientInfoProperties()
                                           throws java.sql.SQLException
Retrieves a list of the client info properties that the driver supports. The result set contains the following columns
  1. NAME String=> The name of the client info property
  2. MAX_LEN int=> The maximum length of the value for the property
  3. DEFAULT_VALUE String=> The default value of the property
  4. DESCRIPTION String=> A description of the property. This will typically contain information as to where this property is stored in the database.
The ResultSet is sorted by the NAME column

Returns:
A ResultSet object; each row is a supported client info property
Throws:
java.sql.SQLException - if a database access error occurs
Since:
1.6

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
Retrieves 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 String => 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

Parameters:
catalog - a catalog name; must match the catalog name as it is stored in the database; "" retrieves those without a catalog; null means that the catalog name should not be used to narrow the search
schema - a schema name; must match the schema name as it is stored in the database; "" retrieves those without a schema; null means that the schema name should not be used to narrow the search
table - a table name; must match the table name as it is stored in the database
columnNamePattern - a column name pattern; must match the column name as it is stored in the database
Returns:
ResultSet - each row is a column privilege description
Throws:
java.sql.SQLException - if a database access error occurs
See Also:
DatabaseMetaData.getSearchStringEscape()

getColumns

public java.sql.ResultSet getColumns(java.lang.String catalog,
                                     java.lang.String schemaPattern,
                                     java.lang.String tableNamePattern,
                                     java.lang.String columnNamePattern)
                              throws java.sql.SQLException
Retrieves a description of table columns available in the specified catalog.

Only column descriptions matching the catalog, schema, table and column name criteria are returned. They are ordered by TABLE_CAT,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 int => SQL type from java.sql.Types
  6. TYPE_NAME String => Data source dependent type name, for a UDT the type name is fully qualified
  7. COLUMN_SIZE int => column size.
  8. BUFFER_LENGTH is not used.
  9. DECIMAL_DIGITS int => the number of fractional digits. Null is returned for data types where DECIMAL_DIGITS is not applicable.
  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 for the column, which should be interpreted as a string when the value is enclosed in single quotes (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 => ISO rules are used to determine the nullability for a column.
    • YES --- if the parameter can include NULLs
    • NO --- if the parameter cannot include NULLs
    • empty string --- if the nullability for the parameter is unknown
  19. SCOPE_CATLOG String => catalog of table that is the scope of a reference attribute (null if DATA_TYPE isn't REF)
  20. SCOPE_SCHEMA String => schema of table that is the scope of a reference attribute (null if the DATA_TYPE isn't REF)
  21. SCOPE_TABLE String => table name that this the scope of a reference attribure (null if the DATA_TYPE isn't REF)
  22. SOURCE_DATA_TYPE short => source type of a distinct type or user-generated Ref type, SQL type from java.sql.Types (null if DATA_TYPE isn't DISTINCT or user-generated REF)
  23. IS_AUTOINCREMENT String => Indicates whether this column is auto incremented
    • YES --- if the column is auto incremented
    • NO --- if the column is not auto incremented
    • empty string --- if it cannot be determined whether the column is auto incremented parameter is unknown

The COLUMN_SIZE column the specified column size for the given column. For numeric data, this is the maximum precision. For character data, this is the length in characters. For datetime datatypes, this is the length in characters of the String representation (assuming the maximum allowed precision of the fractional seconds component). For binary data, this is the length in bytes. For the ROWID datatype, this is the length in bytes. Null is returned for data types where the column size is not applicable.

Parameters:
catalog - a catalog name; must match the catalog name as it is stored in the database; "" retrieves those without a catalog; null means that the catalog name should not be used to narrow the search
schemaPattern - a schema name pattern; must match the schema name as it is stored in the database; "" retrieves those without a schema; null means that the schema name should not be used to narrow the search
tableNamePattern - a table name pattern; must match the table name as it is stored in the database
columnNamePattern - a column name pattern; must match the column name as it is stored in the database
Returns:
ResultSet - each row is a column description
Throws:
java.sql.SQLException - if a database access error occurs
See Also:
DatabaseMetaData.getSearchStringEscape()

getCrossReference

public java.sql.ResultSet getCrossReference(java.lang.String parentCatalog,
                                            java.lang.String parentSchema,
                                            java.lang.String parentTable,
                                            java.lang.String foreignCatalog,
                                            java.lang.String foreignSchema,
                                            java.lang.String foreignTable)
                                     throws java.sql.SQLException
Throws:
java.sql.SQLException

getDefaultTransactionIsolation

public int getDefaultTransactionIsolation()
                                   throws java.sql.SQLException
Throws:
java.sql.SQLException

getExportedKeys

public java.sql.ResultSet getExportedKeys(java.lang.String catalog,
                                          java.lang.String schema,
                                          java.lang.String table)
                                   throws java.sql.SQLException
Retrieves a description of the foreign key columns that reference the given table's primary key columns (the foreign keys exported by a table).
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( a value of 1 represents the first column of the foreign key, a value of 2 would represent the second column within the foreign key).
  10. UPDATE_RULE short => What happens to foreign key when primary is updated:
    • importedNoAction - do not allow update of primary key if it has been imported
    • importedKeyCascade - change imported key to agree with primary key update
    • importedKeySetNull - change imported key to NULL if its primary key has been updated
    • importedKeySetDefault - change imported key to default values if its primary key has been updated
    • importedKeyRestrict - same as importedKeyNoAction (for ODBC 2.x compatibility)
  11. DELETE_RULE short => What happens to the foreign key when primary is deleted.
    • importedKeyNoAction - do not allow delete of primary key if it has been imported
    • importedKeyCascade - delete rows that import a deleted key
    • importedKeySetNull - change imported key to NULL if its primary key has been deleted
    • importedKeyRestrict - same as importedKeyNoAction (for ODBC 2.x compatibility)
    • importedKeySetDefault - change imported key to default if its primary key has been deleted
  12. FK_NAME String => foreign key name (may be null)
  13. PK_NAME String => primary key name (may be null)
  14. DEFERRABILITY short => can the evaluation of foreign key constraints be deferred until commit
    • importedKeyInitiallyDeferred - see SQL92 for definition
    • importedKeyInitiallyImmediate - see SQL92 for definition
    • importedKeyNotDeferrable - see SQL92 for definition

Parameters:
catalog - a catalog name; must match the catalog name as it is stored in this database; "" retrieves those without a catalog; null means that the catalog name should not be used to narrow the search
schema - a schema name; must match the schema name as it is stored in the database; "" retrieves those without a schema; null means that the schema name should not be used to narrow the search
table - a table name; must match the table name as it is stored in this database
Returns:
a ResultSet object in which each row is a foreign key column description
Throws:
java.sql.SQLException - if a database access error occurs
See Also:
DatabaseMetaData.getImportedKeys(java.lang.String, java.lang.String, java.lang.String)

getFunctionColumns

public java.sql.ResultSet getFunctionColumns(java.lang.String catalog,
                                             java.lang.String schemaPattern,
                                             java.lang.String functionNamePattern,
                                             java.lang.String columnNamePattern)
                                      throws java.sql.SQLException
Retrieves a description of the given catalog's system or user function parameters and return type.

Only descriptions matching the schema, function and parameter name criteria are returned.
They are ordered by FUNCTION_CAT, FUNCTION_SCHEM, FUNCTION_NAME and SPECIFIC_ NAME. Within this, the return value, if any, is first. Next are the parameter descriptions in call order. The column descriptions follow in column number order.

Each row in the ResultSet is a parameter description, column description or return type description with the following fields:

FUNCTION_CAT String => function catalog (may be null)
FUNCTION_SCHEM String => function schema (may be null)
FUNCTION_NAME String => function name. This is the name used to invoke the function
COLUMN_NAME String => column/parameter name
COLUMN_TYPE Short => kind of column/parameter:
functionColumnUnknown - nobody knows
functionColumnIn - IN parameter
functionColumnInOut - INOUT parameter
functionColumnOut - OUT parameter
functionColumnReturn - function return value
functionColumnResult - Indicates that the parameter or column is a column in the ResultSet
DATA_TYPE int => SQL type from java.sql.Types
TYPE_NAME String => SQL type name, for a UDT type the type name is fully qualified
PRECISION int => precision
LENGTH int => length in bytes of data
SCALE short => scale - null is returned for data types where SCALE is not applicable.
RADIX short => radix
NULLABLE short => can it contain NULL.
functionNoNulls - does not allow NULL values
functionNullable - allows NULL values
functionNullableUnknown - nullability unknown
REMARKS String => comment describing column/parameter
CHAR_OCTET_LENGTH int => the maximum length of binary and character based parameters or columns. For any other datatype the returned value is a NULL
ORDINAL_POSITION int => the ordinal position, starting from 1, for the input and output parameters. A value of 0 is returned if this row describes the function's return value. For result set columns, it is the ordinal position of the column in the result set starting from 1.
IS_NULLABLE String => ISO rules are used to determine the nullability for a parameter or column.
YES --- if the parameter or column can include NULLs
NO --- if the parameter or column cannot include NULLs
empty string --- if the nullability for the parameter or column is unknown
SPECIFIC_NAME String => the name which uniquely identifies this function within its schema. This is a user specified, or DBMS generated, name that may be different then the FUNCTION_NAME for example with overload functions

The PRECISION column represents the specified column size for the given parameter or column. For numeric data, this is the maximum precision. For character data, this is the length in characters. For datetime datatypes, this is the length in characters of the String representation (assuming the maximum allowed precision of the fractional seconds component). For binary data, this is the length in bytes. For the ROWID datatype, this is the length in bytes. Null is returned for data types where the column size is not applicable.

Parameters:
catalog - a catalog name; must match the catalog name as it is stored in the database; "" retrieves those without a catalog; null means that the catalog name should not be used to narrow the search
schemaPattern - a schema name pattern; must match the schema name as it is stored in the database; "" retrieves those without a schema; null means that the schema name should not be used to narrow the search
functionNamePattern - a procedure name pattern; must match the function name as it is stored in the database
columnNamePattern - a parameter name pattern; must match the parameter or column name as it is stored in the database
Returns:
ResultSet - each row describes a user function parameter, column or return type
Throws:
java.sql.SQLException - if a database access error occurs
Since:
1.6
See Also:
DatabaseMetaData.getSearchStringEscape()

getFunctions

public java.sql.ResultSet getFunctions(java.lang.String catalog,
                                       java.lang.String schemaPattern,
                                       java.lang.String functionNamePattern)
                                throws java.sql.SQLException
Retrieves a description of the system and user functions available in the given catalog.

Only system and user function descriptions matching the schema and function name criteria are returned. They are ordered by FUNCTION_CAT, FUNCTION_SCHEM, FUNCTION_NAME and SPECIFIC_ NAME.

Each function description has the the following columns:

  1. FUNCTION_CAT String => function catalog (may be null)
  2. FUNCTION_SCHEM String => function schema (may be null)
  3. FUNCTION_NAME String => function name. This is the name used to invoke the function
  4. REMARKS String => explanatory comment on the function
  5. FUNCTION_TYPE short => kind of function:
    • functionResultUnknown - Cannot determine if a return value or table will be returned
    • functionNoTable- Does not return a table
    • functionReturnsTable - Returns a table
  6. SPECIFIC_NAME String => the name which uniquely identifies this function within its schema. This is a user specified, or DBMS generated, name that may be different then the FUNCTION_NAME for example with overload functions

A user may not have permission to execute any of the functions that are returned by getFunctions

Parameters:
catalog - a catalog name; must match the catalog name as it is stored in the database; "" retrieves those without a catalog; null means that the catalog name should not be used to narrow the search
schemaPattern - a schema name pattern; must match the schema name as it is stored in the database; "" retrieves those without a schema; null means that the schema name should not be used to narrow the search
functionNamePattern - a function name pattern; must match the function name as it is stored in the database
Returns:
ResultSet - each row is a function description
Throws:
java.sql.SQLException - if a database access error occurs
Since:
1.6
See Also:
DatabaseMetaData.getSearchStringEscape()

getImportedKeys

public java.sql.ResultSet getImportedKeys(java.lang.String catalog,
                                          java.lang.String schema,
                                          java.lang.String table)
                                   throws java.sql.SQLException
Retrieves a description of the primary key columns that are referenced by the given table's foreign key columns (the primary keys imported by a table).
They are ordered by PKTABLE_CAT, PKTABLE_SCHEM, PKTABLE_NAME, and KEY_SEQ.

Each primary key column description has the following columns:

PKTABLE_CAT String => primary key table catalog being imported (may be null)
PKTABLE_SCHEM String => primary key table schema being imported (may be null)
PKTABLE_NAME String => primary key table name being imported
PKCOLUMN_NAME String => primary key column name being imported
FKTABLE_CAT String => foreign key table catalog (may be null)
FKTABLE_SCHEM String => foreign key table schema (may be null)
FKTABLE_NAME String => foreign key table name
FKCOLUMN_NAME String => foreign key column name
KEY_SEQ short => sequence number within a foreign key( a value of 1 represents the first column of the foreign key, a value of 2 would represent the second column within the foreign key).
UPDATE_RULE short => What happens to a foreign key when the primary key is updated:
importedNoAction - do not allow update of primary key if it has been imported
importedKeyCascade - change imported key to agree with primary key update
importedKeySetNull - change imported key to NULL if its primary key has been updated
importedKeySetDefault - change imported key to default values if its primary key has been updated
importedKeyRestrict - same as importedKeyNoAction (for ODBC 2.x compatibility)
DELETE_RULE short => What happens to the foreign key when primary is deleted.
importedKeyNoAction - do not allow delete of primary key if it has been imported
importedKeyCascade - delete rows that import a deleted key
importedKeySetNull - change imported key to NULL if its primary key has been deleted
importedKeyRestrict - same as importedKeyNoAction (for ODBC 2.x compatibility)
importedKeySetDefault - change imported key to default if its primary key has been deleted
FK_NAME String => foreign key name (may be null)
PK_NAME String => primary key name (may be null)
DEFERRABILITY short => can the evaluation of foreign key constraints be deferred until commit
importedKeyInitiallyDeferred - see SQL92 for definition
importedKeyInitiallyImmediate - see SQL92 for definition
importedKeyNotDeferrable - see SQL92 for definition

Parameters:
catalog - a catalog name; must match the catalog name as it is stored in the database; "" retrieves those without a catalog; null means that the catalog name should not be used to narrow the search
schema - a schema name; must match the schema name as it is stored in the database; "" retrieves those without a schema; null means that the schema name should not be used to narrow the search
table - a table name; must match the table name as it is stored in the database
Returns:
ResultSet - each row is a primary key column description
Throws:
java.sql.SQLException - if a database access error occurs
See Also:
DatabaseMetaData.getExportedKeys(java.lang.String, java.lang.String, java.lang.String)

getIndexInfo

public java.sql.ResultSet getIndexInfo(java.lang.String catalog,
                                       java.lang.String schema,
                                       java.lang.String table,
                                       boolean unique,
                                       boolean approximate)
                                throws java.sql.SQLException
Retrieves a description of the given table's indices and statistics. They are ordered by NON_UNIQUE, TYPE, INDEX_NAME, and ORDINAL_POSITION.

Each index column description has the following columns:

TABLE_CAT String => table catalog (may be null)
TABLE_SCHEM String => table schema (may be null)
TABLE_NAME String => table name
NON_UNIQUE boolean => Can index values be non-unique. false when TYPE is tableIndexStatistic
INDEX_QUALIFIER String => index catalog (may be null); null when TYPE is tableIndexStatistic
INDEX_NAME String => index name; null when TYPE is tableIndexStatistic
TYPE short => index type:
tableIndexStatistic - this identifies table statistics that are returned in conjuction with a table's index descriptions
tableIndexClustered - this is a clustered index
tableIndexHashed - this is a hashed index
tableIndexOther - this is some other style of index
ORDINAL_POSITION short => column sequence number within index; zero when TYPE is tableIndexStatistic
COLUMN_NAME String => column name; null when TYPE is tableIndexStatistic
ASC_OR_DESC String => column sort sequence, "A" => ascending, "D" => descending, may be null if sort sequence is not supported; null when TYPE is tableIndexStatistic
CARDINALITY int => When TYPE is tableIndexStatistic, then this is the number of rows in the table; otherwise, it is the number of unique values in the index.
PAGES int => When TYPE is tableIndexStatisic then this is the number of pages used for the table, otherwise it is the number of pages used for the current index.
FILTER_CONDITION String => Filter condition, if any. (may be null)

Parameters:
catalog - a catalog name; must match the catalog name as it is stored in this database; "" retrieves those without a catalog; null means that the catalog name should not be used to narrow the search
schema - a schema name; must match the schema name as it is stored in this database; "" retrieves those without a schema; null means that the schema name should not be used to narrow the search
table - a table name; must match the table name as it is stored in this database
unique - when true, return only indices for unique values; when false, return indices regardless of whether unique or not
approximate - when true, result is allowed to reflect approximate or out of data values; when false, results are requested to be accurate
Returns:
ResultSet - each row is an index column description
Throws:
java.sql.SQLException - if a database access error occurs

getPrimaryKeys

public java.sql.ResultSet getPrimaryKeys(java.lang.String catalog,
                                         java.lang.String schema,
                                         java.lang.String table)
                                  throws java.sql.SQLException
Retrieves a description of the given table's primary key columns.
They are ordered by COLUMN_NAME.

Each primary key column description has the following columns:

TABLE_CAT String => table catalog (may be null)
TABLE_SCHEM String => table schema (may be null)
TABLE_NAME String => table name
COLUMN_NAME String => column name
KEY_SEQ short => sequence number within primary key( a value of 1 represents the first column of the primary key, a value of 2 would represent the second column within the primary key).
PK_NAME String => primary key name (may be null)

Parameters:
catalog - a catalog name; must match the catalog name as it is stored in the database; "" retrieves those without a catalog; null means that the catalog name should not be used to narrow the search
schema - a schema name; must match the schema name as it is stored in the database; "" retrieves those without a schema; null means that the schema name should not be used to narrow the search
table - a table name; must match the table name as it is stored in the database
Returns:
ResultSet - each row is a primary key column description
Throws:
java.sql.SQLException - if a database access error occurs

getProcedureColumns

public java.sql.ResultSet getProcedureColumns(java.lang.String catalog,
                                              java.lang.String schemaPattern,
                                              java.lang.String procedureNamePattern,
                                              java.lang.String columnNamePattern)
                                       throws java.sql.SQLException
Throws:
java.sql.SQLException
See Also:
DatabaseMetaData.getProcedureColumns(java.lang.String, java.lang.String, java.lang.String, java.lang.String)

getProcedureTerm

public java.lang.String getProcedureTerm()
                                  throws java.sql.SQLException
Retrieves the database vendor's preferred term for "procedure".

Returns:
the vendor term for "procedure"
Throws:
java.sql.SQLException - if a database access error occurs

getProcedures

public java.sql.ResultSet getProcedures(java.lang.String catalog,
                                        java.lang.String schemaPattern,
                                        java.lang.String procedureNamePattern)
                                 throws java.sql.SQLException
Retrieves a description of the stored procedures available in the given catalog.

Only procedure descriptions matching the schema and procedure name criteria are returned. They are ordered by PROCEDURE_CAT, PROCEDURE_SCHEM, PROCEDURE_NAME and SPECIFIC_ NAME.

Each procedure description has the the following columns:

  1. PROCEDURE_CAT String => procedure catalog (may be null)
  2. PROCEDURE_SCHEM String => procedure schema (may be null)
  3. PROCEDURE_NAME String => procedure name
  4. reserved for future use
  5. reserved for future use
  6. reserved for future use
  7. REMARKS String => explanatory comment on the procedure
  8. PROCEDURE_TYPE short => kind of procedure:
    • procedureResultUnknown - Cannot determine if a return value will be returned
    • procedureNoResult - Does not return a return value
    • procedureReturnsResult - Returns a return value
  9. SPECIFIC_NAME String => The name which uniquely identifies this procedure within its schema.

A user may not have permissions to execute any of the procedures that are returned by getProcedures

Parameters:
catalog - a catalog name; must match the catalog name as it is stored in the database; "" retrieves those without a catalog; null means that the catalog name should not be used to narrow the search
schemaPattern - a schema name pattern; must match the schema name as it is stored in the database; "" retrieves those without a schema; null means that the schema name should not be used to narrow the search
procedureNamePattern - a procedure name pattern; must match the procedure name as it is stored in the database
Returns:
ResultSet - each row is a procedure description
Throws:
java.sql.SQLException - if a database access error occurs
See Also:
DatabaseMetaData.getSearchStringEscape()

getSchemas

public java.sql.ResultSet getSchemas()
                              throws java.sql.SQLException
Retrieves the schema names available in this database. The results are ordered by TABLE_CATALOG and TABLE_SCHEM.

The schema columns are:

  1. TABLE_SCHEM String => schema name
  2. TABLE_CATALOG String => catalog name (may be null)

Returns:
a ResultSet object in which each row is a schema description
Throws:
java.sql.SQLException - if a database access error occurs

getSchemas

public java.sql.ResultSet getSchemas(java.lang.String catalog,
                                     java.lang.String schemaPattern)
                              throws java.sql.SQLException
Retrieves the schema names available in this database. The results are ordered by TABLE_CATALOG and TABLE_SCHEM.

The schema columns are:

  1. TABLE_SCHEM String => schema name
  2. TABLE_CATALOG String => catalog name (may be null)

Parameters:
catalog - a catalog name; must match the catalog name as it is stored in the database;"" retrieves those without a catalog; null means catalog name should not be used to narrow down the search.
schemaPattern - a schema name; must match the schema name as it is stored in the database; null means schema name should not be used to narrow down the search.
Returns:
a ResultSet object in which each row is a schema description
Throws:
java.sql.SQLException - if a database access error occurs
Since:
1.6
See Also:
DatabaseMetaData.getSearchStringEscape()

getTables

public java.sql.ResultSet getTables(java.lang.String catalog,
                                    java.lang.String schemaPattern,
                                    java.lang.String tableNamePattern,
                                    java.lang.String[] types)
                             throws java.sql.SQLException
Retrieves a description of the tables available in the given catalog. Only table descriptions matching the catalog, schema, table name and type criteria are returned. They are ordered by TABLE_TYPE, TABLE_CAT, TABLE_SCHEM and TABLE_NAME.

Each table 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. TABLE_TYPE String => table type. Typical types are "TABLE", "VIEW", "SYSTEM TABLE", "GLOBAL TEMPORARY", "LOCAL TEMPORARY", "ALIAS", "SYNONYM".
  5. REMARKS String => explanatory comment on the table
  6. TYPE_CAT String => the types catalog (may be null)
  7. TYPE_SCHEM String => the types schema (may be null)
  8. TYPE_NAME String => type name (may be null)
  9. SELF_REFERENCING_COL_NAME String => name of the designated "identifier" column of a typed table (may be null)
  10. REF_GENERATION String => specifies how values in SELF_REFERENCING_COL_NAME are created. Values are "SYSTEM", "USER", "DERIVED". (may be null)

Note: Some databases may not return information for all tables.

Parameters:
catalog - a catalog name; must match the catalog name as it is stored in the database; "" retrieves those without a catalog; null means that the catalog name should not be used to narrow the search
schemaPattern - a schema name pattern; must match the schema name as it is stored in the database; "" retrieves those without a schema; null means that the schema name should not be used to narrow the search
tableNamePattern - a table name pattern; must match the table name as it is stored in the database
types - a list of table types, which must be from the list of table types returned from DatabaseMetaData.getTableTypes(),to include; null returns all types
Returns:
ResultSet - each row is a table description
Throws:
java.sql.SQLException - if a database access error occurs
See Also:
DatabaseMetaData.getSearchStringEscape()

getTablePrivileges

public java.sql.ResultSet getTablePrivileges(java.lang.String catalog,
                                             java.lang.String schemaPattern,
                                             java.lang.String tableNamePattern)
                                      throws java.sql.SQLException
Retrieves a description of the access rights for each table available in a catalog. Note that a table privilege applies to one or more columns in the table. It would be wrong to assume that this privilege applies to all columns (this may be true for some systems but is not true for all.)

Only privileges matching the schema and table name criteria are returned. They are ordered by TABLE_CAT, TABLE_SCHEM, TABLE_NAME, and PRIVILEGE.

Each privilige description has the following columns:

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

Parameters:
catalog - a catalog name; must match the catalog name as it is stored in the database; "" retrieves those without a catalog; null means that the catalog name should not be used to narrow the search
schemaPattern - a schema name pattern; must match the schema name as it is stored in the database; "" retrieves those without a schema; null means that the schema name should not be used to narrow the search
tableNamePattern - a table name pattern; must match the table name as it is stored in the database
Returns:
ResultSet - each row is a table privilege description
Throws:
java.sql.SQLException - if a database access error occurs
See Also:
DatabaseMetaData.getSearchStringEscape()

getUDTs

public java.sql.ResultSet getUDTs(java.lang.String catalog,
                                  java.lang.String schemaPattern,
                                  java.lang.String typeNamePattern,
                                  int[] types)
                           throws java.sql.SQLException
Throws:
java.sql.SQLException

getVersionColumns

public java.sql.ResultSet getVersionColumns(java.lang.String catalog,
                                            java.lang.String schema,
                                            java.lang.String table)
                                     throws java.sql.SQLException
Throws:
java.sql.SQLException