Postmodern Examples Table of Contents Postmodern-sec-11 (Many to Many)
As stated in the postmodern documentation, doquery allows you to execute the given query (a string or a list starting with a keyword), iterating over the rows in the result. The body will be executed with the values in the row bound to the symbols given in names. To iterate over a parameterised query, one can specify a list whose car is the query, and whose cdr contains the arguments.
The following is a toy function which illustrates the point.
(defun iterate-rows () (let ((country-names ())) (doquery (:order-by (:select 'name :from 'countries) 'name) (xname) (push xname country-names)) country-names))