From: Russ Tyndall Date: Thu, 9 Oct 2008 18:30:22 +0000 (-0400) Subject: added some generic postegres code to send times to the database as iso8601 X-Git-Url: http://git.kpe.io/?a=commitdiff_plain;h=3895690af1045315a82a216fabe312d1a7e67dc5;p=clsql.git added some generic postegres code to send times to the database as iso8601 --- diff --git a/sql/generic-postgresql.lisp b/sql/generic-postgresql.lisp index 360d5fe..5498ee2 100644 --- a/sql/generic-postgresql.lisp +++ b/sql/generic-postgresql.lisp @@ -29,6 +29,14 @@ (declare (ignore database db-type)) val) +(defmethod database-output-sql ((self wall-time) (database generic-postgresql-database)) + (declare (ignore database)) + (concatenate 'string "'" (format-time nil self :format :iso8601) "'")) + +(defmethod database-output-sql ((self date) (database generic-postgresql-database)) + (declare (ignore database)) + (concatenate 'string "'" (format-time nil (date->time self) :format :iso8601) "'")) + (defmethod database-get-type-specifier (type args database (db-type (eql :postgresql))) (declare (ignore type args database)) diff --git a/sql/time.lisp b/sql/time.lisp index 32c10b7..4e8b6af 100644 --- a/sql/time.lisp +++ b/sql/time.lisp @@ -852,6 +852,9 @@ with the given options" (if stream (write-string string stream) string))) + (:iso8601 + (format stream "~4,'0D-~2,'0D-~2,'0DT~2,'0D:~2,'0D:~2,'0D.~DZ" + year month day hour minute second usec)) (t (format stream "~2,'0D~A~2,'0D~A~2,'0D~A~2,'0D~A~2,'0D~A~2,'0D.~6,'0D" year date-separator month date-separator day