Class BinaryBufferRow

java.lang.Object
All Implemented Interfaces:
ProtocolEntity, ResultsetRow, Row

public class BinaryBufferRow
extends AbstractBufferRow
A BufferRow implementation that holds one row packet from a server-side prepared statement (which is re-used by the driver, and thus saves memory allocations), and tries when possible to avoid allocations to break out the results as individual byte[]s. Rows from a server-side prepared statement are encoded differently, so we have different ways of finding where each column is, and unpacking them. (this isn't possible when doing things like reading floating point values).
  • Constructor Details

  • Method Details

    • isBinaryEncoded

      public boolean isBinaryEncoded()
    • findAndSeekToOffset

      protected int findAndSeekToOffset​(int index)
    • getBytes

      public byte[] getBytes​(int index)
      Description copied from interface: Row
      Returns the value at the given column as a byte array. The bytes represent the raw values returned by the server.
      Parameters:
      index - index of column (starting at 0) to return from.
      Returns:
      the value for the given column; if the value is SQL NULL, the value returned is null
    • getNull

      public boolean getNull​(int columnIndex)
      Check whether a column is NULL and update the 'wasNull' status.
      Parameters:
      columnIndex - of the column value (starting at 0) to check.
      Returns:
      true if the column value is NULL, false if not.
    • setMetadata

      public Row setMetadata​(ColumnDefinition f)
      Description copied from interface: Row
      Set metadata to enable getValue functionality.
      Specified by:
      setMetadata in interface Row
      Overrides:
      setMetadata in class AbstractResultsetRow
      Parameters:
      f - ColumnDefinition
      Returns:
      Row
    • getValue

      public <T> T getValue​(int columnIndex, ValueFactory<T> vf)
      Implementation of getValue() based on the underlying Buffer object. Delegate to superclass for decoding.
      Type Parameters:
      T - type to decode to
      Parameters:
      columnIndex - index of column to retrieve value from (0-indexed, not JDBC 1-indexed)
      vf - value factory used to create the return value after decoding
      Returns:
      The return value from the value factory
    • setBytes

      public void setBytes​(int columnIndex, byte[] value)
      Description copied from interface: Row
      Sets the given byte array as a raw column value (only works currently with ByteArrayRow).
      Parameters:
      columnIndex - index of the column (starting at 0) to set to.
      value - the (raw) value to set