r9374: Remove redundant and commonsql incompatible order-by-descending keyword arg...
authorMarcus Pearce <m.t.pearce@city.ac.uk>
Sun, 16 May 2004 11:47:13 +0000 (11:47 +0000)
committerMarcus Pearce <m.t.pearce@city.ac.uk>
Sun, 16 May 2004 11:47:13 +0000 (11:47 +0000)
ChangeLog
sql/classes.lisp
sql/objects.lisp
tests/test-oodml.lisp

index 9eba9b96d6db77f152d61b3fda75eb344f197b09..f1764ba5895673dce318aa6b51a3bedd2e64deb6 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -7,6 +7,12 @@
        behaviour and the ANY and ALL operators in subqueries. 
        * tests/test-init.lisp: add set-operation and subquery tests to 
        appropriate skip lists. 
+       * sql/objects.lisp: remove redundant and non CommonSQL compatible 
+       ORDER-BY-DESCENDING keyword argument for SELECT. 
+       * sql/classes.lisp: remove redundant and non CommonSQL compatible 
+       ORDER-BY-DESCENDING keyword argument for SELECT. 
+       * tests/test-oodml.lisp: add test for ORDER-BY keyword to SELECT 
+       with object queries. 
 
 15 May 2004 Kevin Rosenberg (kevin@rosenberg.net)
        * Version 2.10.18
index af3ca8db3fdbecd86ad9719d1a886387a3372f92..62033591985db4e4ab3e64a4b100e81c89e7fc4b 100644 (file)
    (order-by
     :initarg :order-by
     :initform nil)
-   (order-by-descending
-    :initarg :order-by-descending
-    :initform nil)
    (inner-join
     :initarg :inner-join
     :initform nil)
 
 (defvar *select-arguments*
   '(:all :database :distinct :flatp :from :group-by :having :order-by
-    :order-by-descending :set-operation :where :offset :limit
-    :inner-join :on
+    :set-operation :where :offset :limit :inner-join :on
     ;; below keywords are not a SQL argument, but these keywords may terminate select
     :caching :refresh))
 
@@ -552,7 +548,7 @@ uninclusive, and the args from that keyword to the end."
                           :flatp flatp :refresh refresh
                           :exp arglist))
          (destructuring-bind (&key all flatp set-operation distinct from where
-                                   group-by having order-by order-by-descending
+                                   group-by having order-by 
                                    offset limit inner-join on &allow-other-keys)
              arglist
            (if (null selections)
@@ -564,15 +560,13 @@ uninclusive, and the args from that keyword to the end."
                           :distinct distinct :from from :where where
                           :limit limit :offset offset
                           :group-by group-by :having having :order-by order-by
-                          :order-by-descending order-by-descending
                           :inner-join inner-join :on on))))))
 
 (defvar *in-subselect* nil)
 
 (defmethod output-sql ((query sql-query) database)
   (with-slots (distinct selections from where group-by having order-by
-                        order-by-descending limit offset inner-join on
-                        all set-operation) 
+                        limit offset inner-join on all set-operation) 
       query
     (when *in-subselect*
       (write-string "(" *sql-stream*))
@@ -625,16 +619,6 @@ uninclusive, and the args from that keyword to the end."
               (when (cdr order)
                 (write-char #\, *sql-stream*))))
           (output-sql order-by database)))
-    (when order-by-descending
-      (write-string " ORDER BY " *sql-stream*)
-      (if (listp order-by-descending)
-          (do ((order order-by-descending (cdr order)))
-              ((null order))
-            (output-sql (car order) database)
-            (when (cdr order)
-              (write-char #\, *sql-stream*)))
-          (output-sql order-by-descending database))
-      (write-string " DESC " *sql-stream*))
     (when limit
       (write-string " LIMIT " *sql-stream*)
       (output-sql limit database))
index 869e643f23a386ffebd8bedd7db6fd09400d9ba8..8fa98903a85450c436d20258b91cdb4c81345c68 100644 (file)
@@ -968,8 +968,8 @@ superclass of the newly-defined View Class."
 (defun find-all (view-classes 
                 &rest args
                 &key all set-operation distinct from where group-by having 
-                     order-by order-by-descending offset limit refresh
-                     flatp result-types inner-join on 
+                     order-by offset limit refresh flatp result-types 
+                      inner-join on 
                      (database *default-database*)
                      instances)
   "Called by SELECT to generate object query results when the
@@ -1020,12 +1020,6 @@ superclass of the newly-defined View Class."
          (setq fullsels 
                  (append fullsels (mapcar #'(lambda (att) (cons nil att))
                                           (listify ob))))))
-      (dolist (ob (listify order-by-descending))
-       (when (and ob (not (member ob (mapcar #'cdr fullsels)
-                                  :test #'ref-equal)))
-         (setq fullsels 
-               (append fullsels (mapcar #'(lambda (att) (cons nil att))
-                                        (listify ob))))))
       (dolist (ob (listify distinct))
        (when (and (typep ob 'sql-ident) 
                   (not (member ob (mapcar #'cdr fullsels) 
index 2ae3005c55e16e73b5fd7473b233408313103f36..f934e5e7db407db244e5015e70ee38d84894dc42 100644 (file)
             (employee-addresses employee2))
          ((t t 2 2 2)))
 
+        (deftest :oodml/select/11 
+         (values (mapcar #'(lambda (x) (slot-value x 'emplid))
+                         (clsql:select 'employee :order-by '(([emplid] :asc)) 
+                                       :flatp t))
+          (mapcar #'(lambda (x) (slot-value x 'emplid))
+                  (clsql:select 'employee :order-by '(([emplid] :desc)) 
+                                :flatp t)))
+         (1 2 3 4 5 6 7 8 9 10)
+         (10 9 8 7 6 5 4 3 2 1))
+
        ;; test retrieval is deferred
        (deftest :oodm/retrieval/1
            (every #'(lambda (e) (not (slot-boundp e 'company)))