X-Git-Url: http://git.kpe.io/?p=clsql.git;a=blobdiff_plain;f=sql%2Fobjects.lisp;h=0232917ff4662b7ca80ae62d79b75b86cfd4c08d;hp=a995c221fcf2b996e77de512bed0866cfb25cf38;hb=f69c5bfba59d54628f9a08b83413ec3df3c92432;hpb=34df0812531e506e1d1ed1a811e9c3ff73de988d diff --git a/sql/objects.lisp b/sql/objects.lisp index a995c22..0232917 100644 --- a/sql/objects.lisp +++ b/sql/objects.lisp @@ -430,9 +430,7 @@ superclass of the newly-defined View Class." (defmethod update-slot-with-null ((object standard-db-object) slotname slotdef) - (let ((st (slot-type slotdef)) - (void-value (slot-value slotdef 'void-value))) - (setf (slot-value object slotname) void-value))) + (setf (slot-value object slotname) (slot-value slotdef 'void-value))) (defvar +no-slot-value+ '+no-slot-value+) @@ -586,8 +584,11 @@ superclass of the newly-defined View Class." (prin1-to-string val))) (defmethod database-output-sql-as-type ((type (eql 'boolean)) val database) - (declare (ignore database)) - (if val "t" "f")) + (case (database-underlying-type database) + (:mysql + (if val 1 0)) + (t + (if val "t" "f")))) (defmethod database-output-sql-as-type ((type (eql 'string)) val database) (declare (ignore database)) @@ -658,8 +659,13 @@ superclass of the newly-defined View Class." (float (read-from-string val))) (defmethod read-sql-value (val (type (eql 'boolean)) database) - (declare (ignore database)) - (equal "t" val)) + (case (database-underlying-type database) + (:mysql + (etypecase val + (string (if (string= "0" val) nil t)) + (integer (if (zerop val) nil t)))) + (t + (equal "t" val)))) (defmethod read-sql-value (val (type (eql 'univeral-time)) database) (declare (ignore database))