Class AnonymousBlockResult

java.lang.Object
dev.frostlake.executor.AnonymousBlockResult

public final class AnonymousBlockResult extends Object
The one-row result an anonymous block answers when it runs as a statement — directly, or as the text of an EXECUTE IMMEDIATE: a single column named anonymous block holding the value its RETURN produced, or NULL typed VARCHAR when the block ran to its end without a RETURN. A CALL answers the same shape with the column named after its procedure, and a RETURN TABLE answers its table instead.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final String
    The name Snowflake gives the one column of an anonymous block's result.
  • Method Summary

    Modifier and Type
    Method
    Description
    static DataType
    The type the result column declares for a value of type: a text at VARCHAR's full width and a binary at BINARY's, whatever width was written (live-verified: a VARCHAR(10) reads VARCHAR(16777216) and a BINARY(10) BINARY(8388608)); any other type as it is.
    static boolean
    Whether a statement is an anonymous block — [DECLARE …] BEGIN … END — in its own right.
    static ResultSet
    of(Object value, DataType type)
    The result of a block whose RETURN produced value.
    static ResultSet
    The result of a block that ran to its end without a RETURN.

    Methods inherited from class java.lang.Object

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

    • COLUMN

      public static final String COLUMN
      The name Snowflake gives the one column of an anonymous block's result.
      See Also:
  • Method Details

    • of

      public static ResultSet of(Object value, DataType type)
      The result of a block whose RETURN produced value.
      Parameters:
      value - the returned value, or null
      type - the type the result column declares
      Returns:
      the single-row, single-column result
    • withoutReturn

      public static ResultSet withoutReturn()
      The result of a block that ran to its end without a RETURN.
      Returns:
      one row holding NULL, typed VARCHAR
    • columnType

      public static DataType columnType(DataType type)
      The type the result column declares for a value of type: a text at VARCHAR's full width and a binary at BINARY's, whatever width was written (live-verified: a VARCHAR(10) reads VARCHAR(16777216) and a BINARY(10) BINARY(8388608)); any other type as it is.
      Parameters:
      type - the value's type, or null
      Returns:
      the column's type, or null when there is none
    • isBlock

      public static boolean isBlock(FrostlakeParser.StatementContext statement)
      Whether a statement is an anonymous block — [DECLARE …] BEGIN … END — in its own right.
      Parameters:
      statement - the statement's parse tree, or null
      Returns:
      true for a block statement