Class RowUtil
java.lang.Object
org.apache.derby.impl.sql.execute.RowUtil
Utility class manipulating rows.
Note: this class is public so it may be used by Replication execution code. It is basically not public.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static long
Row count base added for testing JDBC 4.2 -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic void
copyCloneColumns
(ExecRow to, ExecRow from, int count) Clone an ExecRow's columns and place the coloned columns in another ExecRow.static void
copyRefColumns
(ExecRow setMe) Empty columns -- i.e. make them refer to a java null.static void
copyRefColumns
(ExecRow to, int toStart, ExecRow from, int fromStart, int count) Copy references for an ExecRow's columns to another ExecRow.static void
copyRefColumns
(ExecRow to, ExecRow from) Copy references for an ExecRow's columns to another ExecRow.static void
copyRefColumns
(ExecRow to, ExecRow from, int count) Copy references for an ExecRow's columns to another ExecRow.static void
copyRefColumns
(ExecRow to, ExecRow from, int[] positions) Copy references for an ExecRow's columns to another ExecRow.static void
copyRefColumns
(ExecRow to, ExecRow from, int start, int count) Copy references for an ExecRow's columns to another ExecRow.static void
copyRefColumns
(ExecRow to, ExecRow from, FormatableBitSet positions) Copy references for an ExecRow's columns to another ExecRow.static ExecIndexRow
getEmptyIndexRow
(int columnCount, LanguageConnectionContext lcc) Get an empty ExecIndexRow.static ExecRow
getEmptyValueRow
(int columnCount, LanguageConnectionContext lcc) Get an empty ExecRow.static long
Retrieve the row count basestatic boolean
inAscendingOrder
(int[] colMap) static String
intArrayToString
(int[] colMap) intArrayToStringstatic void
setRowCountBase
(long newBase) Debug method used to test the setLargeMaxRows() method added by JDBC 4.2.static FormatableBitSet
shift
(FormatableBitSet bitSet, int n) Shift a FormatableBitSet N bits toward the zero end.static String
toStringstatic String
toStringstatic String
toStringstatic String
toStringstatic String
toStringstatic String
toString
-
Field Details
-
rowCountBase
private static long rowCountBaseRow 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
Get an empty ExecRow.- Parameters:
columnCount
- the number of columns in the row.- Returns:
- the row.
-
getEmptyIndexRow
Get an empty ExecIndexRow.- Parameters:
columnCount
- the number of columns in the row.- Returns:
- the row.
-
copyCloneColumns
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
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
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 arrayfrom
- Get the column references from here. Compact arraypositions
- array of 1-based column ids to copy from "from" to "to"- Throws:
StandardException
-
copyRefColumns
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
toString- Parameters:
row
- the row- Returns:
- the string
-
toString
toString- Parameters:
objs
- the row array- Returns:
- the string
-
toString
toString- Parameters:
row
- the rowstartPoint
- 0 based start point in row array, inclusiveendPoint
- 0 based end point in row array, inclusive- Returns:
- the string
-
toString
toString- Parameters:
objs
- the row arraystartPoint
- 0 based start point in row array, inclusiveendPoint
- 0 based end point in row array, inclusive- Returns:
- the string
-
toString
toString- Parameters:
row
- the rowpositions
- 1 based array of positions- Returns:
- the string
-
toString
toString- Parameters:
objs
- the row arraypositions
- 1 based array of positions- Returns:
- the string
-
intArrayToString
intArrayToString- Parameters:
colMap
- the int array- Returns:
- the string
-
inAscendingOrder
public static boolean inAscendingOrder(int[] colMap) -
shift
Shift a FormatableBitSet N bits toward the zero end. e.g. shift({2,4}) -> {1,3}.- Parameters:
bitSet
- the bit setn
- the number of bits to shift- Returns:
- a new FormatableBitSet with the shifted result
-