[postmodern-devel] s-sql insert-into problem

Marijn Haverbeke marijnh at gmail.com
Mon Apr 14 13:05:21 UTC 2008


Hi Jens,

The expansion of SQL forms happens at macroexpansion time, while you
are building your query expression at run-time. Using SQL-COMPILE
where you now have SQL solves the problem.

Cheers,
Marijn


On Mon, Apr 14, 2008 at 2:59 PM, Jens Teich <info at jensteich.de> wrote:
> I have a tablename as string, a list of fieldnames as strings and a list
>  of values known only at runtime all.
>
>  Tried the following. What is going wrong?
>
>  HB> (sql
>      (append
>       (list :insert-into (intern "table") :set)
>       (loop
>          for k in '("field1" "field2" "field3")
>          for v in '(4 5 6)
>          append (list (intern k) v))))
>
>  Error: Value (:INSERT-INTO |table| :SET |field1| 4 |field2| 5 |field3| 6)
>  can not be converted to an SQL literal.
>    [Condition of type SIMPLE-ERROR]
>
>  Jens
>  _______________________________________________
>  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