Package org.teiid

Interface CommandContext

  • All Known Implementing Classes:
    CommandContext

    public interface CommandContext
    Context information for the currently executing command. Can be used as an argument to UDFs.
    • Method Detail

      • getVdbName

        String getVdbName()
        Get the current vdb name
        Returns:
      • getVdbVersion

        String getVdbVersion()
        Get the current vdb version
        Returns:
      • getConnectionId

        String getConnectionId()
        Get the connection id
        Returns:
      • getNextRand

        double getNextRand()
        Get the next random double value
        Returns:
      • getNextRand

        double getNextRand​(long seed)
        Sets the seed value and returns the next random double value. Additional calls to getNextRand() will be based upon the seed value.
        Parameters:
        seed -
        Returns:
      • getProcessorBatchSize

        int getProcessorBatchSize()
        Get the processor batch size set on the BufferManager
        Returns:
        - the nominal batch size target. actual batch sizes will vary based upon the column types
      • getServerTimeZone

        TimeZone getServerTimeZone()
        Get the server TimeZone
        Returns:
      • getSubject

        Subject getSubject()
        Get the current subject
        Returns:
      • getSession

        Session getSession()
        Get the current session
        Returns:
      • getCommandPayload

        Serializable getCommandPayload()
        Get the current command payload
        Returns:
        may be null if the client did not set a payload
      • getRequestId

        String getRequestId()
        Get the current request id
        Returns:
      • getAllowedDataPolicies

        Map<String,​DataPolicy> getAllowedDataPolicies()
        Get the user's data policies, never null
        Returns:
      • getVdb

        VDB getVdb()
        Get the current vdb
        Returns:
      • addListener

        void addListener​(CommandListener listener)
        Add a listener for command events
        Parameters:
        listener -
      • removeListener

        void removeListener​(CommandListener listener)
        Add a listener for command events
        Parameters:
        listener -
      • getReuseCount

        long getReuseCount()
        Get the number of times this command has been reused. Useful in continuous executions.
        Returns:
        See Also:
        isContinuous()
      • getVDBClassLoader

        ClassLoader getVDBClassLoader()
        Get class loader for VDB.
        Returns:
      • addWarning

        void addWarning​(Exception ex)
        Add an exception as a warning. The exception will be wrapped by a TeiidSQLWarning for the client. The warnings can be consumed through the Statement.getWarnings() method.
        Parameters:
        ex -
      • isContinuous

        boolean isContinuous()
        Returns:
        true if this is a continuous query
      • isReturnAutoGeneratedKeys

        @Deprecated
        boolean isReturnAutoGeneratedKeys()
        Deprecated.
        Whether to return the keys generated by an insert.
        Returns:
        true
      • returnGeneratedKeys

        GeneratedKeys returnGeneratedKeys​(String[] columnNames,
                                          Class<?>[] columnDataTypes)
        Creates a holder for generated keys.
        Parameters:
        columnNames -
        columnDataTypes -
        Returns:
      • getGeneratedKeys

        GeneratedKeys getGeneratedKeys()
        Returns the last set of generated keys for the current command or null if no keys have been generated.
      • setSessionVariable

        Object setSessionVariable​(String key,
                                  Object value)
        Set the session variable and return the old value if any
        Parameters:
        key -
        value -
        Returns:
      • getSessionVariable

        Object getSessionVariable​(String key)
        Get the session variable
        Parameters:
        key -
        Returns:
      • getConnection

        TeiidConnection getConnection()
                               throws TeiidSQLException
        Gets a connection to the current session.
        WARNING be careful with blocking/recursive operations.
        The returned connection is considered to be derived and is not allowed to alter the transaction state or close the session.
        Each call to this method will return a new connection.
        Client side execution/connection properties are specific to each connection instance
        Returns:
        a Connection to the current session
        Throws:
        TeiidSQLException