r9252: Implement new SQL-QUERY-OBJECT class and change behavior of [select 'class]
[clsql.git] / tests / test-fdml.lisp
index 53bc3faff6301b8f27b837fd1f204ae9118d83b8..380710491473a926f1198e0455bb921c36d3afdd 100644 (file)
                                :flatp t)))
   t)
 
+(deftest :fdml/select/15
+    (multiple-value-bind (rows field-names)
+       (clsql:select [addressid] [street-number] [street-name] [city_field] [zip] 
+        :from [address]
+        :where [= 1 [addressid]])
+      (values
+       rows
+       (mapcar #'string-downcase field-names)))
+  ((1 10 "Park Place" "Leningrad" 123))
+  ("addressid" "street_number" "street_name" "city_field" "zip"))
+
+(deftest :fdml/select/16
+    (clsql:select [emplid] :from [employee] :where [= 1 [emplid]]
+     :field-names nil)
+  ((1)))
+
+(deftest :fdml/select/17
+    (clsql:select [emplid] [last-name] :from [employee] :where [= 1 [emplid]]
+     :field-names nil)
+  ((1 "Lenin")))
+
+(deftest :fdml/select/18
+    (clsql:select [emplid :string] [last-name] :from [employee] :where [= 1 [emplid]]
+     :field-names nil)
+  (("1" "Lenin")))
+
 ;(deftest :fdml/select/11
 ;    (clsql:select [emplid] :from [employee]
 ;                :where [= [emplid] [any [select [companyid] :from [company]]]]
       collect (concatenate 'string forename " " surname))
   ("Yuri Andropov" "Leonid Brezhnev" "Konstantin Chernenko" "Mikhail Gorbachev"
                    "Nikita Kruschev" "Vladamir Lenin" "Vladamir Putin"
-                   "Josef Stalin" "Leon Trotsky" "Boris Yeltsin"))
+   "Josef Stalin" "Leon Trotsky" "Boris Yeltsin"))
+
+(deftest :fdml/loop/2
+    (loop for (addressid)
+      being each tuple in
+      [select [addressid] :from [address] :order-by [addressid]]
+     collect addressid)
+  (1 2))
+
+(deftest :fdml/loop/3
+    (loop for addressid
+      being each tuple in
+      [select [addressid] :from [address] :order-by [addressid]]
+      collect addressid)
+  (1 2))
 
 ;; starts a transaction deletes a record and then rolls back the deletion 
 (deftest :fdml/transaction/1