public static Type getType ( int type , int collation , long precision , int scale ) { switch ( type ) { case Types . SQL_ALL_TYPES : return SQL_ALL_TYPES ; // return SQL_ALL_TYPES; // needs changes to Expression type resolution case Types . SQL_CHAR : case Types . SQL_VARCHAR : case Types . VARCHAR_IGNORECASE : case Types . SQL_CLOB : return CharacterType . getCharacterType ( type , precision ) ; case Types . SQL_INTEGER : return SQL_INTEGER ; case Types . SQL_SMALLINT : return SQL_SMALLINT ; case Types . SQL_BIGINT : return SQL_BIGINT ; case Types . TINYINT : return TINYINT ; case Types . SQL_FLOAT : if ( precision > 53 ) { throw Error . error ( ErrorCode . X_42592 , "" + precision ) ; } // $FALL-THROUGH$ case Types . SQL_REAL : case Types . SQL_DOUBLE : return SQL_DOUBLE ; case Types . SQL_NUMERIC : case Types . SQL_DECIMAL : if ( precision == 0 ) { precision = NumberType . defaultNumericPrecision ; } // A VoltDB extension to disable variable scale decimals scale = 12 ; // End of VoltDB extension return NumberType . getNumberType ( type , precision , scale ) ; case Types . SQL_BOOLEAN : return SQL_BOOLEAN ; case Types . SQL_BINARY : case Types . SQL_VARBINARY : case Types . SQL_BLOB : return BinaryType . getBinaryType ( type , precision ) ; case Types . SQL_BIT : case Types . SQL_BIT_VARYING : return BitType . getBitType ( type , precision ) ; case Types . SQL_DATE : case Types . SQL_TIME : case Types . SQL_TIME_WITH_TIME_ZONE : case Types . SQL_TIMESTAMP : case Types . SQL_TIMESTAMP_WITH_TIME_ZONE : return DateTimeType . getDateTimeType ( type , scale ) ; case Types . SQL_INTERVAL_YEAR : case Types . SQL_INTERVAL_YEAR_TO_MONTH : case Types . SQL_INTERVAL_MONTH : case Types . SQL_INTERVAL_DAY : case Types . SQL_INTERVAL_DAY_TO_HOUR : case Types . SQL_INTERVAL_DAY_TO_MINUTE : case Types . SQL_INTERVAL_DAY_TO_SECOND : case Types . SQL_INTERVAL_HOUR : case Types . SQL_INTERVAL_HOUR_TO_MINUTE : case Types . SQL_INTERVAL_HOUR_TO_SECOND : case Types . SQL_INTERVAL_MINUTE : case Types . SQL_INTERVAL_MINUTE_TO_SECOND : case Types . SQL_INTERVAL_SECOND : return IntervalType . getIntervalType ( type , precision , scale ) ; case Types . VOLT_GEOGRAPHY_POINT : return VOLT_GEOGRAPHY_POINT ; case Types . VOLT_GEOGRAPHY : return new VoltGeographyType ( precision ) ; case Types . OTHER : return OTHER ; default : throw Error . runtimeError ( ErrorCode . U_S0500 , "Type" ) ; } }
Enforces precision and scale limits on type