X-Git-Url: http://git.kpe.io/?p=clsql.git;a=blobdiff_plain;f=tests%2Ftest-fdml.lisp;h=f067e1e48c3465352a7303796fa5cff20068786c;hp=bf57c13c0d638df3767a975ca8e85251e3d9902c;hb=d9f41af62750c622945bb17b622a39689ee5b840;hpb=a194659ff405bed6fc42651d907f5ba76999bce3 diff --git a/tests/test-fdml.lisp b/tests/test-fdml.lisp index bf57c13..f067e1e 100644 --- a/tests/test-fdml.lisp +++ b/tests/test-fdml.lisp @@ -24,10 +24,10 @@ ;; inserts a record using all values only and then deletes it (deftest :fdml/insert/1 - (progn + (let ((now (get-universal-time))) (clsql:insert-records :into [employee] - :values `(11 1 "Yuri" "Gagarin" "gagarin@soviet.org" - 1 1 1.85 t ,(clsql:get-time))) + :values `(11 1 "Yuri" "Gagarin" "gagarin@soviet.org" + 1 1 1.85 t ,(clsql:utime->time now) ,now)) (values (clsql:select [first-name] [last-name] [email] :from [employee] :where [= [emplid] 11]) @@ -368,7 +368,7 @@ ("1" "2" "3" "4")) (deftest :fdml/select/21 - (clsql:select [substr [first-name] 1 4] :from [employee] + (clsql:select [substring [first-name] 1 4] :from [employee] :flatp t :order-by [emplid] :field-names nil) ("Vlad" "Jose" "Leon" "Niki" "Leon" "Yuri" "Kons" "Mikh" "Bori" "Vlad")) @@ -478,6 +478,20 @@ :flatp t :result-types nil :field-names nil))) ("Lenin" "Stalin" "Trotsky" "Kruschev")) +;; test escaping of single quotes +(deftest :fdml/select/35 + (clsql:select "What's up doc?" :from [employee] :flatp t :field-names nil) + ("What's up doc?" "What's up doc?" "What's up doc?" "What's up doc?" + "What's up doc?" "What's up doc?" "What's up doc?" "What's up doc?" + "What's up doc?" "What's up doc?")) + +;; test proper treatment of backslash (depending on backend) +(deftest :fdml/select/36 + (clsql:select "foo\\bar\\baz" :from [employee] :flatp t :field-names nil) + ("foo\\bar\\baz" "foo\\bar\\baz" "foo\\bar\\baz" "foo\\bar\\baz" + "foo\\bar\\baz" "foo\\bar\\baz" "foo\\bar\\baz" "foo\\bar\\baz" + "foo\\bar\\baz" "foo\\bar\\baz")) + (deftest :fdml/do-query/1 (let ((result '())) (clsql:do-query ((name) [select [last-name] :from [employee] @@ -626,8 +640,7 @@ :flatp t) results) (apply #'values (nreverse results))) - nil :committed nil ("lenin-nospam@soviet.org") :committed - nil ("lenin@soviet.org")) + nil nil nil ("lenin-nospam@soviet.org") nil nil ("lenin@soviet.org")) ;; runs a valid update and an invalid one within a transaction and checks ;; that the valid update is rolled back when the invalid one fails. @@ -657,6 +670,7 @@ (apply #'values (nreverse results)))))) nil nil ("lenin@soviet.org")) + )) #.(clsql:restore-sql-reader-syntax-state)