Class Invocation


  • public class Invocation
    extends Object
    One invocation, from PostgreSQL, of functionality implemented using PL/Java.

    This class is the Java counterpart of the struct Invocation_ in the C code, but while there is a new stack-allocated C structure on every entry from PG to PL/Java, no instance of this class is created unless requested (with current(); once requested, a reference to it is saved in the C struct for the duration of the invocation.

    One further piece of magic applies to set-returning functions. Under the value-per-call protocol, there is technically a new entry into PL/Java, and a new C Invocation_ struct, for every row to be returned, but that low-level complication is hidden at this level: a single instance of this class, if once requested, will be remembered throughout the value-per-call sequence of calls.

    Author:
    Thomas Hallgren
    • Method Detail

      • getNestingLevel

        public int getNestingLevel()
        Returns:
        The nesting level of this invocation
      • onExit

        public void onExit​(boolean withError)
                    throws SQLException
        Called from the backend when the invokation exits. Should not be invoked any other way.
        Throws:
        SQLException
      • current

        public static Invocation current()
        Returns:
        The current invocation