/subsystem=teiid:write-attribute(name=allow-env-function,value=true)
System Functions
System functions provide access to information in the Teiid system from within a query.
COMMANDPAYLOAD
Retrieve a string from the command payload or null if no command payload was specified. The command payload is set by the TeiidStatement.setPayload
method on the Teiid JDBC API extensions on a per-query basis.
COMMANDPAYLOAD([key])
If the key parameter is provided, the command payload object is cast to a java.util.Properties object and the corresponding property value for the key is returned. If the key is not specified the return value is the command payload object toString value.
key, return value are strings
ENV
Retrieve a system property. This function was misnamed and is for legacy compatibility, see ENV_VAR and SYS_PROP for more appropriately named functions.
ENV(key)
To prevent untrusted access to system properties, this function is not enabled by default. Use the CLI:
or edit the standalone-teiid.xml file and add following to the "teiid" subsystem
<allow-env-function>true</allow-env-function>
then call using ENV('KEY'), which returns value as string. Ex: ENV('PATH'). If a value is not found with the key passed in, a lower cased version of the key is tried as well. This function is treated as deterministic, even though it is possible to set system properties at runtime.
ENV_VAR
Retrieve an environment variable.
ENV_VAR(key)
To prevent untrusted access to environment variables, this function is not enabled by default. Use the CLI:
/subsystem=teiid:write-attribute(name=allow-env-function,value=true)
or edit the standalone-teiid.xml file and add following to the "teiid" subsystem
<allow-env-function>true</allow-env-function>
then call using ENV_VAR('KEY'), which returns value as string. Ex: ENV_VAR('USER'). The behavior of this function is platform dependent with respect to case-sensitivity. This function is treated as deterministic, even though it is possible for environment variables to change at runtime.
SYS_PROP
Retrieve an system property.
SYS_PROP(key)
To prevent untrusted access to environment variables, this function is not enabled by default. Use the CLI:
/subsystem=teiid:write-attribute(name=allow-env-function,value=true)
or edit the standalone-teiid.xml file and add following to the "teiid" subsystem
<allow-env-function>true</allow-env-function>
then call using SYS_PROP('KEY'), which returns value as string. Ex: SYS_PROP('USER'). This function is treated as deterministic, even though it is possible for system properties to change at runtime.
NODE_ID
Retrieve the node id - typically the System property value for "jboss.node.name" which will not be set for Teiid embedded.
NODE_ID()
return value is string.
SESSION_ID
Retrieve the string form of the current session id.
SESSION_ID()
return value is string.
USER
Retrieve the name of the user executing the query.
USER([includeSecurityDomain])
includeSecurityDomain is a boolean. return value is string.
If includeSecurityDomain is omitted or true, then the user name will be returned with @security-domain appended.
CURRENT_DATABASE
Retrieve the catalog name of the database. The VDB name is always the catalog name.
CURRENT_DATABASE()
return value is string.
TEIID_SESSION_GET
Retrieve the session variable.
TEIID_SESSION_GET(name)
name is a string and the return value is an object.
A null name will return a null value. Typically you will use the a get wrapped in a CAST to convert to the desired type.
TEIID_SESSION_SET
Set the session variable.
TEIID_SESSION_SET(name, value)
name is a string, value is an object, and the return value is an object.
The previous value for the key or null will be returned. A set has no effect on the current transaction and is not affected by commit/rollback.
GENERATED_KEY
Get a column value from the generated keys of the previous statement.
GENERATED_KEY(column_name)
column_name is a string. The return value is of type object.
Null is returned if there is no such generated key nor matching key column. Typically this function will only be used within the scope of procedure to determine a generated key value from an insert. It should not be expected that all inserts provide generated keys as not all sources support returning generated keys.