X-Git-Url: http://git.kpe.io/?p=clsql.git;a=blobdiff_plain;f=sql%2Foodml.lisp;h=187694dcacb5011d28b6900ffd186f0d20e058af;hp=e2a487e2412c773a1d7db76f9e4a41d2639a946e;hb=fc58e4fb7d908985389c86adf57ddee6c1dde5d2;hpb=f2b60454f7153077be7ad84cbb0f177d037bcbec diff --git a/sql/oodml.lisp b/sql/oodml.lisp index e2a487e..187694d 100644 --- a/sql/oodml.lisp +++ b/sql/oodml.lisp @@ -103,7 +103,7 @@ ((typep slot-reader 'string) (setf (slot-value instance slot-name) (format nil slot-reader value))) - ((typep slot-reader 'function) + ((typep slot-reader '(or symbol function)) (setf (slot-value instance slot-name) (apply slot-reader (list value)))) (t @@ -120,7 +120,7 @@ nil) ((typep slot-reader 'string) (format nil slot-reader value)) - ((typep slot-reader 'function) + ((typep slot-reader '(or symbol function)) (apply slot-reader (list value))) (t (error "Slot reader is of an unusual type."))))) @@ -130,7 +130,7 @@ (dbtype (specified-type slotdef))) (typecase dbwriter (string (format nil dbwriter val)) - (function (apply dbwriter (list val))) + ((and (or symbol function) (not null)) (apply dbwriter (list val))) (t (database-output-sql-as-type (typecase dbtype @@ -381,6 +381,10 @@ (declare (ignore args database db-type)) "TIMESTAMP") +(defmethod database-get-type-specifier ((type (eql 'date)) args database db-type) + (declare (ignore args database db-type)) + "DATE") + (defmethod database-get-type-specifier ((type (eql 'duration)) args database db-type) (declare (ignore database args db-type)) "VARCHAR") @@ -584,6 +588,11 @@ (unless (eq 'NULL val) (parse-timestring val))) +(defmethod read-sql-value (val (type (eql 'date)) database db-type) + (declare (ignore database db-type)) + (unless (eq 'NULL val) + (parse-datestring val))) + (defmethod read-sql-value (val (type (eql 'duration)) database db-type) (declare (ignore database db-type)) (unless (or (eq 'NULL val)