r9365: 15 May 2004 Kevin Rosenberg (kevin@rosenberg.net)
[clsql.git] / tests / test-fdml.lisp
index 5c95fcd19c2aeb9a65b9ed4da5a37f9d139dae17..f764e73ae28db0c446fde6e42f9afdf57f2349c6 100644 (file)
   ("lenin@soviet.org"))
 
 (deftest :fdml/select/6
-    (if (db-type-has-fancy-math? *test-database-underlying-type*)
+    (if (clsql-sys:db-type-has-fancy-math? *test-database-underlying-type*)
         (mapcar #'(lambda (s) (parse-integer s :junk-allowed t))
                (clsql:select [function "trunc" [height]] :from [employee]
                              :result-types nil 
  ("Vlad" "Jose" "Leon" "Niki" "Leon" "Yuri" "Kons" "Mikh" "Bori" "Vlad"))
 
 (deftest :fdml/select/22 
-  (clsql:select [\|\| [first-name] " " [last-name]] :from [employee]
+  (clsql:select [|| [first-name] " " [last-name]] :from [employee]
                 :flatp t :order-by [emplid] :field-names nil)
  ("Vladamir Lenin" "Josef Stalin" "Leon Trotsky" "Nikita Kruschev"
  "Leonid Brezhnev" "Yuri Andropov" "Konstantin Chernenko" "Mikhail Gorbachev"
  ("Boris" "Josef" "Konstantin" "Leon" "Leonid" "Mikhail" "Nikita" "Vladamir"
   "Yuri"))
 
+(deftest :fdml/select/25
+ (clsql:select [first-name] :from "employee" :flatp t :distinct t
+                            :field-names nil 
+                            :result-types nil 
+                            :order-by [first-name])
+ ("Boris" "Josef" "Konstantin" "Leon" "Leonid" "Mikhail" "Nikita" "Vladamir"
+  "Yuri"))
+
+(deftest :fdml/select/26
+ (clsql:select ["table" first-name] ["table" last-name] 
+  :from '([employee "table"] [employee "join"])
+  :where [and [= ["table" first-name] 
+                 ["join" first-name]]
+              [not [= ["table" emplid] 
+                      ["join" emplid]]]]
+  :order-by '(["table" last-name])
+  :result-types nil :field-names nil)
+ (("Vladamir" "Lenin") ("Vladamir" "Putin")))
+
+(deftest :fdml/select/27 
+ (clsql:select [coalesce [managerid] 10] :from [employee] :order-by [emplid]
+  :field-names nil :result-types nil :flatp t)
+ ("10" "1" "1" "1" "1" "1" "1" "1" "1" "1"))
+  
 ;(deftest :fdml/select/11
 ;    (clsql:select [emplid] :from [employee]
 ;                :where [= [emplid] [any [select [companyid] :from [company]]]]