r9253: Add *db-auto-sync* special var for controlling creation/updating of db records...
[clsql.git] / tests / test-fdml.lisp
index 53bc3faff6301b8f27b837fd1f204ae9118d83b8..df9f28faf52bd6f90be6749dcd83e8d528ba3d6f 100644 (file)
@@ -27,7 +27,7 @@
     (progn
       (clsql:insert-records :into [employee] 
                            :values `(11 1 "Yuri" "Gagarin" "gagarin@soviet.org"
-                                     1 1 1.85 t ,(clsql-base:get-time)))
+                                     1 1 1.85 t ,(clsql:get-time)))
       (values 
        (clsql:select [first-name] [last-name] [email]
                     :from [employee] :where [= [emplid] 11])
                                :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