projects
/
clsql.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
r9576: Add generalized-boolean
[clsql.git]
/
sql
/
oodml.lisp
diff --git
a/sql/oodml.lisp
b/sql/oodml.lisp
index 399519cfa0bef8d9544cf3a9b458e4c90513deb4..329444363b6ed723dab505ae92e3ae5eaebd9441 100644
(file)
--- a/
sql/oodml.lisp
+++ b/
sql/oodml.lisp
@@
-381,10
+381,18
@@
(format nil "FLOAT(~A)" (car args))
"FLOAT"))
(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 '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
(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"))
(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)
(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))
(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
(defmethod read-sql-value (val (type (eql 'number)) database db-type)
(declare (ignore database db-type))
(etypecase val