Class CommandContainer

java.lang.Object
org.h2.command.Command
org.h2.command.CommandContainer
All Implemented Interfaces:
AutoCloseable, CommandInterface

public class CommandContainer extends Command
Represents a single SQL statements. It wraps a prepared statement.
  • Field Details

    • prepared

      private Prepared prepared
    • readOnlyKnown

      private boolean readOnlyKnown
    • readOnly

      private boolean readOnly
  • Constructor Details

  • Method Details

    • clearCTE

      static void clearCTE(SessionLocal session, Prepared prepared)
      Clears CTE views for a specified statement.
      Parameters:
      session - the session
      prepared - prepared statement
    • clearCTE

      static void clearCTE(SessionLocal session, List<TableView> views)
      Clears CTE views.
      Parameters:
      session - the session
      views - list of view
    • getParameters

      public ArrayList<? extends ParameterInterface> getParameters()
      Description copied from class: Command
      Get the list of parameters.
      Specified by:
      getParameters in interface CommandInterface
      Specified by:
      getParameters in class Command
      Returns:
      the list of parameters
    • isTransactional

      public boolean isTransactional()
      Description copied from class: Command
      Check if this command is transactional. If it is not, then it forces the current transaction to commit.
      Specified by:
      isTransactional in class Command
      Returns:
      true if it is
    • isQuery

      public boolean isQuery()
      Description copied from class: Command
      Check if this command is a query.
      Specified by:
      isQuery in interface CommandInterface
      Specified by:
      isQuery in class Command
      Returns:
      true if it is
    • recompileIfRequired

      private void recompileIfRequired()
    • update

      public ResultWithGeneratedKeys update(Object generatedKeysRequest)
      Description copied from class: Command
      Execute an updating statement (for example insert, delete, or update), if this is possible.
      Specified by:
      update in class Command
      Parameters:
      generatedKeysRequest - false if generated keys are not needed, true if generated keys should be configured automatically, int[] to specify column indices to return generated keys from, or String[] to specify column names to return generated keys from
      Returns:
      the update count and generated keys, if any
    • executeUpdateWithGeneratedKeys

      private ResultWithGeneratedKeys executeUpdateWithGeneratedKeys(DataChangeStatement statement, Object generatedKeysRequest)
    • query

      public ResultInterface query(long maxrows)
      Description copied from class: Command
      Execute a query statement, if this is possible.
      Specified by:
      query in class Command
      Parameters:
      maxrows - the maximum number of rows returned
      Returns:
      the local result set
    • stop

      public void stop()
      Description copied from interface: CommandInterface
      Stop the command execution, release all locks and resources
      Specified by:
      stop in interface CommandInterface
      Overrides:
      stop in class Command
    • canReuse

      public boolean canReuse()
      Description copied from class: Command
      Whether the command is already closed (in which case it can be re-used).
      Overrides:
      canReuse in class Command
      Returns:
      true if it can be re-used
    • isReadOnly

      public boolean isReadOnly()
      Description copied from class: Command
      Check if this command is read only.
      Specified by:
      isReadOnly in class Command
      Returns:
      true if it is
    • queryMeta

      public ResultInterface queryMeta()
      Description copied from class: Command
      Get an empty result set containing the meta data.
      Specified by:
      queryMeta in class Command
      Returns:
      an empty result set
    • isCacheable

      public boolean isCacheable()
      Overrides:
      isCacheable in class Command
    • getCommandType

      public int getCommandType()
      Description copied from interface: CommandInterface
      Get command type.
      Returns:
      one of the constants above
    • clearCTE

      void clearCTE()
      Clean up any associated CTE.
    • getDependencies

      public Set<DbObject> getDependencies()
      Specified by:
      getDependencies in class Command
    • isCurrentCommandADefineCommand

      protected boolean isCurrentCommandADefineCommand()
      Description copied from class: Command
      Is the command we just tried to execute a DefineCommand (i.e. DDL).
      Specified by:
      isCurrentCommandADefineCommand in class Command
      Returns:
      true if yes