10 Jun 2004 Kevin Rosenberg <kevin@rosenberg.net>
* db-mysql/mysql-loader.lisp: Remove load of unnecessary zlib library
+ * multiple: Add generalized-boolean type as requested by
+ Edi Weitz
9 Jun 2004 Kevin Rosenberg <kevin@rosenberg.net>
* Version 2.11.7 released
* Number and Char field types
* Add test case for return type of (setf slot-value-using-class)
* symbol slot
-
+* generalized-boolean slot
+
VARIANCES FROM COMMONSQL
CLSQL starts with in transaction AUTOCOMMIT mode. To begin a transaction,
(declare (ignore database))
(if val 1 0))
+(defmethod database-output-sql-as-type ((type (eql 'generalized-boolean)) val database
+ (db-type (eql :mysql)))
+ (declare (ignore database))
+ (if val 1 0))
+
(defmethod read-sql-value (val (type (eql 'boolean)) database
(db-type (eql :mysql)))
(declare (ignore database))
(etypecase val
(string (if (string= "0" val) nil t))
(integer (if (zerop val) nil t))))
+
+(defmethod read-sql-value (val (type (eql 'generalized-boolean)) database
+ (db-type (eql :mysql)))
+ (declare (ignore database))
+ (etypecase val
+ (string (if (string= "0" val) nil t))
+ (integer (if (zerop val) nil t))))
(declare (ignore args database))
"CHAR(1)")
+(defmethod database-get-type-specifier ((type (eql 'generalized-boolean)) args
+ database (db-type (eql :oracle)))
+ (declare (ignore args database))
+ "CHAR(1)")
+
(defmethod read-sql-value (val type
database (db-type (eql :oracle)))
;;(format t "value is \"~A\" of type ~A~%" val (type-of val))
(when (char-equal #\t (schar val 0))
t))
+(defmethod read-sql-value (val (type (eql 'generalized-boolean))
+ database (db-type (eql :oracle)))
+ (declare (ignore database))
+ (when (char-equal #\t (schar val 0))
+ t))
+
(defmethod read-sql-value (val (type (eql 'bigint))
database (db-type (eql :oracle)))
(declare (ignore database))
socket connections.</para></listitem>
<listitem><para>&sqlite;.</para></listitem>
<listitem><para>Direct &odbc; interface.</para></listitem>
- <listitem><para>&oracle;</para></listitem>
+ <listitem><para>&oracle; OCI.</para></listitem>
<listitem><para>Allegro's DB interface (&aodbc;).</para></listitem>
</itemizedlist>
</sect2>
(db-type (eql :postgresql)))
(if (string= "0" val) nil t))
+(defmethod read-sql-value (val (type (eql 'generalized-boolean))
+ (database generic-odbc-database)
+ (db-type (eql :postgresql)))
+ (if (string= "0" val) nil t))
+
;;; Backend methods
(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
(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)
(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
#:view-table
#:bigint
#:varchar
+ #:generalized-boolean
#:*default-varchar-length*
;; OODML (oodml.lisp)