Class Tuple

java.lang.Object
org.postgresql.core.Tuple

public class Tuple extends Object
Class representing a row in a ResultSet.
  • Constructor Summary

    Constructors
    Constructor
    Description
    Tuple(byte @Nullable [][] data)
    Construct a populated tuple.
    Tuple(int length)
    Construct an empty tuple.
  • Method Summary

    Modifier and Type
    Method
    Description
    @org.checkerframework.checker.index.qual.NonNegative int
    Number of fields in the tuple
    byte @Nullable []
    get(@org.checkerframework.checker.index.qual.NonNegative int index)
    Get the data for the given field
    @org.checkerframework.checker.index.qual.NonNegative int
    Total length in bytes of the tuple data.
    Create a read-only copy of the tuple
    void
    set(@org.checkerframework.checker.index.qual.NonNegative int index, byte @Nullable [] fieldData)
    Set the given field to the given data.
    Create a copy of the tuple for updating.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • Tuple

      public Tuple(int length)
      Construct an empty tuple. Used in updatable result sets.
      Parameters:
      length - the number of fields in the tuple.
    • Tuple

      public Tuple(byte @Nullable [][] data)
      Construct a populated tuple. Used when returning results.
      Parameters:
      data - the tuple data
  • Method Details

    • fieldCount

      public @org.checkerframework.checker.index.qual.NonNegative int fieldCount()
      Number of fields in the tuple
      Returns:
      number of fields
    • length

      public @org.checkerframework.checker.index.qual.NonNegative int length()
      Total length in bytes of the tuple data.
      Returns:
      the number of bytes in this tuple
    • get

      @Pure public byte @Nullable [] get(@org.checkerframework.checker.index.qual.NonNegative int index)
      Get the data for the given field
      Parameters:
      index - 0-based field position in the tuple
      Returns:
      byte array of the data
    • updateableCopy

      public Tuple updateableCopy()
      Create a copy of the tuple for updating.
      Returns:
      a copy of the tuple that allows updates
    • readOnlyCopy

      public Tuple readOnlyCopy()
      Create a read-only copy of the tuple
      Returns:
      a copy of the tuple that does not allow updates
    • set

      public void set(@org.checkerframework.checker.index.qual.NonNegative int index, byte @Nullable [] fieldData)
      Set the given field to the given data.
      Parameters:
      index - 0-based field position
      fieldData - the data to set