static ImmutableList buildColumnsColumnMetaData()

in src/main/java/software/amazon/documentdb/jdbc/DocumentDbDatabaseMetaDataResultSets.java [459:863]


    static ImmutableList<JdbcColumnMetaData> buildColumnsColumnMetaData(
            final String schemaName) {
        if (columnsColumnMetaData == null) {
            //  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 column can include NULLs
            //        NO --- if the column cannot include NULLs
            //        empty string --- if the nullability for the column is unknown
            // 19. SCOPE_CATALOG 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 attribute (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
            // 24. IS_GENERATEDCOLUMN String => Indicates whether this is a generated column
            //        YES --- if this a generated column
            //        NO --- if this not a generated column
            //        empty string --- if it cannot be determined whether this is a generated column
            int ordinal = 0;
            columnsColumnMetaData = ImmutableList.<JdbcColumnMetaData>builder()
                    .add(new JdbcColumnMetaData(
                            ordinal++,
                            true, //caseSensitive,
                            ResultSetMetaData.columnNullable, //nullable,
                            false, //signed,
                            64, //displaySize,
                            "TABLE_CAT", //label,
                            "TABLE_CAT", //columnName,
                            schemaName, //schemaName,
                            0, //precision,
                            0, //scale,
                            Types.VARCHAR, //type.id,
                            JdbcType.VARCHAR.name(), //type.name,
                            String.class.getName()) //columnClassName
                    )
                    .add(new JdbcColumnMetaData(
                            ordinal++,
                            true, //caseSensitive,
                            ResultSetMetaData.columnNullable, //nullable,
                            false, //signed,
                            64, //displaySize,
                            "TABLE_SCHEM", //label,
                            "TABLE_SCHEM", //columnName,
                            schemaName, //schemaName,
                            0, //precision,
                            0, //scale,
                            Types.VARCHAR, //type.id,
                            JdbcType.VARCHAR.name(), //type.name,
                            String.class.getName()) //columnClassName
                    )
                    .add(new JdbcColumnMetaData(
                            ordinal++,
                            true, //caseSensitive,
                            ResultSetMetaData.columnNoNulls, //nullable,
                            false, //signed,
                            120, //displaySize,
                            "TABLE_NAME", //label,
                            "TABLE_NAME", //columnName,
                            schemaName, //schemaName,
                            0, //precision,
                            0, //scale,
                            Types.VARCHAR, //type.id,
                            JdbcType.VARCHAR.name(), //type.name,
                            String.class.getName()) //columnClassName
                    )
                    .add(new JdbcColumnMetaData(
                            ordinal++,
                            true, //caseSensitive,
                            ResultSetMetaData.columnNoNulls, //nullable,
                            false, //signed,
                            255, //displaySize,
                            "COLUMN_NAME", //label,
                            "COLUMN_NAME", //columnName,
                            schemaName, //schemaName,
                            0, //precision,
                            0, //scale,
                            Types.VARCHAR, //type.id,
                            JdbcType.VARCHAR.name(), //type.name,
                            String.class.getName()) //columnClassName
                    )
                    .add(new JdbcColumnMetaData(
                            ordinal++,
                            false, //caseSensitive,
                            ResultSetMetaData.columnNoNulls, //nullable,
                            true, //signed,
                            12, //displaySize,
                            "DATA_TYPE", //label,
                            "DATA_TYPE", //columnName,
                            schemaName, //schemaName,
                            0, //precision,
                            0, //scale,
                            Types.INTEGER, //type.id,
                            JdbcType.INTEGER.name(), //type.name,
                            int.class.getName()) //columnClassName
                    )
                    .add(new JdbcColumnMetaData(
                            ordinal++,
                            false, //caseSensitive,
                            ResultSetMetaData.columnNoNulls, //nullable,
                            false, //signed,
                            64, //displaySize,
                            "TYPE_NAME", //label,
                            "TYPE_NAME", //columnName,
                            schemaName, //schemaName,
                            0, //precision,
                            0, //scale,
                            Types.VARCHAR, //type.id,
                            JdbcType.VARCHAR.name(), //type.name,
                            String.class.getName()) //columnClassName
                    )
                    .add(new JdbcColumnMetaData(
                            ordinal++,
                            false, //caseSensitive,
                            ResultSetMetaData.columnNoNulls, //nullable,
                            true, //signed,
                            12, //displaySize,
                            "COLUMN_SIZE", //label,
                            "COLUMN_SIZE", //columnName,
                            schemaName, //schemaName,
                            0, //precision,
                            0, //scale,
                            Types.INTEGER, //type.id,
                            JdbcType.INTEGER.name(), //type.name,
                            int.class.getName()) //columnClassName
                    )
                    .add(new JdbcColumnMetaData(
                            ordinal++,
                            false, //caseSensitive,
                            ResultSetMetaData.columnNullable, //nullable,
                            true, //signed,
                            12, //displaySize,
                            "BUFFER_LENGTH", //label,
                            "BUFFER_LENGTH", //columnName,
                            schemaName, //schemaName,
                            0, //precision,
                            0, //scale,
                            Types.INTEGER, //type.id,
                            JdbcType.INTEGER.name(), //type.name,
                            int.class.getName()) //columnClassName
                    )
                    .add(new JdbcColumnMetaData(
                            ordinal++,
                            false, //caseSensitive,
                            ResultSetMetaData.columnNullable, //nullable,
                            true, //signed,
                            12, //displaySize,
                            "DECIMAL_DIGITS", //label,
                            "DECIMAL_DIGITS", //columnName,
                            schemaName, //schemaName,
                            0, //precision,
                            0, //scale,
                            Types.INTEGER, //type.id,
                            JdbcType.INTEGER.name(), //type.name,
                            int.class.getName()) //columnClassName
                    )
                    .add(new JdbcColumnMetaData(
                            ordinal++,
                            false, //caseSensitive,
                            ResultSetMetaData.columnNullable, //nullable,
                            true, //signed,
                            12, //displaySize,
                            "NUM_PREC_RADIX", //label,
                            "NUM_PREC_RADIX", //columnName,
                            schemaName, //schemaName,
                            0, //precision,
                            0, //scale,
                            Types.INTEGER, //type.id,
                            JdbcType.INTEGER.name(), //type.name,
                            int.class.getName()) //columnClassName
                    )
                    .add(new JdbcColumnMetaData(
                            ordinal++,
                            false, //caseSensitive,
                            ResultSetMetaData.columnNoNulls, //nullable,
                            true, //signed,
                            2, //displaySize,
                            "NULLABLE", //label,
                            "NULLABLE", //columnName,
                            schemaName, //schemaName,
                            0, //precision,
                            0, //scale,
                            Types.INTEGER, //type.id,
                            JdbcType.INTEGER.name(), //type.name,
                            int.class.getName()) //columnClassName
                    )
                    .add(new JdbcColumnMetaData(
                            ordinal++,
                            true, //caseSensitive,
                            ResultSetMetaData.columnNullable, //nullable,
                            false, //signed,
                            255, //displaySize,
                            "REMARKS", //label,
                            "REMARKS", //columnName,
                            schemaName, //schemaName,
                            0, //precision,
                            0, //scale,
                            Types.VARCHAR, //type.id,
                            JdbcType.VARCHAR.name(), //type.name,
                            String.class.getName()) //columnClassName
                    )
                    .add(new JdbcColumnMetaData(
                            ordinal++,
                            true, //caseSensitive,
                            ResultSetMetaData.columnNullable, //nullable,
                            false, //signed,
                            255, //displaySize,
                            "COLUMN_DEF", //label,
                            "COLUMN_DEF", //columnName,
                            schemaName, //schemaName,
                            0, //precision,
                            0, //scale,
                            Types.VARCHAR, //type.id,
                            JdbcType.VARCHAR.name(), //type.name,
                            String.class.getName()) //columnClassName
                    )
                    .add(new JdbcColumnMetaData(
                            ordinal++,
                            true, //caseSensitive,
                            ResultSetMetaData.columnNullable, //nullable,
                            true, //signed,
                            12, //displaySize,
                            "SQL_DATA_TYPE", //label,
                            "SQL_DATA_TYPE", //columnName,
                            schemaName, //schemaName,
                            0, //precision,
                            0, //scale,
                            Types.INTEGER, //type.id,
                            JdbcType.INTEGER.name(), //type.name,
                            int.class.getName()) //columnClassName
                    )
                    .add(new JdbcColumnMetaData(
                            ordinal++,
                            true, //caseSensitive,
                            ResultSetMetaData.columnNullable, //nullable,
                            true, //signed,
                            12, //displaySize,
                            "SQL_DATETIME_SUB", //label,
                            "SQL_DATETIME_SUB", //columnName,
                            schemaName, //schemaName,
                            0, //precision,
                            0, //scale,
                            Types.INTEGER, //type.id,
                            JdbcType.INTEGER.name(), //type.name,
                            int.class.getName()) //columnClassName
                    )
                    .add(new JdbcColumnMetaData(
                            ordinal++,
                            true, //caseSensitive,
                            ResultSetMetaData.columnNullable, //nullable,
                            true, //signed,
                            12, //displaySize,
                            "CHAR_OCTET_LENGTH", //label,
                            "CHAR_OCTET_LENGTH", //columnName,
                            schemaName, //schemaName,
                            0, //precision,
                            0, //scale,
                            Types.INTEGER, //type.id,
                            JdbcType.INTEGER.name(), //type.name,
                            int.class.getName()) //columnClassName
                    )
                    .add(new JdbcColumnMetaData(
                            ordinal++,
                            true, //caseSensitive,
                            ResultSetMetaData.columnNullable, //nullable,
                            false, //signed,
                            12, //displaySize,
                            "ORDINAL_POSITION", //label,
                            "ORDINAL_POSITION", //columnName,
                            schemaName, //schemaName,
                            0, //precision,
                            0, //scale,
                            Types.INTEGER, //type.id,
                            JdbcType.INTEGER.name(), //type.name,
                            int.class.getName()) //columnClassName
                    )
                    .add(new JdbcColumnMetaData(
                            ordinal++,
                            false, //caseSensitive,
                            ResultSetMetaData.columnNoNulls, //nullable,
                            false, //signed,
                            12, //displaySize,
                            "IS_NULLABLE", //label,
                            "IS_NULLABLE", //columnName,
                            schemaName, //schemaName,
                            0, //precision,
                            0, //scale,
                            Types.VARCHAR, //type.id,
                            JdbcType.VARCHAR.name(), //type.name,
                            String.class.getName()) //columnClassName
                    )
                    .add(new JdbcColumnMetaData(
                            ordinal++,
                            true, //caseSensitive,
                            ResultSetMetaData.columnNullable, //nullable,
                            false, //signed,
                            64, //displaySize,
                            "SCOPE_CATALOG", //label,
                            "SCOPE_CATALOG", //columnName,
                            schemaName, //schemaName,
                            0, //precision,
                            0, //scale,
                            Types.VARCHAR, //type.id,
                            JdbcType.VARCHAR.name(), //type.name,
                            String.class.getName()) //columnClassName
                    )
                    .add(new JdbcColumnMetaData(
                            ordinal++,
                            true, //caseSensitive,
                            ResultSetMetaData.columnNullable, //nullable,
                            false, //signed,
                            64, //displaySize,
                            "SCOPE_SCHEMA", //label,
                            "SCOPE_SCHEMA", //columnName,
                            schemaName, //schemaName,
                            0, //precision,
                            0, //scale,
                            Types.VARCHAR, //type.id,
                            JdbcType.VARCHAR.name(), //type.name,
                            String.class.getName()) //columnClassName
                    )
                    .add(new JdbcColumnMetaData(
                            ordinal++,
                            true, //caseSensitive,
                            ResultSetMetaData.columnNullable, //nullable,
                            false, //signed,
                            120, //displaySize,
                            "SCOPE_TABLE", //label,
                            "SCOPE_TABLE", //columnName,
                            schemaName, //schemaName,
                            0, //precision,
                            0, //scale,
                            Types.VARCHAR, //type.id,
                            JdbcType.VARCHAR.name(), //type.name,
                            String.class.getName()) //columnClassName
                    )
                    .add(new JdbcColumnMetaData(
                            ordinal++,
                            true, //caseSensitive,
                            ResultSetMetaData.columnNullable, //nullable,
                            true, //signed,
                            12, //displaySize,
                            "SOURCE_DATA_TYPE", //label,
                            "SOURCE_DATA_TYPE", //columnName,
                            schemaName, //schemaName,
                            0, //precision,
                            0, //scale,
                            Types.SMALLINT, //type.id,
                            JdbcType.SMALLINT.name(), //type.name,
                            short.class.getName()) //columnClassName
                    )
                    .add(new JdbcColumnMetaData(
                            ordinal++,
                            true, //caseSensitive,
                            ResultSetMetaData.columnNoNulls, //nullable,
                            false, //signed,
                            3, //displaySize,
                            "IS_AUTOINCREMENT", //label,
                            "IS_AUTOINCREMENT", //columnName,
                            schemaName, //schemaName,
                            0, //precision,
                            0, //scale,
                            Types.VARCHAR, //type.id,
                            JdbcType.VARCHAR.name(), //type.name,
                            String.class.getName()) //columnClassName
                    )
                    .add(new JdbcColumnMetaData(
                            ordinal, // not incremented
                            true, //caseSensitive,
                            ResultSetMetaData.columnNoNulls, //nullable,
                            false, //signed,
                            3, //displaySize,
                            "IS_GENERATEDCOLUMN", //label,
                            "IS_GENERATEDCOLUMN", //columnName,
                            schemaName, //schemaName,
                            0, //precision,
                            0, //scale,
                            Types.VARCHAR, //type.id,
                            JdbcType.VARCHAR.name(), //type.name,
                            String.class.getName()) //columnClassName
                    )
                    .build();
        }
        return columnsColumnMetaData;
    }