X-Git-Url: http://git.kpe.io/?p=clsql.git;a=blobdiff_plain;f=sql%2Foodml.lisp;h=329444363b6ed723dab505ae92e3ae5eaebd9441;hp=399519cfa0bef8d9544cf3a9b458e4c90513deb4;hb=a050eddab954ab3045d8427cf0c5563142266833;hpb=429a7a3dd3eb95d35373e489b7830e316711f941 diff --git a/sql/oodml.lisp b/sql/oodml.lisp index 399519c..3294443 100644 --- a/sql/oodml.lisp +++ b/sql/oodml.lisp @@ -381,10 +381,18 @@ (format nil "FLOAT(~A)" (car args)) "FLOAT")) +(deftype generalized-boolean () + "A type which outputs a SQL boolean value, though any lisp type can be stored in the slot." + t) + (defmethod database-get-type-specifier ((type (eql 'boolean)) args database db-type) (declare (ignore args database db-type)) "BOOL") +(defmethod database-get-type-specifier ((type (eql 'generalized-boolean)) args database db-type) + (declare (ignore args database db-type)) + "BOOL") + (defmethod database-get-type-specifier ((type (eql 'number)) args database db-type) (declare (ignore database db-type)) (cond @@ -442,6 +450,10 @@ (declare (ignore database db-type)) (if val "t" "f")) +(defmethod database-output-sql-as-type ((type (eql 'generalized-boolean)) val database db-type) + (declare (ignore database db-type)) + (if val "t" "f")) + (defmethod database-output-sql-as-type ((type (eql 'string)) val database db-type) (declare (ignore database db-type)) val) @@ -510,6 +522,10 @@ (declare (ignore database db-type)) (equal "t" val)) +(defmethod read-sql-value (val (type (eql 'generalized-boolean)) database db-type) + (declare (ignore database db-type)) + (equal "t" val)) + (defmethod read-sql-value (val (type (eql 'number)) database db-type) (declare (ignore database db-type)) (etypecase val