r8835: integration improvements
authorKevin M. Rosenberg <kevin@rosenberg.net>
Tue, 6 Apr 2004 14:44:30 +0000 (14:44 +0000)
committerKevin M. Rosenberg <kevin@rosenberg.net>
Tue, 6 Apr 2004 14:44:30 +0000 (14:44 +0000)
clsql.asd
sql/sql.lisp
sql/usql.lisp

index cef8387f6fa0d35be9c1b29807e51be3be7e43db..324ff5def309f888629e7635cea9757650e9d688 100644 (file)
--- a/clsql.asd
+++ b/clsql.asd
@@ -24,7 +24,7 @@
   :name "clsql"
   :author "Kevin Rosenberg <kevin@rosenberg.net>"
   :maintainer "Kevin M. Rosenberg <kmr@debian.org>"
-  :version "1.5.x"
+  :version "2.1.x"
   :licence "Lessor Lisp General Public License"
   :description "Common Lisp SQL Interface Library"
   :long-description "cl-sql package provides the high-level interface for the CLSQL system."
index 7e36da85b94582527e629c09e68cdf05c1ff3be7..c207a8f52221b11de881e0fe543a98e68b025742 100644 (file)
 
 ;;; Row processing macro
 
+(defmacro for-each-row (((&rest fields) &key from order-by where distinct limit) &body body)
+  (let ((d (gensym "DISTINCT-"))
+       (bind-fields (loop for f in fields collect (car f)))
+       (w (gensym "WHERE-"))
+       (o (gensym "ORDER-BY-"))
+       (frm (gensym "FROM-"))
+       (l (gensym "LIMIT-"))
+       (q (gensym "QUERY-")))
+    `(let ((,frm ,from)
+          (,w ,where)
+          (,d ,distinct)
+          (,l ,limit)
+          (,o ,order-by))
+      (let ((,q (query-string ',fields ,frm ,w ,d ,o ,l)))
+       (loop for tuple in (query ,q)
+             collect (destructuring-bind ,bind-fields tuple
+                  ,@body))))))
 
+(defun query-string (fields from where distinct order-by limit)
+  (concatenate
+   'string
+   (format nil "select ~A~{~A~^,~} from ~{~A~^ and ~}" 
+          (if distinct "distinct " "") (field-names fields)
+          (from-names from))
+   (if where (format nil " where ~{~A~^ ~}"
+                    (where-strings where)) "")
+   (if order-by (format nil " order by ~{~A~^, ~}"
+                       (order-by-strings order-by)))
+   (if limit (format nil " limit ~D" limit) "")))
 
 (defun lisp->sql-name (field)
   (typecase field
            (format nil "~A ~A" (lisp->sql-name (car o))
                    (lisp->sql-name (cadr o))))))
 
-(defun query-string (fields from where distinct order-by limit)
-  (concatenate
-   'string
-   (format nil "select ~A~{~A~^,~} from ~{~A~^ and ~}" 
-          (if distinct "distinct " "") (field-names fields)
-          (from-names from))
-   (if where (format nil " where ~{~A~^ ~}"
-                    (where-strings where)) "")
-   (if order-by (format nil " order by ~{~A~^, ~}"
-                       (order-by-strings order-by)))
-   (if limit (format nil " limit ~D" limit) "")))
-
-(defmacro for-each-row (((&rest fields) &key from order-by where distinct limit) &body body)
-  (let ((d (gensym "DISTINCT-"))
-       (bind-fields (loop for f in fields collect (car f)))
-       (w (gensym "WHERE-"))
-       (o (gensym "ORDER-BY-"))
-       (frm (gensym "FROM-"))
-       (l (gensym "LIMIT-"))
-       (q (gensym "QUERY-")))
-    `(let ((,frm ,from)
-          (,w ,where)
-          (,d ,distinct)
-          (,l ,limit)
-          (,o ,order-by))
-      (let ((,q (query-string ',fields ,frm ,w ,d ,o ,l)))
-       (loop for tuple in (query ,q)
-             collect (destructuring-bind ,bind-fields tuple
-                  ,@body))))))
 
 ;;; Marc Battyani : Large objects support
 
index 472de2ddfe9bf8de36793d63fd3bd1ee79223468..1acd88a8abfcb751137de110c1c41edbbc1eda8e 100644 (file)
@@ -20,6 +20,9 @@
 
 
 ;;; Minimal high-level routines to enable low-level interface for USQL
+;;; Thse functions are not exported. If you application depends on these
+;;; consider using the clsql-usql package.
+
 
 (in-package #:clsql-sys)