LispWorks User Guide and Reference Manual > 19 Common SQL > 19.4 Object oriented interface > 19.4.3 Object-Oriented Data Manipulation Language (OODML)

NextPrevUpTopContentsIndex

19.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 and Reference Manual - 22 Dec 2009

NextPrevUpTopContentsIndex