Previous Chapter | Next Chapter | Up | Next Section | Contents
Inserting values with the
sqlvar
tag
The
sqlvar
tag is used to type-safely insert values into SQL text. The
sqlvar
tag is similar to the
var
tag, except that it replaces text formatting parameters with SQL type information.
The attributes used by the
sqlvar
tag are shown in table See Attributes of the sqlvar tag.
Attributes of the
sqlvar
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.
|
optional
|
A flag indicating that a value is optional. If a value is optional and is not provided (or is blank when a non-blank value is expected), then the string null is inserted.
|
For example, given the tag:
<!--#sqlvar x type=nb optional>
if the value of x is:
Let's do it
then the text inserted is:
'Let''s do it'
however, if x is omitted or an empty string, then the value inserted is null.
Previous Chapter | Next Chapter | Up | Next Section | Contents