Next Previous Up Top Contents Index

16 The SQL Package

do-query

Macro

Summary

Repeatedly binds a variable to the results of a query, and executes a body of code using the bound variable.
Package

sql

Signature

do-query &rest args query &key database &rest body =>

Arguments

args

A set of bindings.

query

A database query.

database

A database.

body

A Lisp code body.

Values

None.
Description

The macrodo-query repeatedly executes body within a binding of args on the attributes of each record resulting from query. The return value ofdo-query is determined by the result of executing body.
The default value of database is*default-database*.
Example

The following code repeatedly binds the result of selecting an entry inename from the tableemp to the variablename, and then printsname using the Lisp functionprint.
(do-query ((name) [select [ename] :from [emp]])
         (print name))

See also

loop
map-query
query
select

LispWorks Reference Manual - 15 Oct 1998

Next Previous Up Top Contents Index

Generated with Harlequin WebMaker