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@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@common-lisp.net http://common-lisp.net/cgi-bin/mailman/listinfo/postmodern-devel