Repeatedly binds a variable to the results of a query, and executes a body of code using the bound variable.
The macro
do-query
repeatedly executes
body
within a binding of
args
on the attributes of each record resulting from
query
. The return value of
do-query
is determined by the result of executing
body
.
The default value of database is *default-database*.
The following code repeatedly binds the result of selecting an entry in
ename
from the table
emp
to the variable
name
, and then prints
name
using the Lisp function
print
.
(do-query ((name) [select [ename] :from [emp]])
(print name))