[postmodern-devel] Quoted lists with QUERY or SQL

Brit Butler redline6561 at gmail.com
Tue Nov 30 14:51:20 UTC 2010


sql-compile is exactly what I was looking for. Thanks Marijn. And thank you
for Postmodern!

Regards,
Brit

On Tue, Nov 30, 2010 at 3:36 AM, Marijn Haverbeke <marijnh at gmail.com> wrote:

> > Is there a reason that query doesn't support evaluated lists?
>
> Yes. These macros also accept string input, and assume that everything
> that's not a list starting with a keyword will evaluate to a string.
>
> > If so, how would you recommend this be done?
>
> You can either add an sql-compile around your sql-expr, which does a
> run-time compilation of an s-sql expression (normally they happen at
> compile time), or do something like this:
>
> (defmethod count-persistent-objects ((store list) class-name
>                                      &key (where t) &allow-other-keys)
>  (with-connection store
>    (sql (:select (:count '*) :from class-name :where
>           (:raw (if (stringp where) where (sql-compile where)))))))
>
> Best,
> Marijn
>
> _______________________________________________
> postmodern-devel mailing list
> postmodern-devel at common-lisp.net
> http://common-lisp.net/cgi-bin/mailman/listinfo/postmodern-devel
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mailman.common-lisp.net/pipermail/postmodern-devel/attachments/20101130/dfd95a31/attachment.html>


More information about the postmodern-devel mailing list