static ImmutableList buildAttributesColumnMetaData()

in src/main/java/software/amazon/documentdb/jdbc/DocumentDbDatabaseMetaDataResultSets.java [1003:1353]


    static ImmutableList<JdbcColumnMetaData> buildAttributesColumnMetaData(
            final String schemaName) {
        if (attributesColumnMetaData == null) {
            //  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)
            int ordinal = 0;
            attributesColumnMetaData = ImmutableList.<JdbcColumnMetaData>builder()
                    .add(new JdbcColumnMetaData(
                            ordinal++,
                            true, //caseSensitive,
                            ResultSetMetaData.columnNullable, //nullable,
                            false, //signed,
                            64, //displaySize,
                            "TYPE_CAT", //label,
                            "TYPE_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,
                            "TYPE_SCHEM", //label,
                            "TYPE_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,
                            "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++,
                            true, //caseSensitive,
                            ResultSetMetaData.columnNoNulls, //nullable,
                            false, //signed,
                            255, //displaySize,
                            "ATTR_NAME", //label,
                            "ATTR_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,
                            "ATTR_TYPE_NAME", //label,
                            "ATTR_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,
                            "ATTR_SIZE", //label,
                            "ATTR_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,
                            "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,
                            "ATTR_DEF", //label,
                            "ATTR_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, // not incremented
                            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
                    )
                    .build();
        }
        return attributesColumnMetaData;
    }