Class RowUtil

java.lang.Object
org.apache.derby.impl.sql.execute.RowUtil

public class RowUtil extends Object
Utility class manipulating rows.

Note: this class is public so it may be used by Replication execution code. It is basically not public.

  • Field Details

    • rowCountBase

      private static long rowCountBase
      Row count base added for testing JDBC 4.2
  • Constructor Details

    • RowUtil

      public RowUtil()
  • Method Details

    • setRowCountBase

      public static void setRowCountBase(long newBase)
      Debug method used to test the setLargeMaxRows() method added by JDBC 4.2. This method is a NOP on a production (insane) build of Derby.
    • getRowCountBase

      public static long getRowCountBase()
      Retrieve the row count base
    • getEmptyValueRow

      public static ExecRow getEmptyValueRow(int columnCount, LanguageConnectionContext lcc)
      Get an empty ExecRow.
      Parameters:
      columnCount - the number of columns in the row.
      Returns:
      the row.
    • getEmptyIndexRow

      public static ExecIndexRow getEmptyIndexRow(int columnCount, LanguageConnectionContext lcc)
      Get an empty ExecIndexRow.
      Parameters:
      columnCount - the number of columns in the row.
      Returns:
      the row.
    • copyCloneColumns

      public static void copyCloneColumns(ExecRow to, ExecRow from, int count)
      Clone an ExecRow's columns and place the coloned columns in another ExecRow.
      Parameters:
      to - Place the cloned columns here.
      from - Get the columns to clone here.
      count - Clone this number of columns.
    • copyRefColumns

      public static void copyRefColumns(ExecRow to, ExecRow from)
      Copy references for an ExecRow's columns to another ExecRow.
      Parameters:
      to - Place the column references here.
      from - Get the column references from here.
    • copyRefColumns

      public static void copyRefColumns(ExecRow to, ExecRow from, int count) throws StandardException
      Copy references for an ExecRow's columns to another ExecRow.
      Parameters:
      to - Place the column references here.
      from - Get the column references from here.
      count - Copy this number of column references.
      Throws:
      StandardException
    • copyRefColumns

      public static void copyRefColumns(ExecRow to, ExecRow from, int start, int count) throws StandardException
      Copy references for an ExecRow's columns to another ExecRow.
      Parameters:
      to - Place the column references here.
      from - Get the column references from here.
      start - The 0 based index of the first column to copy.
      count - Copy this number of column references.
      Throws:
      StandardException
    • copyRefColumns

      public static void copyRefColumns(ExecRow to, int toStart, ExecRow from, int fromStart, int count) throws StandardException
      Copy references for an ExecRow's columns to another ExecRow.
      Parameters:
      to - Place the column references here.
      toStart - The 0-based index of the first column to replace.
      from - Get the column references from here.
      fromStart - The 0 based index of the first column to copy.
      count - Copy this number of column references.
      Throws:
      StandardException
    • copyRefColumns

      public static void copyRefColumns(ExecRow to, ExecRow from, int[] positions) throws StandardException
      Copy references for an ExecRow's columns to another ExecRow.
      Parameters:
      to - Place the column references here.
      from - Get the column references from here.
      positions - array of 1-based column ids to copy from "from" to "to"
      Throws:
      StandardException
    • copyRefColumns

      public static void copyRefColumns(ExecRow to, ExecRow from, FormatableBitSet positions) throws StandardException
      Copy references for an ExecRow's columns to another ExecRow. For copying from a compact array to a reconstituted array. E.g. if positions = {2, 4}, and from = {666, 777} then to => {null, 666, null, 777}. Will only go as far as to.getArray().length.
      Parameters:
      to - Place the column references here. Sparse array
      from - Get the column references from here. Compact array
      positions - array of 1-based column ids to copy from "from" to "to"
      Throws:
      StandardException
    • copyRefColumns

      public static void copyRefColumns(ExecRow setMe) throws StandardException
      Empty columns -- i.e. make them refer to a java null.

      This is useful to remove dangling references to a column.

      Parameters:
      setMe - Set columns in this storable to be empty.
      Throws:
      StandardException
    • toString

      public static String toString(ExecRow row)
      toString
      Parameters:
      row - the row
      Returns:
      the string
    • toString

      public static String toString(Object[] objs)
      toString
      Parameters:
      objs - the row array
      Returns:
      the string
    • toString

      public static String toString(ExecRow row, int startPoint, int endPoint)
      toString
      Parameters:
      row - the row
      startPoint - 0 based start point in row array, inclusive
      endPoint - 0 based end point in row array, inclusive
      Returns:
      the string
    • toString

      public static String toString(Object[] objs, int startPoint, int endPoint)
      toString
      Parameters:
      objs - the row array
      startPoint - 0 based start point in row array, inclusive
      endPoint - 0 based end point in row array, inclusive
      Returns:
      the string
    • toString

      public static String toString(ExecRow row, int[] positions)
      toString
      Parameters:
      row - the row
      positions - 1 based array of positions
      Returns:
      the string
    • toString

      public static String toString(Object[] objs, int[] positions)
      toString
      Parameters:
      objs - the row array
      positions - 1 based array of positions
      Returns:
      the string
    • intArrayToString

      public static String intArrayToString(int[] colMap)
      intArrayToString
      Parameters:
      colMap - the int array
      Returns:
      the string
    • inAscendingOrder

      public static boolean inAscendingOrder(int[] colMap)
    • shift

      public static FormatableBitSet shift(FormatableBitSet bitSet, int n)
      Shift a FormatableBitSet N bits toward the zero end. e.g. shift({2,4}) -> {1,3}.
      Parameters:
      bitSet - the bit set
      n - the number of bits to shift
      Returns:
      a new FormatableBitSet with the shifted result