sqltest tag inserts a condition test into SQL code. It tests a
column against a variable. This tag is used in SQL Methods.
sqltest tag syntax:
sqltest tag is a singleton. It inserts a SQL condition test
statement. It is used to build SQL queries. The
correctly escapes the inserted variable. The named variable or
variable expression is tested against a SQL column using the
specified comparison operation.
nbmeans non-blank string, and should be used instead of
stringunless you want to test for blank values. The type attribute is required and is used to properly escape inserted variable.
The comparison defaults to equal to. If the comparison is not
recognized it is used anyway. Thus you can use comparisons such
select * from employees where <dtml-sqltest name type="nb">
name variable is
Bob then this renders:
select * from employees where name = 'Bob'
select * from employees where <dtml-sqltest empid type=int multiple>
empid variable is
(12,14,17) then this renders:
select * from employees where empid in (12, 14, 17)