Re: Iteration syntax for UncommonSQL

Nick Levine <[email protected]> Fri, 17 Jan 2003 10:01:46 GMT
Newsgroups gmane.lisp.uncommon-sql,gmane.lisp.lispworks.general
Message-ID <[email protected]>
Edi,

Take a look at the end of section 5.2 in the same document:

    Finally, we have at our disposal all the same iteration constructs
    that we had before (section 4.3). This time the iteration focus is
    not a record (i.e. a tuple of attributes) but a tuple of
    instances. For example, returning to the iteration examples we
    used before:

       CL-USER 361 > (do-query ((my-aardvark) [select 'species-list
                                                      :where aardvark])
                               (print my-aardvark))

       #<db-instance SPECIES-LIST 574209404>

       CL-USER 362 >

I have only tried this with Common SQL. Please let us know if you find
that UncommonSQL is different.

- nick

---
   Edi Weitz wrote:

   (I'm currently using UncommonSQL because I only have a license for
   LW professional but I'm sending a copy to the LW mailing list
   because I guess the answer is indepent of whether it's "Uncommon"
   or "Common".)

   I'm using the OO interface to UncommonSQL and have created a view
   class USER which maps to a database table USERS. Everything works
   fine except for the fact that, in order to loop through all
   elements of the database, I resort to things like

     (dolist (user (sql:select 'user))
       ..)

   which conses up a list that I don't actually need (and which might
   be large).

   I'm aware of the iteration constructs described in
   <http://www.lispworks.com/reference/sql-tutorial/index.html#section-4.3>
   but I couldn't figure out how to use them with view classes.

   Is there something that I'm missing?