NextPrevUpTopContentsIndex

18.8.6.1 Fetching multiple records

The function map-query and the macros do-query , simple-do-query and loop with each record use internally mysql-use-query , which means that the underlying MySQL code brings the data from the server one record at a time. With a small number of records, it may be preferable to bring all the data immediately instead. This can be done by passing the argument get-all , as follows:

(sql:map-query nil 'print
               "select forname,surname from people"
               :get-all t)
 
(sql:do-query
 ((forname surname) "select forname,surname from people"
  :get-all t) 
 body
)
    
(sql:simple-do-query 
 (list "select forname,surname from people"
       :get-all t)
 body
)
 
(loop for (forname surname) being each record 
      "select forname,surname from people"
      get-all t
      body
)

LispWorks User Guide - 21 Jul 2006

NextPrevUpTopContentsIndex