[postmodern-devel] Quoted lists with QUERY or SQL

Brit Butler redline6561 at gmail.com
Mon Nov 29 22:50:57 UTC 2010


Hello,

I'm working on a Postmodern backend for weblocks. To conform to their Store
API<http://bitbucket.org/S11001001/weblocks-dev/src/f14b59da2238/src/store/store-api.lisp>
I
need to implement a count-persistent-objects method. I would like to be able
to write something like:

(defmethod count-persistent-objects ((store list) class-name
                                     &key where &allow-other-keys)
  (let ((sql-expr `(:select (:count '*) :from ,class-name
                            ,@(when where (list :where where)))))
    (with-connection store
      (query sql-expr :single))))

However a simple test of this results in a type error:
The value of CL-POSTGRES::QUERY is (:SELECT (:COUNT '*) :FROM QUOTES), which
is not of type STRING.

Is there a reason that query doesn't support evaluated lists? If so, how
would you recommend this be done?

Regards,
Brit Butler
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mailman.common-lisp.net/pipermail/postmodern-devel/attachments/20101129/0c59be13/attachment.html>


More information about the postmodern-devel mailing list