Some field names returned by SQL may be invalid as Vortex variable names. For example, an embedded Texis function call such as:
<SQL "select Title, text2mm(Text) from books where id = $id">
</SQL>
would attempt to return the fields Title
and
text2mm(Text)
as Vortex variables. However,
"text2mm(Text)
" is not a valid Vortex name. Such invalid
fields are silently discarded by Vortex; in order to return them they
must be renamed in the SQL statement:
<SQL "select Title, text2mm(Text) result from books
where id = $id">
</SQL>
The text2mm(Text)
field is here renamed to result
, a
valid Vortex variable name.
Another common example is the $rank
value set for each value
in a likep
query. The "$" is part of the actual
SQL field name. In Vortex however, it must be escaped, and the field
renamed:
<SQL "select $$rank Rank, Title from books
where Title likep 'Norway fjords'">
...
</SQL>
The rank value is here returned in the Vortex variable $Rank.