com.amazon.redshift.jdbc

## Class MetadataAPIHelper

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

Direct Known Subclasses:
  MetadataAPIPostProcessor, MetadataServerProxy

    public class MetadataAPIHelper
    extends Object

### Nested Class Summary

Nested Classes
`static class` `MetadataAPIHelper.BestRowIdenData` Data container for the getBestRowIdentifier() metadata operation.
`static interface` `MetadataAPIHelper.enumFunc<T extends Enum<T>>`
`protected static class` `MetadataAPIHelper.ForeignKeyColumnIndex` Enum representing the indices of columns in the result set of getImportedKeys/getExportedKeys.
`static class` `MetadataAPIHelper.GetBestRowIdentifier_Metadata` Define return columns for JDBC API getBestRowIdentifier according to the spec
`static class` `MetadataAPIHelper.GetCatalogs_Metadata`
`static class` `MetadataAPIHelper.GetColumnPrivileges_Metadata` Define return columns for JDBC API getColumnPrivileges according to the spec
`static class` `MetadataAPIHelper.GetColumns_Metadata`
`static class` `MetadataAPIHelper.GetForeignKeys_Metadata` Define return columns for JDBC API getImportedKeys according to the spec
`static class` `MetadataAPIHelper.GetFunctions_Metadata` Define return columns for JDBC API getFunctions according to the spec
`static class` `MetadataAPIHelper.GetFunctionsColumns_Metadata` Define return columns for JDBC API getFunctionsColumns according to the spec
`static class` `MetadataAPIHelper.GetPrimaryKeys_Metadata` Define return columns for JDBC API getPrimaryKeys according to the spec:
`static class` `MetadataAPIHelper.GetProcedures_Metadata` Define return columns for JDBC API getProcedures according to the spec
`static class` `MetadataAPIHelper.GetProceduresColumns_Metadata` Define return columns for JDBC API getProceduresColumns according to the spec
`static class` `MetadataAPIHelper.GetSchemas_Metadata`
`static class` `MetadataAPIHelper.GetTablePrivileges_Metadata` Define return columns for JDBC API getTablePrivileges according to the spec
`static class` `MetadataAPIHelper.GetTables_Metadata`
`static class` `MetadataAPIHelper.GetTableType_Metadata` Define return columns for JDBC API getTableType according to the spec
`protected static class` `MetadataAPIHelper.ProcedureFunctionColumnData` Data container for procedure and function column metadata used by getProcedureColumns() and getFunctionColumns().
`protected static class` `MetadataAPIHelper.RedshiftDataTypes`
`static class` `MetadataAPIHelper.ShowColumnsInfo` Data container for column metadata returned by the SHOW COLUMNS command.
`static class` `MetadataAPIHelper.ShowForeignKeysInfo` Data container for foreign key metadata returned by the SHOW CONSTRAINTS FOREIGN KEYS command.
`static class` `MetadataAPIHelper.ShowFunctionsInfo` Data container for user-defined function metadata returned by the SHOW FUNCTIONS command.
`static class` `MetadataAPIHelper.ShowGrantsInfo` Data container for privilege grant metadata returned by the SHOW GRANTS command.
`static class` `MetadataAPIHelper.ShowParametersInfo` Data container for stored procedure parameter metadata returned by the SHOW PARAMETERS command.
`static class` `MetadataAPIHelper.ShowPrimaryKeysInfo` Data container for primary key metadata returned by the SHOW CONSTRAINTS PRIMARY KEYS command.
`static class` `MetadataAPIHelper.ShowProceduresInfo` Data container for stored procedure metadata returned by the SHOW PROCEDURES command.
`static class` `MetadataAPIHelper.ShowSchemasInfo` Data container for schema metadata returned by the SHOW SCHEMAS command.
`static class` `MetadataAPIHelper.ShowTablesInfo` Data container for table metadata returned by the SHOW TABLES command.

### Field Summary

Fields
`protected RedshiftConnectionImpl` `connection`
`protected static String` `DATETIME_PRECISION_PATTERN`
`protected static String` `EMPTY_REMARKS`
`protected static Map<String,Integer>` `FUNCTION_COLUMN_TYPE_MAP`
`protected Field[]` `GET_BEST_ROW_IDENTIFIER_COLS`
`protected Field[]` `GET_CATALOGS_COLS`
`protected Field[]` `GET_COLUMN_PRIVILEGES_COLS`
`protected Field[]` `GET_COLUMNS_COLS`
`protected Field[]` `GET_FOREIGN_KEYS_COLS`
`protected Field[]` `GET_FUNCTIONS_COLS`
`protected Field[]` `GET_FUNCTIONS_COLUMNS_COLS`
`protected Field[]` `GET_PRIMARY_KEYS_COLS`
`protected Field[]` `GET_PROCEDURES_COLS`
`protected Field[]` `GET_PROCEDURES_COLUMNS_COLS`
`protected Field[]` `GET_SCHEMAS_COLS`
`protected Field[]` `GET_TABLE_PRIVILEGES_COLS`
`protected Field[]` `GET_TABLE_TYPE_COLS`
`protected Field[]` `GET_TABLES_COLS`
`protected short` `IMPORTED_KEY_NO_ACTION`
`protected short` `IMPORTED_KEY_NOT_DEFERRABLE`
`protected static String` `INTERVAL_PRECISION_PATTERN`
`protected static String` `IS_NULLABLE_VALUE`
`protected static String` `NULLABLE_UNKNOWN_VALUE`
`protected static String` `PRECISION_EXTRACTION_PATTERN`
`protected static String` `PRECISION_REMOVAL_PATTERN`
`protected static Map<String,Integer>` `PROCEDURE_COLUMN_TYPE_MAP`
`protected static String` `PSEUDO_COLUMN_VALUE`
`protected static String` `RADIX_VALUE`
`static String` `SHOW_COLUMNS_CHARACTER_MAXIMUM_LENGTH`
`static String` `SHOW_COLUMNS_COLLATION`
`static String` `SHOW_COLUMNS_COLUMN_DEFAULT`
`static String` `SHOW_COLUMNS_COLUMN_NAME`
`static String` `SHOW_COLUMNS_DATA_TYPE`
`static String` `SHOW_COLUMNS_DATABASE_NAME`
`static String` `SHOW_COLUMNS_DIST_KEY`
`static String` `SHOW_COLUMNS_ENCODING`
`static String` `SHOW_COLUMNS_IS_NULLABLE`
`static String` `SHOW_COLUMNS_NUMERIC_PRECISION`
`static String` `SHOW_COLUMNS_NUMERIC_SCALE`
`static String` `SHOW_COLUMNS_ORDINAL_POSITION`
`static String` `SHOW_COLUMNS_REMARKS`
`static String` `SHOW_COLUMNS_SCHEMA_NAME`
`static String` `SHOW_COLUMNS_SORT_KEY`
`static String` `SHOW_COLUMNS_SORT_KEY_TYPE`
`static String` `SHOW_COLUMNS_TABLE_NAME`
`static String` `SHOW_DATABASES_DATABASE_NAME`
`static String` `SHOW_FOREIGN_KEYS_DEFERRABILITY`
`static String` `SHOW_FOREIGN_KEYS_DELETE_RULE`
`static String` `SHOW_FOREIGN_KEYS_FK_COLUMN_NAME`
`static String` `SHOW_FOREIGN_KEYS_FK_DATABASE_NAME`
`static String` `SHOW_FOREIGN_KEYS_FK_NAME`
`static String` `SHOW_FOREIGN_KEYS_FK_SCHEMA_NAME`
`static String` `SHOW_FOREIGN_KEYS_FK_TABLE_NAME`
`static String` `SHOW_FOREIGN_KEYS_KEY_SEQ`
`static String` `SHOW_FOREIGN_KEYS_PK_COLUMN_NAME`
`static String` `SHOW_FOREIGN_KEYS_PK_DATABASE_NAME`
`static String` `SHOW_FOREIGN_KEYS_PK_NAME`
`static String` `SHOW_FOREIGN_KEYS_PK_SCHEMA_NAME`
`static String` `SHOW_FOREIGN_KEYS_PK_TABLE_NAME`
`static String` `SHOW_FOREIGN_KEYS_UPDATE_RULE`
`static String` `SHOW_FUNCTIONS_ARGUMENT_LIST`
`static String` `SHOW_FUNCTIONS_DATABASE_NAME`
`static String` `SHOW_FUNCTIONS_FUNCTION_NAME`
`static String` `SHOW_FUNCTIONS_RETURN_TYPE`
`static String` `SHOW_FUNCTIONS_SCHEMA_NAME`
`static String` `SHOW_GRANT_ADMIN_OPTION`
`static String` `SHOW_GRANT_COLUMN_NAME`
`static String` `SHOW_GRANT_DATABASE_NAME`
`static String` `SHOW_GRANT_GRANTOR`
`static String` `SHOW_GRANT_IDENTITY_NAME`
`static String` `SHOW_GRANT_OBJECT_NAME`
`static String` `SHOW_GRANT_PRIVILEGE_TYPE`
`static String` `SHOW_GRANT_SCHEMA_NAME`
`static String` `SHOW_GRANT_TABLE_NAME`
`static String` `SHOW_PARAMETERS_CHARACTER_MAXIMUM_LENGTH`
`static String` `SHOW_PARAMETERS_DATA_TYPE`
`static String` `SHOW_PARAMETERS_DATABASE_NAME`
`static String` `SHOW_PARAMETERS_FUNCTION_NAME`
`static String` `SHOW_PARAMETERS_NUMERIC_PRECISION`
`static String` `SHOW_PARAMETERS_NUMERIC_SCALE`
`static String` `SHOW_PARAMETERS_ORDINAL_POSITION`
`static String` `SHOW_PARAMETERS_PARAMETER_NAME`
`static String` `SHOW_PARAMETERS_PARAMETER_TYPE`
`static String` `SHOW_PARAMETERS_PROCEDURE_NAME`
`static String` `SHOW_PARAMETERS_SCHEMA_NAME`
`static String` `SHOW_PRIMARY_KEYS_COLUMN_NAME`
`static String` `SHOW_PRIMARY_KEYS_DATABASE_NAME`
`static String` `SHOW_PRIMARY_KEYS_KEY_SEQ`
`static String` `SHOW_PRIMARY_KEYS_PK_NAME`
`static String` `SHOW_PRIMARY_KEYS_SCHEMA_NAME`
`static String` `SHOW_PRIMARY_KEYS_TABLE_NAME`
`static String` `SHOW_PROCEDURES_ARGUMENT_LIST`
`static String` `SHOW_PROCEDURES_DATABASE_NAME`
`static String` `SHOW_PROCEDURES_PROCEDURE_NAME`
`static String` `SHOW_PROCEDURES_RETURN_TYPE`
`static String` `SHOW_PROCEDURES_SCHEMA_NAME`
`static String` `SHOW_SCHEMAS_DATABASE_NAME`
`static String` `SHOW_SCHEMAS_SCHEMA_NAME`
`static String` `SHOW_TABLES_DATABASE_NAME`
`static String` `SHOW_TABLES_DIST_STYLE`
`static String` `SHOW_TABLES_LAST_ALTERED_TIME`
`static String` `SHOW_TABLES_LAST_MODIFIED_TIME`
`static String` `SHOW_TABLES_OWNER`
`static String` `SHOW_TABLES_REMARKS`
`static String` `SHOW_TABLES_SCHEMA_NAME`
`static String` `SHOW_TABLES_TABLE_NAME`
`static String` `SHOW_TABLES_TABLE_SUBTYPE`
`static String` `SHOW_TABLES_TABLE_TYPE`
`protected String` `SQL_LIKE`
`protected String` `SQL_PREP_SHOWCOLUMNS`
`protected String` `SQL_PREP_SHOWCOLUMNSLIKE`
`protected String` `SQL_PREP_SHOWDATABASES`
`protected String` `SQL_PREP_SHOWFOREIGNEXPORTEDKEYS`
`protected String` `SQL_PREP_SHOWFOREIGNKEYS`
`protected String` `SQL_PREP_SHOWFUNCTIONS`
`protected String` `SQL_PREP_SHOWFUNCTIONSLIKE`
`protected String` `SQL_PREP_SHOWGRANTSCOLUMN`
`protected String` `SQL_PREP_SHOWGRANTSCOLUMNLIKE`
`protected String` `SQL_PREP_SHOWGRANTSTABLE`
`protected String` `SQL_PREP_SHOWPARAMETERSFUNCTION`
`protected String` `SQL_PREP_SHOWPARAMETERSPROCEDURE`
`protected String` `SQL_PREP_SHOWPRIMARYKEYS`
`protected String` `SQL_PREP_SHOWPROCEDURES`
`protected String` `SQL_PREP_SHOWPROCEDURESLIKE`
`protected String` `SQL_PREP_SHOWSCHEMAS`
`protected String` `SQL_PREP_SHOWSCHEMASLIKE`
`protected String` `SQL_PREP_SHOWTABLES`
`protected String` `SQL_PREP_SHOWTABLESLIKE`
`protected String` `SQL_SEMICOLON`
`protected static String` `TRAILING_SPACES_PATTERN`

### Constructor Summary

Constructors
Constructor and Description
`MetadataAPIHelper(RedshiftConnectionImpl connection)`

### Method Summary

All Methods Static Methods Instance Methods Concrete Methods
`static String` `convertSqlLikeToRegex(String pattern)` Convert SQL LIKE pattern to regex pattern
`protected PreparedStatement` `createMetaDataPreparedStatement(String sql)`
`protected Statement` `createMetaDataStatement()`
`protected Map.Entry<String,List<String>>` `createParameterizedQueryString(String argumentList, String sqlBase, String columnNamePattern)` Creates a parameterized SQL query string based on the argument list and base SQL statement.
`protected ResultSet` `createRs(Field[] col, List<Tuple> data)`
`protected byte[]` `encodeStr(String str)`
`protected String` `getAutoIncrement(String colDef)`
`protected String` `getColumnLength(String rsType)` Gets the column length for a given Redshift data type
`protected String` `getColumnSize(String rsType, String character_maximum_length, String numeric_precision)`
`protected String` `getDecimalDigit(String rsType, String numeric_scale, int precision, boolean customizePrecision)`
`protected byte[][]` `getEmptyTuple(Field[] col, int size)`
`static <T extends Enum<T> & MetadataAPIHelper.enumFunc<T>> Field[]` `getField(Supplier<T[]> enumObject)`
`protected static int` `getFunctionColumnType(String parameterType)`
`protected static int` `getFunctionType(String returnType)`
`protected static String` `getIsGrantable(Boolean admin_option)` Helper function to bridge the gap where SHOW return boolean but JDBC spec required YES/NO
`protected String` `getNullable(String nullable)`
`protected String` `getNumPrefixRadix(String rsType)`
`protected static int` `getProcedureColumnType(String parameterType)`
`protected static int` `getProcedureType(String returnType)`
`protected String` `getRSType(String rsType)`
`protected String` `getSpecificName(String name, String argument)`
`protected String` `getSQLType(String rsType)`
`static boolean` `patternMatch(String str, String pattern)` Pattern matching function similar to SQL LIKE operator.
`protected ResultSet` `runQuery(String sql)`
`protected static void` `sortForeignKeyTuples(List<Tuple> foreignKeyTuples, boolean isImported)` Sorts a list of foreign key tuples based on specified criteria.

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

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

### Field Detail

#### connection

    protected final RedshiftConnectionImpl connection

#### GET_CATALOGS_COLS

    protected final Field[] GET_CATALOGS_COLS

#### GET_SCHEMAS_COLS

    protected final Field[] GET_SCHEMAS_COLS

#### GET_TABLES_COLS

    protected final Field[] GET_TABLES_COLS

#### GET_COLUMNS_COLS

    protected final Field[] GET_COLUMNS_COLS

#### GET_PRIMARY_KEYS_COLS

    protected final Field[] GET_PRIMARY_KEYS_COLS

#### GET_FOREIGN_KEYS_COLS

    protected final Field[] GET_FOREIGN_KEYS_COLS

#### GET_BEST_ROW_IDENTIFIER_COLS

    protected final Field[] GET_BEST_ROW_IDENTIFIER_COLS

#### GET_COLUMN_PRIVILEGES_COLS

    protected final Field[] GET_COLUMN_PRIVILEGES_COLS

#### GET_TABLE_PRIVILEGES_COLS

    protected final Field[] GET_TABLE_PRIVILEGES_COLS

#### GET_PROCEDURES_COLS

    protected final Field[] GET_PROCEDURES_COLS

#### GET_PROCEDURES_COLUMNS_COLS

    protected final Field[] GET_PROCEDURES_COLUMNS_COLS

#### GET_FUNCTIONS_COLS

    protected final Field[] GET_FUNCTIONS_COLS

#### GET_FUNCTIONS_COLUMNS_COLS

    protected final Field[] GET_FUNCTIONS_COLUMNS_COLS

#### GET_TABLE_TYPE_COLS

    protected final Field[] GET_TABLE_TYPE_COLS

#### IMPORTED_KEY_NO_ACTION

    protected final short IMPORTED_KEY_NO_ACTION

See Also:
  Constant Field Values

#### IMPORTED_KEY_NOT_DEFERRABLE

    protected final short IMPORTED_KEY_NOT_DEFERRABLE

See Also:
  Constant Field Values

#### SHOW_DATABASES_DATABASE_NAME

    public static final String SHOW_DATABASES_DATABASE_NAME

See Also:
  Constant Field Values

#### SHOW_SCHEMAS_DATABASE_NAME

    public static final String SHOW_SCHEMAS_DATABASE_NAME

See Also:
  Constant Field Values

#### SHOW_SCHEMAS_SCHEMA_NAME

    public static final String SHOW_SCHEMAS_SCHEMA_NAME

See Also:
  Constant Field Values

#### SHOW_TABLES_DATABASE_NAME

    public static final String SHOW_TABLES_DATABASE_NAME

See Also:
  Constant Field Values

#### SHOW_TABLES_SCHEMA_NAME

    public static final String SHOW_TABLES_SCHEMA_NAME

See Also:
  Constant Field Values

#### SHOW_TABLES_TABLE_NAME

    public static final String SHOW_TABLES_TABLE_NAME

See Also:
  Constant Field Values

#### SHOW_TABLES_TABLE_TYPE

    public static final String SHOW_TABLES_TABLE_TYPE

See Also:
  Constant Field Values

#### SHOW_TABLES_REMARKS

    public static final String SHOW_TABLES_REMARKS

See Also:
  Constant Field Values

#### SHOW_TABLES_OWNER

    public static final String SHOW_TABLES_OWNER

See Also:
  Constant Field Values

#### SHOW_TABLES_LAST_ALTERED_TIME

    public static final String SHOW_TABLES_LAST_ALTERED_TIME

See Also:
  Constant Field Values

#### SHOW_TABLES_LAST_MODIFIED_TIME

    public static final String SHOW_TABLES_LAST_MODIFIED_TIME

See Also:
  Constant Field Values

#### SHOW_TABLES_DIST_STYLE

    public static final String SHOW_TABLES_DIST_STYLE

See Also:
  Constant Field Values

#### SHOW_TABLES_TABLE_SUBTYPE

    public static final String SHOW_TABLES_TABLE_SUBTYPE

See Also:
  Constant Field Values

#### SHOW_COLUMNS_DATABASE_NAME

    public static final String SHOW_COLUMNS_DATABASE_NAME

See Also:
  Constant Field Values

#### SHOW_COLUMNS_SCHEMA_NAME

    public static final String SHOW_COLUMNS_SCHEMA_NAME

See Also:
  Constant Field Values

#### SHOW_COLUMNS_TABLE_NAME

    public static final String SHOW_COLUMNS_TABLE_NAME

See Also:
  Constant Field Values

#### SHOW_COLUMNS_COLUMN_NAME

    public static final String SHOW_COLUMNS_COLUMN_NAME

See Also:
  Constant Field Values

#### SHOW_COLUMNS_ORDINAL_POSITION

    public static final String SHOW_COLUMNS_ORDINAL_POSITION

See Also:
  Constant Field Values

#### SHOW_COLUMNS_COLUMN_DEFAULT

    public static final String SHOW_COLUMNS_COLUMN_DEFAULT

See Also:
  Constant Field Values

#### SHOW_COLUMNS_IS_NULLABLE

    public static final String SHOW_COLUMNS_IS_NULLABLE

See Also:
  Constant Field Values

#### SHOW_COLUMNS_DATA_TYPE

    public static final String SHOW_COLUMNS_DATA_TYPE

See Also:
  Constant Field Values

#### SHOW_COLUMNS_CHARACTER_MAXIMUM_LENGTH

    public static final String SHOW_COLUMNS_CHARACTER_MAXIMUM_LENGTH

See Also:
  Constant Field Values

#### SHOW_COLUMNS_NUMERIC_PRECISION

    public static final String SHOW_COLUMNS_NUMERIC_PRECISION

See Also:
  Constant Field Values

#### SHOW_COLUMNS_NUMERIC_SCALE

    public static final String SHOW_COLUMNS_NUMERIC_SCALE

See Also:
  Constant Field Values

#### SHOW_COLUMNS_REMARKS

    public static final String SHOW_COLUMNS_REMARKS

See Also:
  Constant Field Values

#### SHOW_COLUMNS_SORT_KEY_TYPE

    public static final String SHOW_COLUMNS_SORT_KEY_TYPE

See Also:
  Constant Field Values

#### SHOW_COLUMNS_SORT_KEY

    public static final String SHOW_COLUMNS_SORT_KEY

See Also:
  Constant Field Values

#### SHOW_COLUMNS_DIST_KEY

    public static final String SHOW_COLUMNS_DIST_KEY

See Also:
  Constant Field Values

#### SHOW_COLUMNS_ENCODING

    public static final String SHOW_COLUMNS_ENCODING

See Also:
  Constant Field Values

#### SHOW_COLUMNS_COLLATION

    public static final String SHOW_COLUMNS_COLLATION

See Also:
  Constant Field Values

#### SHOW_PRIMARY_KEYS_DATABASE_NAME

    public static final String SHOW_PRIMARY_KEYS_DATABASE_NAME

See Also:
  Constant Field Values

#### SHOW_PRIMARY_KEYS_SCHEMA_NAME

    public static final String SHOW_PRIMARY_KEYS_SCHEMA_NAME

See Also:
  Constant Field Values

#### SHOW_PRIMARY_KEYS_TABLE_NAME

    public static final String SHOW_PRIMARY_KEYS_TABLE_NAME

See Also:
  Constant Field Values

#### SHOW_PRIMARY_KEYS_COLUMN_NAME

    public static final String SHOW_PRIMARY_KEYS_COLUMN_NAME

See Also:
  Constant Field Values

#### SHOW_PRIMARY_KEYS_KEY_SEQ

    public static final String SHOW_PRIMARY_KEYS_KEY_SEQ

See Also:
  Constant Field Values

#### SHOW_PRIMARY_KEYS_PK_NAME

    public static final String SHOW_PRIMARY_KEYS_PK_NAME

See Also:
  Constant Field Values

#### SHOW_FOREIGN_KEYS_PK_DATABASE_NAME

    public static final String SHOW_FOREIGN_KEYS_PK_DATABASE_NAME

See Also:
  Constant Field Values

#### SHOW_FOREIGN_KEYS_PK_SCHEMA_NAME

    public static final String SHOW_FOREIGN_KEYS_PK_SCHEMA_NAME

See Also:
  Constant Field Values

#### SHOW_FOREIGN_KEYS_PK_TABLE_NAME

    public static final String SHOW_FOREIGN_KEYS_PK_TABLE_NAME

See Also:
  Constant Field Values

#### SHOW_FOREIGN_KEYS_PK_COLUMN_NAME

    public static final String SHOW_FOREIGN_KEYS_PK_COLUMN_NAME

See Also:
  Constant Field Values

#### SHOW_FOREIGN_KEYS_FK_DATABASE_NAME

    public static final String SHOW_FOREIGN_KEYS_FK_DATABASE_NAME

See Also:
  Constant Field Values

#### SHOW_FOREIGN_KEYS_FK_SCHEMA_NAME

    public static final String SHOW_FOREIGN_KEYS_FK_SCHEMA_NAME

See Also:
  Constant Field Values

#### SHOW_FOREIGN_KEYS_FK_TABLE_NAME

    public static final String SHOW_FOREIGN_KEYS_FK_TABLE_NAME

See Also:
  Constant Field Values

#### SHOW_FOREIGN_KEYS_FK_COLUMN_NAME

    public static final String SHOW_FOREIGN_KEYS_FK_COLUMN_NAME

See Also:
  Constant Field Values

#### SHOW_FOREIGN_KEYS_KEY_SEQ

    public static final String SHOW_FOREIGN_KEYS_KEY_SEQ

See Also:
  Constant Field Values

#### SHOW_FOREIGN_KEYS_UPDATE_RULE

    public static final String SHOW_FOREIGN_KEYS_UPDATE_RULE

See Also:
  Constant Field Values

#### SHOW_FOREIGN_KEYS_DELETE_RULE

    public static final String SHOW_FOREIGN_KEYS_DELETE_RULE

See Also:
  Constant Field Values

#### SHOW_FOREIGN_KEYS_FK_NAME

    public static final String SHOW_FOREIGN_KEYS_FK_NAME

See Also:
  Constant Field Values

#### SHOW_FOREIGN_KEYS_PK_NAME

    public static final String SHOW_FOREIGN_KEYS_PK_NAME

See Also:
  Constant Field Values

#### SHOW_FOREIGN_KEYS_DEFERRABILITY

    public static final String SHOW_FOREIGN_KEYS_DEFERRABILITY

See Also:
  Constant Field Values

#### SHOW_GRANT_DATABASE_NAME

    public static final String SHOW_GRANT_DATABASE_NAME

See Also:
  Constant Field Values

#### SHOW_GRANT_SCHEMA_NAME

    public static final String SHOW_GRANT_SCHEMA_NAME

See Also:
  Constant Field Values

#### SHOW_GRANT_OBJECT_NAME

    public static final String SHOW_GRANT_OBJECT_NAME

See Also:
  Constant Field Values

#### SHOW_GRANT_TABLE_NAME

    public static final String SHOW_GRANT_TABLE_NAME

See Also:
  Constant Field Values

#### SHOW_GRANT_COLUMN_NAME

    public static final String SHOW_GRANT_COLUMN_NAME

See Also:
  Constant Field Values

#### SHOW_GRANT_GRANTOR

    public static final String SHOW_GRANT_GRANTOR

See Also:
  Constant Field Values

#### SHOW_GRANT_IDENTITY_NAME

    public static final String SHOW_GRANT_IDENTITY_NAME

See Also:
  Constant Field Values

#### SHOW_GRANT_PRIVILEGE_TYPE

    public static final String SHOW_GRANT_PRIVILEGE_TYPE

See Also:
  Constant Field Values

#### SHOW_GRANT_ADMIN_OPTION

    public static final String SHOW_GRANT_ADMIN_OPTION

See Also:
  Constant Field Values

#### SHOW_PROCEDURES_DATABASE_NAME

    public static final String SHOW_PROCEDURES_DATABASE_NAME

See Also:
  Constant Field Values

#### SHOW_PROCEDURES_SCHEMA_NAME

    public static final String SHOW_PROCEDURES_SCHEMA_NAME

See Also:
  Constant Field Values

#### SHOW_PROCEDURES_PROCEDURE_NAME

    public static final String SHOW_PROCEDURES_PROCEDURE_NAME

See Also:
  Constant Field Values

#### SHOW_PROCEDURES_RETURN_TYPE

    public static final String SHOW_PROCEDURES_RETURN_TYPE

See Also:
  Constant Field Values

#### SHOW_PROCEDURES_ARGUMENT_LIST

    public static final String SHOW_PROCEDURES_ARGUMENT_LIST

See Also:
  Constant Field Values

#### SHOW_FUNCTIONS_DATABASE_NAME

    public static final String SHOW_FUNCTIONS_DATABASE_NAME

See Also:
  Constant Field Values

#### SHOW_FUNCTIONS_SCHEMA_NAME

    public static final String SHOW_FUNCTIONS_SCHEMA_NAME

See Also:
  Constant Field Values

#### SHOW_FUNCTIONS_FUNCTION_NAME

    public static final String SHOW_FUNCTIONS_FUNCTION_NAME

See Also:
  Constant Field Values

#### SHOW_FUNCTIONS_RETURN_TYPE

    public static final String SHOW_FUNCTIONS_RETURN_TYPE

See Also:
  Constant Field Values

#### SHOW_FUNCTIONS_ARGUMENT_LIST

    public static final String SHOW_FUNCTIONS_ARGUMENT_LIST

See Also:
  Constant Field Values

#### SHOW_PARAMETERS_DATABASE_NAME

    public static final String SHOW_PARAMETERS_DATABASE_NAME

See Also:
  Constant Field Values

#### SHOW_PARAMETERS_SCHEMA_NAME

    public static final String SHOW_PARAMETERS_SCHEMA_NAME

See Also:
  Constant Field Values

#### SHOW_PARAMETERS_PROCEDURE_NAME

    public static final String SHOW_PARAMETERS_PROCEDURE_NAME

See Also:
  Constant Field Values

#### SHOW_PARAMETERS_FUNCTION_NAME

    public static final String SHOW_PARAMETERS_FUNCTION_NAME

See Also:
  Constant Field Values

#### SHOW_PARAMETERS_PARAMETER_NAME

    public static final String SHOW_PARAMETERS_PARAMETER_NAME

See Also:
  Constant Field Values

#### SHOW_PARAMETERS_ORDINAL_POSITION

    public static final String SHOW_PARAMETERS_ORDINAL_POSITION

See Also:
  Constant Field Values

#### SHOW_PARAMETERS_PARAMETER_TYPE

    public static final String SHOW_PARAMETERS_PARAMETER_TYPE

See Also:
  Constant Field Values

#### SHOW_PARAMETERS_DATA_TYPE

    public static final String SHOW_PARAMETERS_DATA_TYPE

See Also:
  Constant Field Values

#### SHOW_PARAMETERS_CHARACTER_MAXIMUM_LENGTH

    public static final String SHOW_PARAMETERS_CHARACTER_MAXIMUM_LENGTH

See Also:
  Constant Field Values

#### SHOW_PARAMETERS_NUMERIC_PRECISION

    public static final String SHOW_PARAMETERS_NUMERIC_PRECISION

See Also:
  Constant Field Values

#### SHOW_PARAMETERS_NUMERIC_SCALE

    public static final String SHOW_PARAMETERS_NUMERIC_SCALE

See Also:
  Constant Field Values

#### SQL_PREP_SHOWDATABASES

    protected final String SQL_PREP_SHOWDATABASES

See Also:
  Constant Field Values

#### SQL_PREP_SHOWSCHEMAS

    protected final String SQL_PREP_SHOWSCHEMAS

See Also:
  Constant Field Values

#### SQL_PREP_SHOWSCHEMASLIKE

    protected final String SQL_PREP_SHOWSCHEMASLIKE

See Also:
  Constant Field Values

#### SQL_PREP_SHOWTABLES

    protected final String SQL_PREP_SHOWTABLES

See Also:
  Constant Field Values

#### SQL_PREP_SHOWTABLESLIKE

    protected final String SQL_PREP_SHOWTABLESLIKE

See Also:
  Constant Field Values

#### SQL_PREP_SHOWCOLUMNS

    protected final String SQL_PREP_SHOWCOLUMNS

See Also:
  Constant Field Values

#### SQL_PREP_SHOWCOLUMNSLIKE

    protected final String SQL_PREP_SHOWCOLUMNSLIKE

See Also:
  Constant Field Values

#### SQL_PREP_SHOWPRIMARYKEYS

    protected final String SQL_PREP_SHOWPRIMARYKEYS

See Also:
  Constant Field Values

#### SQL_PREP_SHOWFOREIGNKEYS

    protected final String SQL_PREP_SHOWFOREIGNKEYS

See Also:
  Constant Field Values

#### SQL_PREP_SHOWFOREIGNEXPORTEDKEYS

    protected final String SQL_PREP_SHOWFOREIGNEXPORTEDKEYS

See Also:
  Constant Field Values

#### SQL_PREP_SHOWGRANTSCOLUMN

    protected final String SQL_PREP_SHOWGRANTSCOLUMN

See Also:
  Constant Field Values

#### SQL_PREP_SHOWGRANTSCOLUMNLIKE

    protected final String SQL_PREP_SHOWGRANTSCOLUMNLIKE

See Also:
  Constant Field Values

#### SQL_PREP_SHOWGRANTSTABLE

    protected final String SQL_PREP_SHOWGRANTSTABLE

See Also:
  Constant Field Values

#### SQL_PREP_SHOWPROCEDURES

    protected final String SQL_PREP_SHOWPROCEDURES

See Also:
  Constant Field Values

#### SQL_PREP_SHOWPROCEDURESLIKE

    protected final String SQL_PREP_SHOWPROCEDURESLIKE

See Also:
  Constant Field Values

#### SQL_PREP_SHOWFUNCTIONS

    protected final String SQL_PREP_SHOWFUNCTIONS

See Also:
  Constant Field Values

#### SQL_PREP_SHOWFUNCTIONSLIKE

    protected final String SQL_PREP_SHOWFUNCTIONSLIKE

See Also:
  Constant Field Values

#### SQL_PREP_SHOWPARAMETERSPROCEDURE

    protected final String SQL_PREP_SHOWPARAMETERSPROCEDURE

See Also:
  Constant Field Values

#### SQL_PREP_SHOWPARAMETERSFUNCTION

    protected final String SQL_PREP_SHOWPARAMETERSFUNCTION

See Also:
  Constant Field Values

#### SQL_SEMICOLON

    protected final String SQL_SEMICOLON

See Also:
  Constant Field Values

#### SQL_LIKE

    protected final String SQL_LIKE

See Also:
  Constant Field Values

#### DATETIME_PRECISION_PATTERN

    protected static final String DATETIME_PRECISION_PATTERN

See Also:
  Constant Field Values

#### INTERVAL_PRECISION_PATTERN

    protected static final String INTERVAL_PRECISION_PATTERN

See Also:
  Constant Field Values

#### PRECISION_EXTRACTION_PATTERN

    protected static final String PRECISION_EXTRACTION_PATTERN

See Also:
  Constant Field Values

#### PRECISION_REMOVAL_PATTERN

    protected static final String PRECISION_REMOVAL_PATTERN

See Also:
  Constant Field Values

#### TRAILING_SPACES_PATTERN

    protected static final String TRAILING_SPACES_PATTERN

See Also:
  Constant Field Values

#### RADIX_VALUE

    protected static final String RADIX_VALUE

See Also:
  Constant Field Values

#### NULLABLE_UNKNOWN_VALUE

    protected static final String NULLABLE_UNKNOWN_VALUE

See Also:
  Constant Field Values

#### EMPTY_REMARKS

    protected static final String EMPTY_REMARKS

See Also:
  Constant Field Values

#### IS_NULLABLE_VALUE

    protected static final String IS_NULLABLE_VALUE

See Also:
  Constant Field Values

#### PSEUDO_COLUMN_VALUE

    protected static final String PSEUDO_COLUMN_VALUE

See Also:
  Constant Field Values

#### PROCEDURE_COLUMN_TYPE_MAP

    protected static final Map<String,Integer> PROCEDURE_COLUMN_TYPE_MAP

#### FUNCTION_COLUMN_TYPE_MAP

    protected static final Map<String,Integer> FUNCTION_COLUMN_TYPE_MAP

### Constructor Detail

#### MetadataAPIHelper

    public MetadataAPIHelper(RedshiftConnectionImpl connection)

### Method Detail

#### getField

    public static <T extends Enum<T> & MetadataAPIHelper.enumFunc<T>> Field[] getField(Supplier<T[]> enumObject)

#### createMetaDataStatement

    protected Statement createMetaDataStatement()
                                         throws SQLException

Throws:
  `SQLException`

#### createMetaDataPreparedStatement

    protected PreparedStatement createMetaDataPreparedStatement(String sql)
                                                         throws SQLException

Throws:
  `SQLException`

#### createRs

    protected ResultSet createRs(Field[] col,
                                 List<Tuple> data)
                          throws SQLException

Throws:
  `SQLException`

#### runQuery

    protected ResultSet runQuery(String sql)
                          throws SQLException

Throws:
  `SQLException`

#### getEmptyTuple

    protected byte[][] getEmptyTuple(Field[] col,
                                     int size)
                              throws SQLException

Throws:
  `SQLException`

#### encodeStr

    protected byte[] encodeStr(String str)
                        throws SQLException

Throws:
  `SQLException`

#### getRSType

    protected String getRSType(String rsType)
                        throws SQLException

Throws:
  `SQLException`

#### getSQLType

    protected String getSQLType(String rsType)
                         throws SQLException

Throws:
  `SQLException`

#### getColumnSize

    protected String getColumnSize(String rsType,
                                   String character_maximum_length,
                                   String numeric_precision)

#### getColumnLength

    protected String getColumnLength(String rsType)

Gets the column length for a given Redshift data type

Parameters:
  `rsType` - The Redshift data type
Returns:
  The column length as a string, or null if not found

#### getDecimalDigit

    protected String getDecimalDigit(String rsType,
                                     String numeric_scale,
                                     int precision,
                                     boolean customizePrecision)

#### getNumPrefixRadix

    protected String getNumPrefixRadix(String rsType)

#### getNullable

    protected String getNullable(String nullable)

#### getAutoIncrement

    protected String getAutoIncrement(String colDef)

#### getSpecificName

    protected String getSpecificName(String name,
                                     String argument)
                              throws SQLException

Throws:
  `SQLException`

#### createParameterizedQueryString

    protected Map.Entry<String,List<String>> createParameterizedQueryString(String argumentList,
                                                                            String sqlBase,
                                                                            String columnNamePattern)
                                                                     throws SQLException

Creates a parameterized SQL query string based on the argument list and base SQL statement. Appends either a semicolon or LIKE clause depending on whether column_name_pattern is provided.

Parameters:
  `argumentList` - Comma-separated string of argument types (e.g. "integer, short, character varying")
  `sqlBase` - Base SQL statement to which parameters will be added (e.g. "SHOW PARAMETERS OF PROCEDURE")
  `columnNamePattern` - Optional pattern for filtering column names. If provided, adds LIKE clause instead of semicolon
Returns:
  A Pair containing: - String: Complete SQL query with appropriate placeholders and termination - `List<String>`: List of argument types with whitespace stripped
Throws:
  `SQLException`

#### getProcedureType

    protected static int getProcedureType(String returnType)

#### getFunctionType

    protected static int getFunctionType(String returnType)

#### getProcedureColumnType

    protected static int getProcedureColumnType(String parameterType)

#### getFunctionColumnType

    protected static int getFunctionColumnType(String parameterType)

#### sortForeignKeyTuples

    protected static void sortForeignKeyTuples(List<Tuple> foreignKeyTuples,
                                               boolean isImported)

Sorts a list of foreign key tuples based on specified criteria. The sorting is performed based on the following criteria, in order: 1. Catalog (PK_CATALOG for imported, FK_CATALOG for exported) 2. Schema (PK_SCHEMA for imported, FK_SCHEMA for exported) 3. Table (PK_TABLE for imported, FK_TABLE for exported) 4. Key sequence (KEY_SEQ)

Parameters:
  `foreignKeyTuples` - The list of foreign key tuples to be sorted.
  `isImported` - Boolean flag indicating whether the keys are imported (true) or exported (false). This affects which columns are used for comparison during sorting. Each comparison is done using the compareBytes method.

#### getIsGrantable

    protected static String getIsGrantable(Boolean admin_option)

Helper function to bridge the gap where SHOW return boolean but JDBC spec required YES/NO

#### patternMatch

    public static boolean patternMatch(String str,
                                       String pattern)

Pattern matching function similar to SQL LIKE operator. Driver currently treat empty string as null which match anything

Parameters:
  `str` - The input string to match
  `pattern` - The pattern to match against, containing wildcards: '%' - matches zero or more characters '_' - matches exactly one character
Returns:
  true if string matches the pattern, false otherwise

#### convertSqlLikeToRegex

    public static String convertSqlLikeToRegex(String pattern)

Convert SQL LIKE pattern to regex pattern

Parameters:
  `pattern` - SQL LIKE pattern with % and _ wildcards
Returns:
  Equivalent regex pattern