[clouchdb-cvs] CVS clouchdb/src
peddy
peddy at common-lisp.net
Fri Feb 22 01:33:50 UTC 2008
Update of /project/clouchdb/cvsroot/clouchdb/src
In directory clnet:/tmp/cvs-serv26656
Modified Files:
clouchdb.lisp
Log Message:
Use document-to-json to quote view key parameters to support complex types
--- /project/clouchdb/cvsroot/clouchdb/src/clouchdb.lisp 2008/02/16 19:36:07 1.21
+++ /project/clouchdb/cvsroot/clouchdb/src/clouchdb.lisp 2008/02/22 01:33:49 1.22
@@ -66,11 +66,11 @@
"Return \"false\" if value is nil, otherwise nil"
(unless value "false"))
-(defvar *view-options*
- '((:key . ((:name . "key") (:fn . doublequote)))
- (:start-key . ((:name . "startkey") (:fn . doublequote)))
- (:start-key-docid . ((:name . "startkey_docid") (:fn . doublequote)))
- (:end-key . ((:name . "endkey") (:fn . doublequote)))
+(defparameter *view-options*
+ `((:key . ((:name . "key") (:fn . document-to-json)))
+ (:start-key . ((:name . "startkey") (:fn . document-to-json)))
+ (:start-key-docid . ((:name . "startkey_docid") (:fn . document-to-json)))
+ (:end-key . ((:name . "endkey") (:fn . document-to-json)))
(:count . ((:name . "count") (:fn . value-as-string)))
(:update . ((:name . "update") (:fn . false-if-false)))
(:descending . ((:name . "descending") (:fn . true-if-true)))
@@ -333,32 +333,33 @@
document or null."
(let ((res))
(labels ((q (query doc rec)
-;; (format t "~%test: r=~s, query=~s doc=~s~%" rec query doc)
+ ;;(format t "~%test: r=~s, query=~s doc=~s~%" rec query doc)
(cond ((null doc)
nil)
((null query)
(push doc res))
((eq :** (car query))
+;; (format t "action: :**~%")
(q (cdr query) doc t))
((and (listp query) (eq :** (car query)))
-;; (format t "action: :**~%")
+;; (format t "action: (:**)~%")
(q (cdr query) doc t))
((assoclp doc)
-;; (format t "action: assoclp doc=~s ~%" doc)
+ ;; (format t "action: assoclp doc=~s ~%" doc)
(dolist (e doc)
(q query e rec)))
((functionp (car query))
-;; (format t "action: functionp~%")
+ ;; (format t "action: functionp~%")
(q (cdr query) (funcall (car query) doc) rec))
((keyword-assocp doc)
-;; (format t "action: keyword-assocp doc=~S~%" doc)
+ ;; (format t "action: keyword-assocp doc=~S~%" doc)
(cond ((or (eq (car query) (car doc)) (eq :* (car query)))
-;; (format t "action: keyword asscoc=t~%" doc)
+ ;; (format t "action: keyword asscoc=t~%" doc)
(q (cdr query) (cdr doc) nil))
((and rec (listp (cdr doc)))
(q query (cdr doc) t))))
((listp doc)
-;; (format t "action: listp~%")
+ ;; (format t "action: listp~%")
(dolist (e doc)
(q query e rec)))
(t nil))))
@@ -376,7 +377,7 @@
(multiple-value-bind (body status headers uri stream must-close reason-phrase)
(apply #'drakma:http-request (make-uri uri) args)
(declare (ignore reason-phrase stream uri headers status))
-;; (format t " -> uri: ~S~%" uri)
+;; (format t " -> uri: ~a~%" uri)
;; (format t " -> headers: ~S~%" headers)
(cond (must-close
;; (format t "body: ~S~%" body)
More information about the clouchdb-cvs
mailing list