When using sysvariable!, the variable wich corresponds to VariableName will be read out from the ObjectLoader and sysvariable!VariablenName will be replaced by its value.
Here to consider that the value will be written with limitern automatically, when the variable is of type String.
The class EvaUtils contains methods to set and read variables.
A system variable will be set with the method
EvaUtils.putVariable(Object key,Object value)
| Text: | ||
|---|---|---|
| Variable | key = statement | value = Hello World |
| Seting | EvaUtils.putVariable("statement", new String("Hello World")); | |
| Statement | SELECT * FROM MY_TABLE WHERE VALUE = sysvariable!statement | |
| Execution | SELECT * FROM MY_TABLE WHERE VALUE = ‘Hello World‘ | |
Because the setted object is of type String, the text-specific limiter, the simple quotation marks, are written automatically and may not occur not in the statement.
| Number: | ||
|---|---|---|
| Variable | key =number | value = 1 |
| Setting | EvaUtils.putVariable(“number“,new Integer(1)); | |
| Statement | SELECT * FROM MY_TABLE WHERE ID > sysvariable!number | |
| Execution | SELECT * FROM MY_TABLE WHERE ID > 1 | |
To read out a variable outside of SQL Statements the method
EvaUtils.getVariable(Object key)
can be used, wich returns the object for the given key. When value for the corresponding key exists, null will be returned.