X-Git-Url: http://git.kpe.io/?a=blobdiff_plain;f=tests%2Ftest-time.lisp;h=4cf7f08cddf7330b00f266200f04b9c3102b5e87;hb=6d643c3749b77b6e6207871f0cf40f135094f457;hp=9b4b85780dacada03d4ea2b717e516036deedf28;hpb=e567409d9fff3f7231c2a0bb69b345e19de2b246;p=clsql.git diff --git a/tests/test-time.lisp b/tests/test-time.lisp index 9b4b857..4cf7f08 100644 --- a/tests/test-time.lisp +++ b/tests/test-time.lisp @@ -213,4 +213,42 @@ (clsql:time= add-time roll-time)) t) + + + +(def-view-class datetest () + ((testtime :COLUMN "testtime" :TYPE + clsql-sys:wall-time :DB-KIND :BASE + :DB-CONSTRAINTS COMMON-LISP:NIL + :ACCESSOR testtime :INITARG + :testtime :INITFORM COMMON-LISP:NIL + :DB-TYPE "timestamptz"))) + + + +(deftest :time-test-retrieving/saving/retrieving + (when (or (eq :postgresql *test-database-underlying-type*) + (eq :postgresql-socket *test-database-underlying-type*)) + #.(clsql-sys:locally-enable-sql-reader-syntax) + (unless (clsql-sys:table-exists-p "datetest") + (clsql-sys:create-view-from-class 'datetest)) + (clsql-sys:delete-records :from 'datetest) + (let ((time (parse-timestring "2008-09-09T14:37:29.622278-04:00"))) + (clsql-sys:update-records-from-instance + (make-instance 'datetest :testtime time)) + (let ((o (first (clsql:select + 'datetest + :limit 1 :flatp T + :where [= [testtime] time] )))) + (assert o (o) "o shouldnt be null here (we should have just inserted)") + (update-records-from-instance o) + (update-instance-from-records o) + (assert (time= (testtime o) time) (time o) "Time of o: ~a should be time:~a" (testtime o) time) + #.(clsql-sys:locally-disable-sql-reader-syntax) + ) + ) + nil + ) + nil) + ))