added some generic postegres code to send times to the database as iso8601
authorRuss Tyndall <russ@acceleration.net>
Thu, 9 Oct 2008 18:30:22 +0000 (14:30 -0400)
committerNathan Bird <nathan@acceleration.net>
Mon, 2 Feb 2009 19:31:28 +0000 (14:31 -0500)
sql/generic-postgresql.lisp
sql/time.lisp

index 360d5fe4b1a623a8a412b9e3bf9fa40ec813f333..5498ee2d0114f43cd2a5a77044da7df4b3cba972 100644 (file)
   (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))
index 32c10b70227f3dfc1950d3a459b8f1b1e506677d..4e8b6af25ce6c6128bc192d837b3952d25416746 100644 (file)
@@ -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