cl-2sql

Lisp to SQL compiler for Common Lisp
git clone https://logand.com/git/cl-2sql.git/
Log | Files | Refs | README | LICENSE

commit 874b54296ac7fcc9d1128f3759a8d1b72793360f
parent 1f4a96a32df590c57d24f1058a7f154f9ad2d0a2
Author: Tomas Hlavaty <tom@logand.com>
Date:   Tue,  2 Aug 2011 00:27:35 +0200

process-qchunk added

Diffstat:
Mcore.lisp | 10+++++++++-
1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/core.lisp b/core.lisp @@ -56,6 +56,14 @@ (defun execute (q qvars) (values q qvars)) +(defun process-qchunk (x) + (let ((s (gensym))) + `(with-output-to-string (,s) + (multiple-value-bind (qvars qchunks) + (print-form (macroexpand (funcall (lambda () ,@x))) ,s) + (assert (not qvars)) + (assert (not qchunks)))))) + (defmacro query (form) (multiple-value-bind (str qvars qchunks) (to-string form) (flet ((paste (x) @@ -63,7 +71,7 @@ `(list ,@x)))) `(execute ,(if qchunks - `(format nil ,str ,@(mapcar (lambda (x) `(progn ,@x)) qchunks)) + `(format nil ,str ,@(mapcar 'process-qchunk qchunks)) str) ',qvars))))