private static DataType bindDbDatatype()

in java/clickhouse-connector/src/integration-test/java/com/epam/deltix/timebase/connector/clickhouse/FullStreamTests.java [291:339]


    private static DataType bindDbDatatype(String field, boolean primaryNullable) {
        if (field.contains("list")){
            return new ArrayDataType(primaryNullable || field.startsWith("nullable"), bindDbDatatype(getSubField(field), primaryNullable));
        }
        boolean nullable = primaryNullable || field.contains("nullable");
        if (field.startsWith("asciitext") || field.startsWith("text")) {
            return new VarcharDataType("UTF8", nullable, true);
        }
        if (field.startsWith("textalphanumeric") || field.startsWith("alphanumeric")) {
            return new VarcharDataType("ALPHANUMERIC(10)", nullable, true);
        }
        if (field.startsWith("binary")) {
            return new BinaryDataType(nullable, 0);
        }
        if (field.startsWith("bool")) {
            return new BooleanDataType(nullable);
        }
        if (field.startsWith("byte")) {
            return new IntegerDataType(IntegerDataType.ENCODING_INT8, nullable);
        }
        if (field.startsWith("short")) {
            return new IntegerDataType(IntegerDataType.ENCODING_INT16, nullable);
        }
        if (field.startsWith("int")) {
            return new IntegerDataType(IntegerDataType.ENCODING_INT32, nullable);
        }
        if (field.startsWith("long")) {
            return new IntegerDataType(IntegerDataType.ENCODING_INT64, nullable);
        }
        if (field.startsWith("decimal")) {
            return new FloatDataType(FloatDataType.ENCODING_DECIMAL64, nullable);
        }
        if (field.startsWith("double")) {
            return new FloatDataType(FloatDataType.ENCODING_FIXED_DOUBLE, nullable);
        }
        if (field.startsWith("float")) {
            return new FloatDataType(FloatDataType.ENCODING_FIXED_FLOAT, nullable);
        }
        if (field.startsWith("enum")) {
            return new EnumDataType(nullable, new EnumClassDescriptor("deltix.qsrv.test.messages.TestEnum", "enum", "ZERO", "ONE", "TWO", "THREE", "FOUR", "FIVE"));
        }
        if (field.startsWith("timeofday")) {
            return new TimeOfDayDataType(nullable);
        }
        if (field.startsWith("timestamp")) {
            return new DateTimeDataType(nullable);
        }
        return null;
    }