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 sqlvar tag has the following attributes:
- name
The name of the variable to insert. As with other
DTML tags, the name= prefix may be, and usually is,
ommitted.
- 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:
<dtml-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 ommitted or an empty string, then the value
inserted is null .
Imported modules
|
|
from DocumentTemplate.DT_Util import ParseError, parse_params, name_param
from string import find, split, join, atoi, atof
|
Classes
|
|
|
|