...
Code Block | ||||||
---|---|---|---|---|---|---|
| ||||||
#DEFINE latencyOn .... #IFDEF latencyOn #TRANSCFG StandardLatency #ELSE #TRANSCFG Standard #ENDIF |
Stored Procedures and Macros
#PROCEDURE
The #PROCEDURE allows to create stored procedures that are saved into the data dictionary and can be reused by any other scripts, see #EXECUTE how to use them.
Usage
Like common if-statements in other programming languages, the structure of #IFDEF follows "if-then-else", where the "else" part is not necessary. Accordingly, the structure is as follows:
#IFDEF <variable-name>
<then-commands>
#ENDIF
or
#IFDEF <variable-name>
<then-commands>
#ELSE
<else-commands>
#ENDIF
So, if the variable named <variable-name> exists, the control flow runs the <then-commands>, if not and there is an else-part, the <else-commands> are executed. Look also add #DEFINE and #UNDEF to set or unset variables.
Example
The example defines a variable called latencyOn and uses the #IFDEF command to use either StandardLatency for the transformation configuration, if latencyOn is set or Standard if it is not set. Obviously, this example uses allways the <then-command>-part (since latencyOn is set), so you may switch to another transformation config by simply commenting the #DEFINE command out so that the <else-commands> are used.
Code Block | ||||||
---|---|---|---|---|---|---|
| ||||||
#DEFINE latencyOn
....
#IFDEF latencyOn
#TRANSCFG StandardLatency
#ELSE
#TRANSCFG Standard
#ENDIF |
Commands
#ADDQUERY
This command executes a query in a certain langauge and is equal to #QUERY
...
The parameters are one or two values, which are separated by a blank or tab. Therefore, the parameters may not have any blanks or tabs. The first parameter is the name and the second paramter is the value that is assigned to the name. However, the second parameter (the value) is optional, because it a value for #IFDEF is not necessary, otherwise it cannot be used for replacement.
Example
The first variable is called "one" and has no value. The second variable is called "two" and has the value "1234". See at Variables or at #IFDEF for examples how to use a variable.
...
The parameter is a boolean: the parameter may be either "true" or "false".
Example
Code Block | ||||||
---|---|---|---|---|---|---|
| ||||||
/// query sharing off #DOQUERYSHARING false /// query sharing on #DOQUERYSHARING true |
...
The parameter is a boolean: the parameter may be either "true" or "false".
Example
Code Block | ||||||
---|---|---|---|---|---|---|
| ||||||
/// query rewrite off #DOREWRITE false /// query rewrite on #DOREWRITE true |
...
Parameters
It has no parameters.
Example
Code Block | ||||||
---|---|---|---|---|---|---|
| ||||||
#DROPALLQUERIES |
...
Parameters
It has no parameters.
Example
Code Block | ||||||
---|---|---|---|---|---|---|
| ||||||
#DROPALLSINKS |
...
Parameters
It has no parameters.
Example
Code Block | ||||||
---|---|---|---|---|---|---|
| ||||||
#DROPALLSOURCES |
...
There are two parameters: the username and the password.
Example
This example changes the user to "System" with password "manager"
...
Parameters
Has no parameters
Example
Code Block | ||||||
---|---|---|---|---|---|---|
| ||||||
#LOGOUT |
...
The parameters are: The name of the Odysseus configuration param and the new value
Example
Code Block | ||||||
---|---|---|---|---|---|---|
| ||||||
#ODYSSEUS_PARAM scheduler_TimeSlicePerStrategy 10 |
...
The parser: Which parsers are available strongly depends on the current system setting and installed features. Normally in the default product, there is "PQL" for Procedural Query Language (PQL) and "CQL" for Continuous Query Language (CQL).
Example
Code Block | ||||||
---|---|---|---|---|---|---|
| ||||||
#PARSER PQL |
...
If #QName is defined before, the query will get this name.
Example
The example shows four queries after the parser is set to CQL and the transformation configuration is set to Standard. The first one uses #QUERY and it is executed as a CQL-Query, but not started. The second query is equal to the first one (it still uses CQL and is not started). The third query also uses CQL and the Standard transformation configuration, but is (in contrast to the first and second) started (it is directly running). Then, the parser is switched to PQL, so that the fourth query is parsed by the PQL-Parser and not by the CQL-Parser anymore.
...
This command has no parameters.
Example
Code Block | ||||||
---|---|---|---|---|---|---|
| ||||||
#RELOADFROMLOG |
...
It needs two parameters: The scheduler and the scheduling-strategy. The available schedulers and strategies depends on the current system setting (additional features could be necessary!), because they are dynamically bound.
Example
Uses the "Single Thread Scheduler" with a "Round Robin" scheduling strategy
...
The parameter is a number. It defines the time in milliseconds for which the script execution should sleep.
Example
Waiting 2 seconds (2000 milliseconds) until the next command is invoked.
...
This command has no parameters.
Example
Code Block | ||||||
---|---|---|---|---|---|---|
| ||||||
#STARTQUERIES |
...
This command has no parameters.
Example
Code Block | ||||||
---|---|---|---|---|---|---|
| ||||||
#STARTSCHEDULER |
...
This command has no parameters.
Example
Code Block | ||||||
---|---|---|---|---|---|---|
| ||||||
#STOPSCHEDULER |
...
The configuration: Which configruations are available strongly depends on the current system setting and installed features. Normally in the default product, there is "Standard" for the default transformation configuration. If the latency feature is installed, there is also "StandardLatency" available, which invokes specific transformations so that the latency is automatically calculated.
Example
Code Block | ||||||
---|---|---|---|---|---|---|
| ||||||
#TRANSCFG Standard |
...
The configuration: Which configruations are available strongly depends on the current system setting and installed features. Normally in the default product, there is "Standard" for the default transformation configuration. If the latency feature is installed, there is also "StandardLatency" available, which invokes specific transformations so that the latency is automatically calculated.
Example
Code Block | ||||||
---|---|---|---|---|---|---|
| ||||||
#TRANSCFG Standard |
...