Commit ac6d32dc authored by Sonia Zorba's avatar Sonia Zorba
Browse files

Arraysize bugfix

parent b3db4da7
Loading
Loading
Loading
Loading
Loading
+11 −1
Original line number Original line Diff line number Diff line
@@ -47,6 +47,8 @@ public enum ADQL {
    CIRCLE,
    CIRCLE,
    POLYGON;
    POLYGON;


    private static final ADQL[] FIXED_LENGTH_TYPES = new ADQL[]{CHAR, BOOLEAN, SMALLINT, INTEGER, BIGINT, REAL, DOUBLE};

    /**
    /**
     * Returns a string representing a datatype which can't be interpreted as an
     * Returns a string representing a datatype which can't be interpreted as an
     * ADQL datatype (that is in case of not standard data types). Removes
     * ADQL datatype (that is in case of not standard data types). Removes
@@ -64,7 +66,15 @@ public enum ADQL {
     * @return true if the datatype has a variable length, false otherwise.
     * @return true if the datatype has a variable length, false otherwise.
     */
     */
    public static boolean isVariable(ADQL adql) {
    public static boolean isVariable(ADQL adql) {
        return adql.equals(VARCHAR) || adql.equals(VARBINARY) || adql.equals(CLOB) || adql.equals(BLOB);
        // Since unknow data types are mapped to string, here a negative-logic is used
        // (e.g. TIMESTAMP need to be considered as variable, in order to have
        // arraysize *, otherwise taplib will throw an error)
        for (ADQL value : FIXED_LENGTH_TYPES) {
            if (adql.equals(value)) {
                return false;
            }
        }
        return true;
    }
    }


    public static ADQL parse(String adqlStr) {
    public static ADQL parse(String adqlStr) {