... Vortex code ...
CAPTURE command redirects (captures) the standard output
of the Vortex code within its block, and returns it in
the close of the block. It is useful for saving the output of an
entire section of script, rather than laboriously appending many
values together. The following flags may be used:
BINThe return value
$retis considered binary (e.g.
varbyte). By default the return value is text (
OUTPUTAlso print the output normally to stdout. This is useful if the output is to be displayed anyway, especially if the enclosed code may execute slowly: the output can be displayed as generated while still being captured, without waiting for the entire block to finish.
CAPTURE returns the standard output of the Vortex code within
the block, as one value.
This script uses
CAPTURE in a simple page-caching scheme.
Common queries are cached in the
cache table. If a query is
not present already, it is executed and cached:
<!-- Check the cache first: -->
<SQL "select Page from cache where Query = $query">
<!-- Query wasn't in the cache; execute and save it: -->
The following books match your query: <P>
<SQL "select Title from books where Subject like $query">
<!-- Add it to the cache: -->
<SQL NOVARS "insert into cache values($query, $ret)">
CAPTURE statement was added in version 2.1.896900000 19980603.
The output of a
CAPTURE block with the
OUTPUT flag can
still be captured by an enclosing