X-Git-Url: http://git.kpe.io/?a=blobdiff_plain;f=tests%2Ftest-fdml.lisp;h=8d87097e8db1b3de950c3c0197d870b1dcd60664;hb=f716bb1161cf9e89a96945c4a444244f9d303691;hp=81fea97ea306c2dddf4ae77d8d28e5bce6ad4bdf;hpb=23b76563b25a517ad20f29d6dc5a65c8b958a042;p=clsql.git diff --git a/tests/test-fdml.lisp b/tests/test-fdml.lisp index 81fea97..8d87097 100644 --- a/tests/test-fdml.lisp +++ b/tests/test-fdml.lisp @@ -129,14 +129,17 @@ (deftest :fdml/query/1 - (clsql:query "SELECT COUNT(*) FROM EMPLOYEE WHERE (EMAIL LIKE '%org')") + (clsql:query "SELECT COUNT(*) FROM EMPLOYEE WHERE (EMAIL LIKE '%org')" :field-names nil) (("10"))) (deftest :fdml/query/2 - (clsql:query - "SELECT FIRST_NAME,LAST_NAME FROM EMPLOYEE WHERE (EMPLID <= 5) ORDER BY LAST_NAME") + (multiple-value-bind (rows field-names) + (clsql:query + "SELECT FIRST_NAME,LAST_NAME FROM EMPLOYEE WHERE (EMPLID <= 5) ORDER BY LAST_NAME") + (values rows (mapcar 'string-upcase field-names))) (("Leonid" "Brezhnev") ("Nikita" "Kruschev") ("Vladamir" "Lenin") - ("Josef" "Stalin") ("Leon" "Trotsky"))) + ("Josef" "Stalin") ("Leon" "Trotsky")) + ("FIRST_NAME" "LAST_NAME")) (deftest :fdml/execute-command/1 @@ -152,23 +155,22 @@ ;; compare min, max and average hieghts in inches (they're quite short -;; these guys!) -- only works with pgsql +;; these guys!) (deftest :fdml/select/1 - (if (member *test-database-type* '(:postgresql-socket :postgresql)) - (let ((max (clsql:select [function "floor" - [/ [* [max [height]] 100] 2.54]] - :from [employee] - :flatp t)) - (min (clsql:select [function "floor" - [/ [* [min [height]] 100] 2.54]] - :from [employee] - :flatp t)) - (avg (clsql:select [function "floor" - [avg [/ [* [height] 100] 2.54]]] - :from [employee] - :flatp t))) - (apply #'< (mapcar #'parse-integer (append min avg max)))) - t) + (let ((max (clsql:select [function "floor" + [/ [* [max [height]] 100] 2.54]] + :from [employee] + :flatp t)) + (min (clsql:select [function "floor" + [/ [* [min [height]] 100] 2.54]] + :from [employee] + :flatp t)) + (avg (clsql:select [function "floor" + [avg [/ [* [height] 100] 2.54]]] + :from [employee] + :flatp t))) + (apply #'< (mapcar #'(lambda (s) (parse-integer s :junk-allowed t)) + (append min avg max)))) t) (deftest :fdml/select/2 @@ -198,12 +200,12 @@ ("lenin@soviet.org")) (deftest :fdml/select/6 - (if (member *test-database-type* '(:postgresql-socket :postgresql)) - (mapcar #'parse-integer - (clsql:select [function "trunc" [height]] :from [employee] - :flatp t)) - (mapcar #'(lambda (s) (truncate (parse-integer s :junk-allowed t))) - (clsql:select [height] :from [employee] :flatp t))) + (if (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] + :flatp t)) + (mapcar #'(lambda (s) (truncate (parse-integer s :junk-allowed t))) + (clsql:select [height] :from [employee] :flatp t))) (1 1 1 1 1 1 1 1 1 1)) (deftest :fdml/select/7 @@ -362,7 +364,7 @@ :flatp t) results) (apply #'values (nreverse results))) - nil :COMMITTED nil ("lenin-nospam@soviet.org") :COMMITTED + nil :committed nil ("lenin-nospam@soviet.org") :committed nil ("lenin@soviet.org")) ;; runs a valid update and an invalid one within a transaction and checks