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
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@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@common-lisp.net http://common-lisp.net/cgi-bin/mailman/listinfo/postmodern-devel
Found in 1.03, and it's still in 1.05:
File protocol.lisp
Look for the line:
(funcall (the (function (stream (unsigned-byte 32)) t) (field-interpreter field))
Lispworks (5.02 Win32 in my test; but nothing win32-specific here) complains of inability to use a call signature function specifier. I.e. I think you can say (the function f) but not (the (function integer) f). I believe specifying a function to this degree is unsupported in lispworks. I could be wrong; but this stops doquery from working, and when I change the code to a "straight" function call (no "the") it works.
IMHO this may warrant some #+Lispworks (If omission is inherent to LW) or #+SBCL (if this is a SBCL feature) blocks here. . .
Let me know how I can be of assistance in submitting or testing code that can remove this issue from future releases.
Matt
Hey Matt,
I'm not testing with LispWorks myself, and no one had reported this before, but it seems that just removing the 'the' form is an acceptable fix. A patch has been added to the repo, so this should no longer appear in the next version.
Cheers, Marijn
On Feb 4, 2008 6:56 AM, Matt.Lamari matt.lamari@gmail.com wrote:
Found in 1.03, and it's still in 1.05:
File protocol.lisp
Look for the line:
(funcall (the (function (stream (unsigned-byte 32)) t) (field-interpreter field))
Lispworks (5.02 Win32 in my test; but nothing win32-specific here) complains of inability to use a call signature function specifier. I.e. I think you can say (the function f) but not (the (function integer) f). I believe specifying a function to this degree is unsupported in lispworks. I could be wrong; but this stops doquery from working, and when I change the code to a "straight" function call (no "the") it works.
IMHO this may warrant some #+Lispworks (If omission is inherent to LW) or #+SBCL (if this is a SBCL feature) blocks here. . .
Let me know how I can be of assistance in submitting or testing code that can remove this issue from future releases.
Matt
postmodern-devel mailing list postmodern-devel@common-lisp.net http://common-lisp.net/cgi-bin/mailman/listinfo/postmodern-devel
postmodern-devel@common-lisp.net