The <sql-statement> class represents SQL statements and their indicator values and coercion policy. You can use this class to represent any SQL statement, be it static or dynamic. You can send SQL statements to the DBMS for execution by calling the execute function on an instance of <sql-statement>. The execute function returns the results of executing the SQL statement, if there are any.
In the make method on <sql-statement>, you can specify that values should be substituted into the SQL statement when it is executed. You do not specify the values until calling execute on the statement, when you can pass the substitution values with the parameter: keyword.
The values are substituted wherever a question mark (?) occurs in the SQL statement string. We call the question marks anonymous host variables because there is no Dylan variable name. Substitution occurs positionally: the first value replaces the first anonymous host variable, the second value replaces the second anonymous host variable, and so on. If the number of values is greater than the number of anonymous host variables, the extra parameters are ignored. If the number of anonymous host variables is greater than the number of parameters, a condition is signaled.
When the SQL statement is SELECT, you can also specify a result-set policy and a liaison function in the call to execute. A result-set policy describes behavioral and performance characteristics of the result-set object that the execute function returns. A liaison function creates Dylan objects from the records retrieved from the database. These objects become the elements of the result set instead of the record object.