[postmodern-devel] Query generation

Ralf Mattes rm at seid-online.de
Wed Jun 27 19:22:14 UTC 2007


On Wed, 2007-06-27 at 14:29 -0400, Osei Poku wrote:
> Hi,
> 
> I want to generate the following query:
> 
> "UPDATE table1 SET col1 = NULL, col2 = NULL"
> 
> from the following list: ("col1" "col2")
> 
> my attempt is:
> 
> (sql
>    (append
>       '(:update :table1 :set)
>       (loop for a in '("col1" "col2")
>             collect a collect :NULL)))
> 
> but that apparently doesnt work.  this can probably be attributed to
> my newness to lisp.
> 
> Any ideas?

'postmodern:sql' is a macro, not a function and hence will not evaluate
its argument. When your code really looks like above you could fix it
like this:

(sql #.(append
       '(:update :table1 :set)
        (loop for a in '("col1" "col2")
            collect a collect :NULL)))


HTH Ralf Mattes


 
>  thanks
> 




More information about the postmodern-devel mailing list