Package org.h2.result

Class DefaultRow

  • All Implemented Interfaces:
    HasSQL, Typed
    Direct Known Subclasses:
    Sparse

    public class DefaultRow
    extends Row
    The default implementation of a row in a table.
    • Field Detail

      • 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
      • data

        protected final Value[] data
        The values of the row (one entry per column).
      • memory

        private int memory
    • Constructor Detail

      • DefaultRow

        DefaultRow​(int columnCount)
      • DefaultRow

        public DefaultRow​(Value[] data)
      • DefaultRow

        public DefaultRow​(Value[] data,
                          int memory)
    • Method Detail

      • getValue

        public Value getValue​(int i)
        Description copied from class: SearchRow
        Get the value for the column
        Specified by:
        getValue in class SearchRow
        Parameters:
        i - the column number (starting with 0)
        Returns:
        the value
      • setValue

        public void setValue​(int i,
                             Value v)
        Description copied from class: SearchRow
        Set the value for given column
        Specified by:
        setValue in class SearchRow
        Parameters:
        i - the column number (starting with 0)
        v - the new value
      • getColumnCount

        public int getColumnCount()
        Description copied from class: SearchRow
        Get the column count.
        Specified by:
        getColumnCount in class SearchRow
        Returns:
        the column count
      • getMemory

        public int getMemory()
        Description copied from class: SearchRow
        Get the estimated memory used for this row, in bytes.
        Specified by:
        getMemory in class SearchRow
        Returns:
        the memory
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class Value
      • calculateMemory

        protected int calculateMemory()
        Calculate the estimated memory used for this row, in bytes.
        Returns:
        the memory
      • getValueList

        public Value[] getValueList()
        Description copied from class: Row
        Get values.
        Specified by:
        getValueList in class Row
        Returns:
        values
      • hasSharedData

        public boolean hasSharedData​(Row other)
        Description copied from class: Row
        Check whether this row and the specified row share the same underlying data with values. This method must return false when values are not equal and may return either true or false when they are equal. This method may be used only for optimizations and should not perform any slow checks, such as equality checks for all pairs of values.
        Overrides:
        hasSharedData in class Row
        Parameters:
        other - the other row
        Returns:
        true if rows share the same underlying data, false otherwise or when unknown
      • copyFrom

        public void copyFrom​(SearchRow source)
        Description copied from class: SearchRow
        Copy all relevant values from the source to this row.
        Specified by:
        copyFrom in class SearchRow
        Parameters:
        source - source of column values