java.lang.Object
org.postgresql.pljava.internal.Portal
All Implemented Interfaces:
AutoCloseable, Portal

public class Portal extends Object implements Portal
The Portal correspons to the internal PostgreSQL Portal type.
Author:
Thomas Hallgren
  • Method Details

    • close

      public void close()
      Invalidates this structure and frees up memory using the internal function SPI_cursor_close
      Specified by:
      close in interface AutoCloseable
      Specified by:
      close in interface Portal
    • tupleDescriptor

      public TupleDescriptor tupleDescriptor() throws SQLException
      Returns the TupleDescriptor that describes the row tuples for this Portal.
      Specified by:
      tupleDescriptor in interface Portal
      Throws:
      SQLException - if the handle to the native structure is stale.
    • fetch

      public List<TupleTableSlot> fetch(Portal.Direction dir, long count) throws SQLException
      Specified by:
      fetch in interface Portal
      Throws:
      SQLException
    • move

      public long move(Portal.Direction dir, long count) throws SQLException
      Specified by:
      move in interface Portal
      Throws:
      SQLException
    • getName

      public String getName() throws SQLException
      Returns the name of this Portal.
      Throws:
      SQLException - if the handle to the native structure is stale.
    • getPortalPos

      public long getPortalPos() throws SQLException
      Returns the value of the portalPos attribute.
      Throws:
      SQLException - if the handle to the native structure is stale.
    • getTupleDesc

      public TupleDesc getTupleDesc() throws SQLException
      Returns the TupleDesc that describes the row Tuples for this Portal.
      Throws:
      SQLException - if the handle to the native structure is stale.
    • fetch

      public long fetch(boolean forward, long count) throws SQLException
      Performs an SPI_cursor_fetch.

      The fetched rows are parked at the C global SPI_tuptable; see SPI.getTupTable for retrieving them. (While faithful to the way the C API works, this seems a bit odd as a Java API, and suggests that calls to this method and then SPI.getTupTable would ideally be done inside a single doInPG.)

      Parameters:
      forward - Set to true for forward, false for backward.
      count - Maximum number of rows to fetch.
      Returns:
      The actual number of fetched rows.
      Throws:
      SQLException - if the handle to the native structure is stale.
    • isAtEnd

      public boolean isAtEnd() throws SQLException
      Returns the value of the atEnd attribute.
      Throws:
      SQLException - if the handle to the native structure is stale.
    • isAtStart

      public boolean isAtStart() throws SQLException
      Returns the value of the atStart attribute.
      Throws:
      SQLException - if the handle to the native structure is stale.
    • move

      public long move(boolean forward, long count) throws SQLException
      Performs an SPI_cursor_move.
      Parameters:
      forward - Set to true for forward, false for backward.
      count - Maximum number of rows to fetch.
      Returns:
      The actual number of rows moved.
      Throws:
      SQLException - if the handle to the native structure is stale.