Parameters
The SQL SELECT statement of an IliSQLTable object can contain references to parameters. See Parameters. Here is an example:
SELECT ID, NAME, ADDRESS
FROM EMP
WHERE NAME = :name_p
In this example name_p is the name of a parameter and as such it must be preceded by a colon “:” in the SQL statement.
In addition, the parameter must be declared in the IliSQLTable object. This can be done either interactively through the SQL Data Source inspector in Views Studio or in C++ as follows:
IliSQLTable* sqlTbl;
...
sqlTbl->appendParameter(“name_p”, IliStringType);
A value should be assigned to this parameter before the IliTable::select member function is called. This code extract only shows how the parameter is defined in C++. For a complete description of the code required to generate this SQL statement, see Creating the Definition in C++.
IliValue v(“Smith”);
sqlTbl->setParameterValue(“name_p”, v);
sqlTbl->select();
The parameter can subsequently be assigned other values as required.
Published date: 05/24/2022
Last modified date: 02/24/2022