[postmodern-devel] dynamically built queries
Marijn Haverbeke
marijnh at gmail.com
Wed Jan 23 20:16:57 UTC 2008
Hi Ralf,
I think that the :raw keyword can help you out here -- you give it a
string, which is then inserted straight into the query, as in (sql
(:select (:raw "tmp1.name") :from (:as 'baz (:raw "tmp1")))).
Cheers,
Marijn
On Jan 23, 2008 9:05 PM, Ralf Mattes <rm at seid-online.de> wrote:
> Hello list,
>
> I need to create queries dynamically and seem to have run into a silly
> showstopper. I want to create queries like ...
>
> SELECT tmp1.name, tmp1.value as "{foo}bar" from baz as tmp1;
>
> ... where both the table name alias ("tmp1") as well as the field name
> alias ("{foo}bar") are _Strings_. Now, if i do:
>
> (sql-compile '(:dot "tmp1" value))
> --> "E'tmp1'.value"
>
> which is definitely _not_ what i want. The same for:
>
> (sql-compile '(:as "tmp1" baz))
> --> "E'tmp1' AS baz"
>
> If possible at all I'd like to avoid the (make-symbol "tmp1") and
> similar workarrounds. Any ideas?
>
> TIA Ralf Mattes
>
>
> _______________________________________________
> 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