Package org.h2.result

Class SearchRow

  • All Implemented Interfaces:
    HasSQL, Typed
    Direct Known Subclasses:
    Row, SimpleRowValue

    public abstract class SearchRow
    extends Value
    The base class for rows stored in a table, and for partial rows stored in the index.
    • Field Detail

      • ROWID_INDEX

        public static final int ROWID_INDEX
        Index of a virtual "_ROWID_" column within a row or a table
        See Also:
        Constant Field Values
      • MATCH_ALL_ROW_KEY

        public static long MATCH_ALL_ROW_KEY
        If the key is this value, then the key is considered equal to all other keys, when comparing.
      • MEMORY_CALCULATE

        public static final int MEMORY_CALCULATE
        The constant that means "memory usage is unknown and needs to be calculated first".
        See Also:
        Constant Field Values
      • key

        protected long key
        The row key.
    • Constructor Detail

      • SearchRow

        public SearchRow()
    • Method Detail

      • getColumnCount

        public abstract int getColumnCount()
        Get the column count.
        Returns:
        the column count
      • isNull

        public boolean isNull​(int index)
        Determine if specified column contains NULL
        Parameters:
        index - column index
        Returns:
        true if NULL
      • getValue

        public abstract Value getValue​(int index)
        Get the value for the column
        Parameters:
        index - the column number (starting with 0)
        Returns:
        the value
      • setValue

        public abstract void setValue​(int index,
                                      Value v)
        Set the value for given column
        Parameters:
        index - the column number (starting with 0)
        v - the new value
      • setKey

        public void setKey​(long key)
        Set the unique key of the row.
        Parameters:
        key - the key
      • getKey

        public long getKey()
        Get the unique key of the row.
        Returns:
        the key
      • getMemory

        public abstract int getMemory()
        Get the estimated memory used for this row, in bytes.
        Overrides:
        getMemory in class Value
        Returns:
        the memory
      • copyFrom

        public abstract void copyFrom​(SearchRow source)
        Copy all relevant values from the source to this row.
        Parameters:
        source - source of column values
      • getType

        public TypeInfo getType()
        Description copied from interface: Typed
        Returns the data type.
        Specified by:
        getType in interface Typed
        Specified by:
        getType in class Value
        Returns:
        the data type
      • getValueType

        public int getValueType()
        Description copied from class: Value
        Get the value type.
        Specified by:
        getValueType in class Value
        Returns:
        the value type
      • getSQL

        public java.lang.StringBuilder getSQL​(java.lang.StringBuilder builder,
                                              int sqlFlags)
        Description copied from interface: HasSQL
        Appends the SQL statement of this object to the specified builder.
        Parameters:
        builder - string builder
        sqlFlags - formatting flags
        Returns:
        the specified string builder
      • getString

        public java.lang.String getString()
        Description copied from class: Value
        Get the value as a string.
        Specified by:
        getString in class Value
        Returns:
        the string
      • hashCode

        public int hashCode()
        Specified by:
        hashCode in class Value
      • equals

        public boolean equals​(java.lang.Object other)
        Description copied from class: Value
        Check if the two values have the same hash code. No data conversion is made; this method returns false if the other object is not of the same class. For some values, compareTo may return 0 even if equals return false. Example: ValueDecimal 0.0 and 0.00.
        Specified by:
        equals in class Value
        Parameters:
        other - the other value
        Returns:
        true if they are equal
      • compareTypeSafe

        public int compareTypeSafe​(Value v,
                                   CompareMode mode,
                                   CastDataProvider provider)
        Description copied from class: Value
        Compare this value against another value given that the values are of the same data type.
        Specified by:
        compareTypeSafe in class Value
        Parameters:
        v - the other value
        mode - the compare mode
        provider - the cast information provider
        Returns:
        0 if both values are equal, -1 if the other value is smaller, and 1 otherwise