;;; Test time functions (time.lisp)
(in-package #:clsql-tests)
-#.(clsql-sys:locally-enable-sql-reader-syntax)
+(clsql-sys:file-enable-sql-reader-syntax)
(def-view-class datetest ()
- ((testtimetz :column "testtimetz"
+ ((id :column "id"
+ :type integer
+ :db-kind :key
+ :db-constraints (:not-null :unique)
+ :accessor id :initarg :id
+ :initform nil
+ :db-type "int4")
+ (testtimetz :column "testtimetz"
:type clsql-sys:wall-time
:db-kind :base
:db-constraints nil
:values (list time))
(let ((testtime
(first (clsql:select [testtime]
- :from [datetest] :flatp T
+ :from [datetest] :flatp t
:where [= [testtime] time] ))))
(format-time nil (parse-timestring testtime) :format :iso)
)))
:values (list time))
(let ((testtime
(first (clsql:select [testtime]
- :from [datetest] :flatp T
+ :from [datetest] :flatp t
:where [= [testtime] time] ))))
(format-time nil (parse-timestring testtime) :format :iso)
)))
:values (list time))
(let ((testtime
(first (clsql:select [testtime]
- :from [datetest] :flatp T
+ :from [datetest] :flatp t
:where [= [testtime] time] ))))
(format-time nil (parse-timestring testtime) :format :iso)
)))
:values (list time))
(let ((testtime
(first (clsql:select [testtime]
- :from [datetest] :flatp T
+ :from [datetest] :flatp t
:where [= [testtime] time] ))))
(format-time nil (parse-timestring testtime) :format :iso)
)))
(let ((testtime
(first (clsql:select [testtime]
:from [datetest]
- :limit 1 :flatp T
+ :limit 1 :flatp t
:where [= [testtime] time] ))))
(format-time nil (parse-timestring testtime) :format :iso)
)))
(with-dataset *ds-datetest*
(let ((time (parse-timestring "2008-09-09T14:37:29.000213-04:00")))
(clsql-sys:insert-records :into [datetest]
- :attributes '([testtimetz] [testtime])
- :values (list time time))
+ :attributes '([testtimetz] [testtime] [id])
+ :values (list time time 1))
(destructuring-bind (testtimetz testtime)
(first (clsql:select [testtimetz] [testtime]
:from [datetest]
- :limit 1 :flatp T
+ :limit 1 :flatp t
:where [= [testtime] time] ))
(values (iso-timestring (parse-timestring testtime))
(iso-timestring (parse-timestring testtimetz))))))
(with-dataset *ds-datetest*
(let ((time (parse-timestring "2008-09-09T14:37:29-04:00")))
(clsql-sys:update-records-from-instance
- (make-instance 'datetest :testtimetz time :testtime time))
+ (make-instance 'datetest :testtimetz time :testtime time :id 1))
(let ((o (first (clsql:select
'datetest
- :limit 1 :flatp T
+ :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)
(with-dataset *ds-datetest*
(let ((time (parse-timestring "2008-09-09T14:37:29.000278-04:00")))
(clsql-sys:update-records-from-instance
- (make-instance 'datetest :testtimetz time :testtime time))
+ (make-instance 'datetest :testtimetz time :testtime time :id 1))
(let ((o (first (clsql:select
'datetest
- :limit 1 :flatp T
+ :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)
#.(iso-timestring (parse-timestring "2008-09-09T14:37:29.000278-04:00"))
#.(iso-timestring (parse-timestring "2008-09-09T14:37:29.000278-04:00")))
+(deftest :time/historic-datetimes
+ (with-dataset *cross-platform-datetest*
+ (let ((time (parse-timestring "1800-09-09T14:37:29")))
+ (clsql-sys:insert-records :into [datetest]
+ :attributes '([testtime])
+ :values (list time))
+ (let ((testtime
+ (first (clsql:select [testtime]
+ :from [datetest] :flatp t
+ :where [= [testtime] time] ))))
+ (format-time nil (parse-timestring testtime) :format :iso)
+ )))
+ #.(format-time nil (parse-timestring "1800-09-09T14:37:29") :format :iso))
+
))
-#.(clsql-sys:locally-disable-sql-reader-syntax)
+
+
+