com.amazon.redshift.jdbc

## Class MetadataServerAPIHelper

- java.lang.Object
- - com.amazon.redshift.jdbc.MetadataAPIHelper
  - - com.amazon.redshift.jdbc.MetadataServerAPIHelper

    public class MetadataServerAPIHelper
    extends MetadataAPIHelper

### Nested Class Summary

### Nested classes/interfaces inherited from class com.amazon.redshift.jdbc.MetadataAPIHelper

`MetadataAPIHelper.enumFunc<T extends Enum<T>>, MetadataAPIHelper.GetCatalogs_Metadata, MetadataAPIHelper.GetColumns_Metadata, MetadataAPIHelper.GetSchemas_Metadata, MetadataAPIHelper.GetTables_Metadata`

### Field Summary

### Fields inherited from class com.amazon.redshift.jdbc.MetadataAPIHelper

`connection, GET_CATALOGS_COLS, GET_COLUMNS_COLS, GET_SCHEMAS_COLS, GET_TABLES_COLS, prepare_QUOTE_IDENT, prepare_QUOTE_LITERAL, QUOTE_IDENT_parameter_index, QUOTE_IDENT_result_col_index, QUOTE_LITERAL_parameter_index, QUOTE_LITERAL_result_col_index, SHOW_COLUMNS_CHARACTER_MAXIMUM_LENGTH, SHOW_COLUMNS_COLUMN_DEFAULT, SHOW_COLUMNS_COLUMN_NAME, SHOW_COLUMNS_DATA_TYPE, SHOW_COLUMNS_DATABASE_NAME, SHOW_COLUMNS_IS_NULLABLE, SHOW_COLUMNS_NUMERIC_PRECISION, SHOW_COLUMNS_NUMERIC_SCALE, SHOW_COLUMNS_ORDINAL_POSITION, SHOW_COLUMNS_REMARKS, SHOW_COLUMNS_SCHEMA_NAME, SHOW_COLUMNS_TABLE_NAME, SHOW_DATABASES_DATABASE_NAME, SHOW_SCHEMAS_DATABASE_NAME, SHOW_SCHEMAS_SCHEMA_NAME, SHOW_TABLES_DATABASE_NAME, SHOW_TABLES_REMARKS, SHOW_TABLES_SCHEMA_NAME, SHOW_TABLES_TABLE_NAME, SHOW_TABLES_TABLE_TYPE, SQL_PREP_SHOWCOLUMNS, SQL_PREP_SHOWDATABASES, SQL_PREP_SHOWDATABASESLIKE, SQL_PREP_SHOWSCHEMAS, SQL_PREP_SHOWSCHEMASLIKE, SQL_PREP_SHOWTABLES, SQL_SHOWCOLUMNS, SQL_SHOWCOLUMNSLIKE, SQL_SHOWDATABASES, SQL_SHOWDATABASESLIKE, SQL_SHOWSCHEMAS, SQL_SHOWSCHEMASLIKE, SQL_SHOWTABLES, SQL_SHOWTABLESLIKE`

### Constructor Summary

Constructors
Constructor and Description
`MetadataServerAPIHelper(RedshiftConnectionImpl connection)`

### Method Summary

All Methods Instance Methods Concrete Methods
`protected List<String>` `callGetCatalogList(String catalog, boolean isSingleDatabaseMetaData)` Helper function to get a list of catalog name
`protected String` `callQuoteIdent(String input)` Helper function to call QUOTE_IDENT and return result as string
`protected String` `callQuoteLiteral(String input)` Helper function to call QUOTE_LITERAL and return result as string
`protected ResultSet` `callShowColumns(String catalog, String schema, String table, String column)` Helper function to determine whether calling SHOW COLUMNS with LIKE or not
`protected ResultSet` `callShowColumnsWithLike(String catalog, String schema, String table, String column)` Helper function to call SHOW COLUMNS with LIKE
`protected ResultSet` `callShowColumnsWithOUTLike(String catalog, String schema, String table)` Helper function to call SHOW COLUMNS
`protected ResultSet` `callShowSchemas(String catalog, String schema)` Helper function to determine whether calling SHOW SCHEMAS with LIKE or not
`protected ResultSet` `callShowSchemasWithLike(String catalog, String schema)` Helper function to call SHOW SCHEMAS with LIKE
`protected ResultSet` `callShowSchemasWithOUTLike(String catalog)` Helper function to call SHOW SCHEMAS
`protected ResultSet` `callShowTables(String catalog, String schema, String table)` Helper function to determine whether calling SHOW TABLES with LIKE or not
`protected ResultSet` `callShowTablesWithLike(String catalog, String schema, String table)` Helper function to call SHOW TABLES with LIKE
`protected ResultSet` `callShowTablesWithOUTLike(String catalog, String schema)` Helper function to call SHOW TABLES
`protected List<String>` `getCatalogList(boolean isSingleDatabaseMetaData)` Helper function to retrieve a list of catalog name from SHOW DATABASES
`protected ResultSet` `getCatalogsServerAPI()` Returns a Result set for SHOW DATABASES
`protected List<ResultSet>` `getColumnsServerAPI(String catalog, String schemaPattern, String tableNamePattern, String columnNamePattern, boolean retEmpty, boolean isSingleDatabaseMetaData)` Returns a list of intermediate result set for SHOW COLUMNS
`protected List<ResultSet>` `getSchemasServerAPI(String catalog, String schemaPattern, boolean retEmpty, boolean isSingleDatabaseMetaData)` Returns a list of intermediate result set for SHOW SCHEMAS
`protected List<ResultSet>` `getTablesServerAPI(String catalog, String schemaPattern, String tableNamePattern, boolean retEmpty, boolean isSingleDatabaseMetaData)` Returns a list of intermediate result set for SHOW TABLES

### Methods inherited from class com.amazon.redshift.jdbc.MetadataAPIHelper

`createEmptyRs, createMetaDataPreparedStatement, createMetaDataStatement, createNullRs, createRs, encodeStr, getAutoIncrement, getColumnSize, getDecimalDigit, getEmptyTuple, getEmptyTupleList, getField, getNullable, getNullTuple, getNullTupleList, getNumPrefixRadix, getRSType, getSQLType, runQuery`

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

### Constructor Detail

#### MetadataServerAPIHelper

    public MetadataServerAPIHelper(RedshiftConnectionImpl connection)
                            throws SQLException

Throws:
  `SQLException`

### Method Detail

#### getCatalogsServerAPI

    protected ResultSet getCatalogsServerAPI()
                                      throws SQLException

Returns a Result set for SHOW DATABASES

Returns:
  the result set for SHOW DATABASES
Throws:
  `SQLException`

#### getSchemasServerAPI

    protected List<ResultSet> getSchemasServerAPI(String catalog,
                                                  String schemaPattern,
                                                  boolean retEmpty,
                                                  boolean isSingleDatabaseMetaData)
                                           throws SQLException

Returns a list of intermediate result set for SHOW SCHEMAS

Parameters:
  `catalog` - a catalog name; must match the catalog name as it is stored in the database; 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; null means that the schema name should not be used to narrow the search
  `retEmpty` - boolean to determine if we want to directly return empty result without calling any SHOW command
  `isSingleDatabaseMetaData` - boolean to determine if we want to retrieve metadata information only from current connected database
Returns:
  the list of intermediate result set for SHOW SCHEMAS
Throws:
  `SQLException`

#### getTablesServerAPI

    protected List<ResultSet> getTablesServerAPI(String catalog,
                                                 String schemaPattern,
                                                 String tableNamePattern,
                                                 boolean retEmpty,
                                                 boolean isSingleDatabaseMetaData)
                                          throws SQLException

Returns a list of intermediate result set for SHOW TABLES

Parameters:
  `catalog` - a catalog name; must match the catalog name as it is stored in the database; 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; 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
  `retEmpty` - boolean to determine if we want to directly return empty result without calling any SHOW command
  `isSingleDatabaseMetaData` - boolean to determine if we want to retrieve metadata information only from current connected database
Returns:
  the list of intermediate result set for SHOW TABLES
Throws:
  `SQLException`

#### getColumnsServerAPI

    protected List<ResultSet> getColumnsServerAPI(String catalog,
                                                  String schemaPattern,
                                                  String tableNamePattern,
                                                  String columnNamePattern,
                                                  boolean retEmpty,
                                                  boolean isSingleDatabaseMetaData)
                                           throws SQLException

Returns a list of intermediate result set for SHOW COLUMNS

Parameters:
  `catalog` - a catalog name; must match the catalog name as it is stored in the database; 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; 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
  `retEmpty` - boolean to determine if we want to directly return empty result without calling any SHOW command
  `isSingleDatabaseMetaData` - boolean to determine if we want to retrieve metadata information only from current connected database
Returns:
  the list of intermediate result set for SHOW COLUMNS
Throws:
  `SQLException`

#### callGetCatalogList

    protected List<String> callGetCatalogList(String catalog,
                                              boolean isSingleDatabaseMetaData)
                                       throws SQLException

Helper function to get a list of catalog name

Parameters:
  `catalog` - a catalog name; must match the catalog name as it is stored in the database; null means that the catalog name should not be used to narrow the search
  `isSingleDatabaseMetaData` - boolean to determine if we want to retrieve metadata information only from current connected database
Returns:
  the list of catalog name
Throws:
  `SQLException`

#### getCatalogList

    protected List<String> getCatalogList(boolean isSingleDatabaseMetaData)
                                   throws SQLException

Helper function to retrieve a list of catalog name from SHOW DATABASES

Parameters:
  `isSingleDatabaseMetaData` - boolean to determine if we want to retrieve metadata information only from current connected database
Returns:
  the list of catalog name from SHOW DATABASES
Throws:
  `SQLException`

#### callShowSchemas

    protected ResultSet callShowSchemas(String catalog,
                                        String schema)
                                 throws SQLException

Helper function to determine whether calling SHOW SCHEMAS with LIKE or not

Parameters:
  `catalog` - a catalog name (can't be null)
  `schema` - a schema name pattern; must match the schema name as it is stored in the database; null means that the schema name should not be used to narrow the search
Returns:
  result set for SHOW SCHEMAS
Throws:
  `SQLException`

#### callShowSchemasWithOUTLike

    protected ResultSet callShowSchemasWithOUTLike(String catalog)
                                            throws SQLException

Helper function to call SHOW SCHEMAS

Parameters:
  `catalog` - a catalog name (can't be null)
Returns:
  result set for SHOW SCHEMAS
Throws:
  `SQLException`

#### callShowSchemasWithLike

    protected ResultSet callShowSchemasWithLike(String catalog,
                                                String schema)
                                         throws SQLException

Helper function to call SHOW SCHEMAS with LIKE

Parameters:
  `catalog` - a catalog name (can't be null)
  `schema` - a schema name pattern (can't be null)
Returns:
  result set for SHOW SCHEMAS with LIKE
Throws:
  `SQLException`

#### callShowTables

    protected ResultSet callShowTables(String catalog,
                                       String schema,
                                       String table)
                                throws SQLException

Helper function to determine whether calling SHOW TABLES with LIKE or not

Parameters:
  `catalog` - a catalog name (can't be null)
  `schema` - a schema name (can't be null or pattern)
  `table` - a table name pattern; must match the table name as it is stored in the database
Returns:
  result set for SHOW TABLES
Throws:
  `SQLException`

#### callShowTablesWithOUTLike

    protected ResultSet callShowTablesWithOUTLike(String catalog,
                                                  String schema)
                                           throws SQLException

Helper function to call SHOW TABLES

Parameters:
  `catalog` - a catalog name (can't be null)
  `schema` - a schema name (can't be null or pattern)
Returns:
  result set for SHOW TABLES
Throws:
  `SQLException`

#### callShowTablesWithLike

    protected ResultSet callShowTablesWithLike(String catalog,
                                               String schema,
                                               String table)
                                        throws SQLException

Helper function to call SHOW TABLES with LIKE

Parameters:
  `catalog` - a catalog name (can't be null)
  `schema` - a schema name (can't be null or pattern)
  `table` - a table name pattern (can't be null)
Returns:
  result set for SHOW TABLES with LIKE
Throws:
  `SQLException`

#### callShowColumns

    protected ResultSet callShowColumns(String catalog,
                                        String schema,
                                        String table,
                                        String column)
                                 throws SQLException

Helper function to determine whether calling SHOW COLUMNS with LIKE or not

Parameters:
  `catalog` - a catalog name (can't be null)
  `schema` - a schema name (can't be null or pattern)
  `table` - a table name (can't be null or pattern)
  `column` - a column name pattern; must match the column name as it is stored in the database
Returns:
  result set for SHOW COLUMNS
Throws:
  `SQLException`

#### callShowColumnsWithOUTLike

    protected ResultSet callShowColumnsWithOUTLike(String catalog,
                                                   String schema,
                                                   String table)
                                            throws SQLException

Helper function to call SHOW COLUMNS

Parameters:
  `catalog` - a catalog name (can't be null)
  `schema` - a schema name (can't be null or pattern)
  `table` - a table name (can't be null or pattern)
Returns:
  result set for SHOW COLUMNS
Throws:
  `SQLException`

#### callShowColumnsWithLike

    protected ResultSet callShowColumnsWithLike(String catalog,
                                                String schema,
                                                String table,
                                                String column)
                                         throws SQLException

Helper function to call SHOW COLUMNS with LIKE

Parameters:
  `catalog` - a catalog name (can't be null)
  `schema` - a schema name (can't be null or pattern)
  `table` - a table name pattern (can't be null or pattern)
  `column` - a column name pattern (can't be null)
Returns:
  result set for SHOW COLUMNS with LIKE
Throws:
  `SQLException`

#### callQuoteLiteral

    protected String callQuoteLiteral(String input)
                               throws SQLException

Helper function to call QUOTE_LITERAL and return result as string

Parameters:
  `input` - the input string we want to parse into QUOTE_LITERAL
Returns:
  the input string with proper quoting
Throws:
  `SQLException`

#### callQuoteIdent

    protected String callQuoteIdent(String input)
                             throws SQLException

Helper function to call QUOTE_IDENT and return result as string

Parameters:
  `input` - the input string we want to parse into QUOTE_IDENT
Returns:
  the input string with proper quoting
Throws:
  `SQLException`