······@fisica.unige.it wrote:
> Hello,
> I'm learning CL in these days (well, months actually - i do that in my
> spare time, because I use c++/python for my job) and getting more and
> more confident with the language, anyway i'm still a cl
> newbie. Yesterday I experimented a bit with CLSQL (which is very nice
> imo). I did not notice any support for placeholders / query
> parameters, i.e. something like
>
> (clsql:query "select A, B from C where A=?" ; query
> '(1)) ; bindings
(clsql:query (format nil "select A, B from C where A = ~D" 1))
>
> or, maybe,
>
> (clsql:query "select A, B from C where A=%(bind1) AND D=%(bind2)" ; query
> '((bind1 . 1) (bind2 . 2)) ; bindings
(clsql:query (format nil "select A, B from C where A = ~S and D = ~S" 1 2))
>
> am I wrong? If not, does anyone know if this is a planned feature?
As you can see it is a useless feature :) If you are not satisfied with
the above you can do
(defmacro query* (q &rest args)
`(clsql:query (apply #'format nil ,q ,args)))
Then you can write
(query* "select A, B from C where A = ~D AND D = ~D" 1 2)
Cheers
--
Marco Antoniotti