[postmodern-devel] doquery - iterating rows

Marijn Haverbeke marijnh at gmail.com
Wed Oct 1 06:15:12 UTC 2008


Hello Mark,

DOQUERY is indeed what you need here, but you got the arguments all
wrong -- which, looking at the documentation, is not very surprising.
I'll add a decent example there. For now, I think you want this:

(defun iterate-rows ()
  (doquery (:select 'name :from 'htable) (xname)
    (print xname)))

Best,
Marijn


2008/10/1 Mark Slamin <mslamin at gmail.com>:
> Sorry, more questions.
> I'm trying to iterate down rows in the database.
> Using doquery like this:
> I receive the following error:
> The value of CL-POSTGRES::QUERY is ("(A B)"), which is not of type STRING.
>    [Condition of type SIMPLE-TYPE-ERROR]
> I'm not sure what to do with that.
> Also, on a broader scale, what I'm trying to do is iterate through the rows
> of a large database and I don't want to load the entire results of the query
> into memory.  Ideally I just want to load one record with all its fields,
> perform some operations on that data, write the record back if its been
> updated, and then move to the next record.
> Is doquery the best method for that?  Or is there something else that would
> work better?
> Thank you,
> Mark
> _______________________________________________
> postmodern-devel mailing list
> postmodern-devel at common-lisp.net
> http://common-lisp.net/cgi-bin/mailman/listinfo/postmodern-devel
>
>



More information about the postmodern-devel mailing list