システム関数は、CData Virtuality Server システムの情報へのクエリによるアクセスを提供します。以下はその概要です:

To view the full table, click the expand button in its top right corner


Function
Description
Return value type
CALLER()


Retrieves the name of the user executing the query.

For jobs: when runAs = OWNER, CALLER() returns the owner of the job

For procedures: when EXECUTE AS = OWNER, CALLER() returns the name of the user who calls the procedure

String

CURRENT_DATABASE()

Retrieves the catalog name of the database

String

CURRENT_SCHEMAS(boolean include_system_schemas)

Returns a list of schemas (data sources and virtual schemas).

  • If the include_system_schemas parameter is set to TRUE, the list of schemas including system schemas is returned;
  • If include_system_schemas is set to FALSE, a list of schemas excluding system schemas is returned

String Array

DV_SESSION_SET('name', value)

Sets the indicated session variable to the indicated value

Object

DV_SESSION_GET('name')

Retrieves the value (null if no value has been set)

Object

ENV('key')

Retrieves the system (i.e. CData Virtuality Server) property specified by key

String

SESSION_ID()

Retrieves current session ID in string form

String

REQUEST_ID()

Retrieves the current request ID

Long

USER()

Retrieves the name of the user owning the query

String

LASTUPDATED('fqn')

Retrieves the oldest materialization timestamp from all query components. fqn can be the fully qualified name of a table/view or column. Returns NULL  if no component is materialized.

Example:

SELECT LASTUPDATED('schema_name.view_name'), LASTUPDATED('schema_name.view_name.column_name');;

Timestamp

例えば、 USER()を実行する方法です:

SELECT USER();;
System functions' names are not case-sensitive: both USER() and user() will work.

Special Note on ENV('key')

この機能について覚えておくべき重要なことの1つは、システムプロパティへの信頼できないアクセスを防止するためのセキュリティ上の理由から、デフォルトでは有効になっていないということです。有効にするには、以下のコマンドを使用し、CData Virtuality Server を再起動する必要があります:

CALL SYSADMIN.executeCli('/subsystem=teiid:write-attribute(name=allow-env-function,value=true)');;

Special Note on DV_SESSION_SET('name', value) and DV_SESSION_GET('name')

前述の他のシステム関数とは異なり、この2つは一緒になっており、その目的はセッション・レベルでの変数の設定と読み込みです。 

最初の関数は、指示された変数に指示された値を設定し、古い値を返し、2番目は現在の値を取得します(以前に値が設定されていない場合は、  NULLが返されます)。変数はキーと値のペアで、名前は文字列、値と戻り値はオブジェクトです。 

特別なケースとして、 dv.maxRecursion セッション変数があります。これはセッション変数そのもので、固定されたデフォルト値を持ち、 DV_SESSION_SET('name', value)を使って を変更することができます: 

SELECT DV_SESSION_SET('dv.maxRecursion', 25);;