Class ClickHouseLongValue

    • Constructor Detail

      • ClickHouseLongValue

        protected ClickHouseLongValue​(boolean isNull,
                                      boolean unsigned,
                                      long value)
    • Method Detail

      • ofNull

        public static ClickHouseLongValue ofNull​(boolean unsigned)
        Create a new instance representing null value of long.
        Parameters:
        unsigned - true if the long is unsigned; false otherwise
        Returns:
        new instance representing null value
      • ofNull

        public static ClickHouseLongValue ofNull​(ClickHouseValue ref,
                                                 boolean unsigned)
        Update given value to null or create a new instance if ref is null.
        Parameters:
        ref - object to update, could be null
        unsigned - true if the value is unsigned; false otherwise
        Returns:
        same object as ref or a new instance if it's null
      • of

        public static ClickHouseLongValue of​(long value,
                                             boolean unsigned)
        Wrap the given value.
        Parameters:
        value - value
        unsigned - true if the value is unsigned; false otherwise
        Returns:
        object representing the value
      • of

        public static ClickHouseLongValue of​(Number value)
        Wrap the given value.
        Parameters:
        value - value
        Returns:
        object representing the value
      • of

        public static ClickHouseLongValue of​(ClickHouseValue ref,
                                             boolean unsigned,
                                             long value)
        Update value of the given object or create a new instance if ref is null.
        Parameters:
        ref - object to update, could be null
        unsigned - true if the value is unsigned; false otherwise
        value - value
        Returns:
        same object as ref or a new instance if it's null
      • getValue

        public long getValue()
        Gets value.
        Returns:
        value
      • copy

        public ClickHouseLongValue copy​(boolean deep)
        Description copied from interface: ClickHouseValue
        Gets a copy of this value object.
        Specified by:
        copy in interface ClickHouseValue
        Parameters:
        deep - true to create a deep copy; false for a shallow copy
        Returns:
        copy of this value object
      • isNullOrEmpty

        public boolean isNullOrEmpty()
        Description copied from interface: ClickHouseValue
        Checks if the value is null, or empty for non-null types like Array, Tuple and Map.

        Please pay attention that only nullability will be considered for String, meaning this method will return false for an empty string. This is because String is treated as value-based type instead of a container like Array.

        Specified by:
        isNullOrEmpty in interface ClickHouseValue
        Returns:
        true if the value is null or empty; false otherwise
      • isUnsigned

        public boolean isUnsigned()
      • asObject

        public Object asObject()
        Description copied from interface: ClickHouseValue
        Gets value as an object.
        Specified by:
        asObject in interface ClickHouseValue
        Returns:
        an object representing the value, could be null
      • asString

        public String asString​(int length,
                               Charset charset)
        Description copied from interface: ClickHouseValue
        Gets value as fixed length(in bytes) string.
        Specified by:
        asString in interface ClickHouseValue
        Parameters:
        length - byte length of the string, 0 or negative number means unbounded
        charset - charset, null is same as default(UTF-8)
        Returns:
        string value, could be null
      • resetToNullOrEmpty

        public ClickHouseLongValue resetToNullOrEmpty()
        Description copied from interface: ClickHouseValue
        Resets value to null, or empty when null is not supported(e.g. Array, Tuple and Map etc.).

        Keep in mind that String is value-based type, so this method will change its value to null instead of an empty string.

        Specified by:
        resetToNullOrEmpty in interface ClickHouseValue
        Returns:
        this object
      • toSqlExpression

        public String toSqlExpression()
        Description copied from interface: ClickHouseValue
        Converts the value to escaped SQL expression. For example, number 123 will be converted to 123, while string "12'3" will be converted to @{code '12\'3'}.
        Specified by:
        toSqlExpression in interface ClickHouseValue
        Returns:
        escaped SQL expression
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class Object