NextPrevUpTopContentsIndex

18.4.3.2 Iteration

The object-oriented SQL interface has the same three iteration constructs as the functional interface (see Iteration): a do- loop, a mapping function, and an extension to the Common Lisp loop macro. However, in this case, the iteration focus is not a tuple of attributes (that is, a record), but a tuple of instances. For example:

(loop for (jones company) being the tuples in
      [select 'person 'organisation
      :where [= [slot-value 'person 'surname] "Jones"]]
      do (format t "~A ~A ~%"
                (slot-value jones 'forename)
                (slot-value company 'short-name)))

Note: Instances may denote many database records, and hence the effective iteration focus in this case is a tuple of sets of tuples of attributes.


LispWorks User Guide - 8 Apr 2005

NextPrevUpTopContentsIndex