- 18.07 (released) ...
If you have to execute database queries which only differ in the expression values, you can create a template query and then bind variables into this template for each execution.
To use variable binding:
Creating a template query
Template queries are parsed to replace each variable by its bound value. To create a template query, you have hence to put directly variables where the values would take place.
Variables syntax is simple: the ':' special character followed by the variable name.
Bind_var: STRING = "firstname"
selection.set_query ("Select * from CONTACTS where Firstname = ':" + Bind_var + "'")
Binding variables to a query
Once you have created your query, you can map variable names to values and execute the query:
Bind_var: STRING is "firstname"
selection.set_map_name (io.laststring, Bind_var)