java.lang.Object
org.postgresql.pljava.internal.Portal

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

    Modifier and Type
    Method
    Description
    void
    Invalidates this structure and frees up memory using the internal function SPI_cursor_close
    long
    fetch(boolean forward, long count)
    Performs an SPI_cursor_fetch.
    Returns the name of this Portal.
    long
    Returns the value of the portalPos attribute.
    Returns the TupleDesc that describes the row Tuples for this Portal.
    boolean
    Returns the value of the atEnd attribute.
    boolean
    Returns the value of the atStart attribute.
    long
    move(boolean forward, long count)
    Performs an SPI_cursor_move.

    Methods inherited from class java.lang.Object

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

    • close

      public void close()
      Invalidates this structure and frees up memory using the internal function SPI_cursor_close
    • 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.