LispWorks User Guide and Reference Manual > 19 Common SQL > 19.9 Using MySQL > 19.9.6 Special considerations for iteration functions and macros

NextPrevUpTopContentsIndex

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

NextPrevUpTopContentsIndex