Previous Chapter | Next Chapter | Up | Next Section | Contents
Inserting equality comparisons with
sqltest
The
sqltest
tag is used to insert SQL source to test whether an SQL column is equal to a value given in a DTML variable. The attributes of the sqltest tag are shown in table See Attributes of the sqltest tag.
Attributes of the
sqltest
tag
name
|
description
|
name
|
The name of the variable to insert. As with other DTML tags, the name= prefix may be, and usually is, omitted.
|
type
|
The data type of the value to be inserted. This attribute is required and may be one of string, int, float, or nb. The nb data type indicates a string that must have a length that is greater than 0.
|
column
|
The name of the SQL column, if different than name.
|
multiple
|
A flag indicating whether multiple values may be provided.
|
optional
|
A flag indicating if the test is optional. If the test is optional and no value is provided for a variable, or the value provided is an invalid empty string, then no text is inserted.
|
For example, given the tag:
<!--#sqltest color column=color_name type=nb multiple-->
If the value of the color variable is "red", then the following test is inserted:
column_name = 'red'
If a list of values is given, such as: "red", "pink", and "purple", then an SQL in test is inserted:
column_name = in (red, pink, purple)
Previous Chapter | Next Chapter | Up | Next Section | Contents