X-Git-Url: http://git.kpe.io/?a=blobdiff_plain;f=tests%2Ftest-time.lisp;h=9a9136f1698ea10f798f17ced7bf17fb10ccf52e;hb=0364b03f9b49590d89156c2fa6c8718ed7804b07;hp=f373669ff65e93e9ccb1c66a3de75b8ad14e5ff4;hpb=f437fdd8966b0f4bd80a2b8657bb12df07430b83;p=clsql.git diff --git a/tests/test-time.lisp b/tests/test-time.lisp index f373669..9a9136f 100644 --- a/tests/test-time.lisp +++ b/tests/test-time.lisp @@ -8,27 +8,31 @@ (in-package #:clsql-tests) #.(clsql-sys:locally-enable-sql-reader-syntax) -(def-dataset *ds-datetest* - (:setup (lambda () (clsql-sys:create-view-from-class 'datetest))) - (:cleanup "DROP TABLE datetest")) - -(def-dataset *cross-platform-datetest* - (:setup "CREATE TABLE DATETEST (TESTTIME TIMESTAMP)") - (:cleanup "DROP TABLE DATETEST")) - (def-view-class datetest () ((testtimetz :COLUMN "testtimetz" :TYPE clsql-sys:wall-time :DB-KIND :BASE :DB-CONSTRAINTS COMMON-LISP:NIL :ACCESSOR testtimetz :INITARG :testtimetz :INITFORM COMMON-LISP:NIL - :DB-TYPE "timestamptz") + :DB-TYPE "timestamp with time zone") (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 "timestamp"))) + :DB-TYPE "timestamp without time zone"))) + +(def-dataset *ds-datetest* + (:setup (lambda () (clsql-sys:create-view-from-class 'datetest))) + (:cleanup "DROP TABLE datetest")) + + +(def-dataset *cross-platform-datetest* + (:setup (lambda () (create-table [datetest] + '(([testtime] wall-time))))) + (:cleanup (lambda () + (drop-table [datetest])))) + (setq *rt-time* '( @@ -246,8 +250,7 @@ (format-time nil time2 :format :iso)) #.(format-time nil (clsql-sys:make-time :year 2010 :month 1 :day 4 :hour 14 :minute 15 :second 44 :usec 3) - :format :iso) - t) + :format :iso)) ;;; The cross platform dataset uses the 'timestamp' column type which is @@ -261,8 +264,7 @@ :values (list time)) (let ((testtime (first (clsql:select [testtime] - :from [datetest] - :limit 1 :flatp T + :from [datetest] :flatp T :where [= [testtime] time] )))) (format-time nil (parse-timestring testtime) :format :iso) ))) @@ -276,8 +278,7 @@ :values (list time)) (let ((testtime (first (clsql:select [testtime] - :from [datetest] - :limit 1 :flatp T + :from [datetest] :flatp T :where [= [testtime] time] )))) (format-time nil (parse-timestring testtime) :format :iso) ))) @@ -291,8 +292,7 @@ :values (list time)) (let ((testtime (first (clsql:select [testtime] - :from [datetest] - :limit 1 :flatp T + :from [datetest] :flatp T :where [= [testtime] time] )))) (format-time nil (parse-timestring testtime) :format :iso) ))) @@ -315,6 +315,7 @@ + ;;; All odbc databases use local times exclusively (they do not send timezone info) ;;; Postgresql can use timezones, except when being used over odbc. This test when ;;; run through both postgres socket and postgres odbc should test a fairly @@ -340,9 +341,9 @@ :limit 1 :flatp T :where [= [testtime] time] )) (assert (time= (parse-timestring testtimetz) time) (testtimetz time) - "Timetz of o: ~s should be time:~s" testtimetz time) + "Timetz of db: ~s should be time:~s" testtimetz time) (assert (time= (parse-timestring testtime) time) (testtime time) - "Time of o: ~s should be time:~s" testtime time)))) + "Time of db: ~s should be time:~s" testtime time)))) nil) (deftest :time/pg/oodml/no-usec