...
The structure of an Odysseus Script may contain different things: commands, comments, variables, constants, macros or control flows.
Commands
...
Constants are varibales that exists without defining them explicitly. For example, a default variable is NOW so that ${NOW} can be used to get the current time in millis. This is might be useful if the time of the script execution is needed (e.g. for filenames).
Procedures and Macros
Procedures and macros gives the user a possibility to reuse a certain snippet of the code. They can be distinguished between parameterizable procedures and simply reusable macros. Another advantage: Procedures (#PROCEDURE) are stored in the data dictionary so that their availablity is (according to the user's rights) system wide.
Control Flows
There are some control flows that allows to define how certain commands are executed.
...
Stored Procedures and Macros
Stored procedures and macros allows to reuse written Odysseu Script.
#PROCEDURE#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 run them.
...
Procedures can be compared to stored procedures in a database system or like methods in a programming language. It allows defining a snippet of Odysseus Script that is reusable. The structure for creating a new procedure is as Installed procedures can be executed at follows:
#EXECUTE <procedure-name>(<variable 1>, <variable 2>, ..., <variable n>)
...
This example concludes the one from #PROCEDURE. Therefore we have two parameters (varX and attribute). The following executes the "setSomething" procedure and sets varX=1 and attribute=b.
Code Block | ||||||
---|---|---|---|---|---|---|
| ||||||
#EXECUTE setSomething(1, b) |
The variables are replaced and the according Odysseus Script of the procedure is executed at this point. Therefore, the following is inserted insted of the #EXECUTE command:
Code Block | ||||||
---|---|---|---|---|---|---|
| ||||||
#RUNQUERY
SELECT 1 AS a, 2 AS b, * FROM bid WHERE b>1
|
Since this snippet is simply inserted, all things of the surrounding Odysseus Script is taken. In our example, this is for example, the choosen #PARSER and #TRANSCFG that are necessary for #RUNQUERY here. Therefore, it is not guaranteed that a procedure is executable of its own.
#DROPPROCEDURE
The command can be used to remove stored procedures, which were created by using the #PROCEDURE (see for more information about procedures) command.
Usage
An installed procedure can be removed by the command followed by the procedure name:
#DROPPROCEDURE<procedure-name>
You can create the procedure by using the #PROCEDURE command or execute a procedure by calling #EXECUTE
Example
This example concludes the one from #PROCEDURE. Therefore, we want to remove the "setSomething" procedure:
Code Block | ||||||
---|---|---|---|---|---|---|
| ||||||
#DROPPROCEDURE setSomething |
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 |
...