projects
/
clsql.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (from parent 1:
429a7a3
)
r9576: Add generalized-boolean
author
Kevin M. Rosenberg
<kevin@rosenberg.net>
Thu, 10 Jun 2004 09:41:27 +0000
(09:41 +0000)
committer
Kevin M. Rosenberg
<kevin@rosenberg.net>
Thu, 10 Jun 2004 09:41:27 +0000
(09:41 +0000)
ChangeLog
patch
|
blob
|
history
TODO
patch
|
blob
|
history
db-mysql/mysql-objects.lisp
patch
|
blob
|
history
db-oracle/oracle-objects.lisp
patch
|
blob
|
history
doc/intro.xml
patch
|
blob
|
history
sql/generic-odbc.lisp
patch
|
blob
|
history
sql/oodml.lisp
patch
|
blob
|
history
sql/package.lisp
patch
|
blob
|
history
diff --git
a/ChangeLog
b/ChangeLog
index ca87d0381db43262fb658ecf4ff89e8edd0cd3e8..bfa2556ec92dc5e4201e00c5450d0fa95cebdda4 100644
(file)
--- a/
ChangeLog
+++ b/
ChangeLog
@@
-1,5
+1,7
@@
10 Jun 2004 Kevin Rosenberg <kevin@rosenberg.net>
* db-mysql/mysql-loader.lisp: Remove load of unnecessary zlib library
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
9 Jun 2004 Kevin Rosenberg <kevin@rosenberg.net>
* Version 2.11.7 released
diff --git
a/TODO
b/TODO
index c5e706c5b8051697f20c0710424e4fc57d19816b..b72f1505141039e4ea1a4439229a6b4b8679a757 100644
(file)
--- a/
TODO
+++ b/
TODO
@@
-10,7
+10,8
@@
TESTS TO ADD
* Number and Char field types
* Add test case for return type of (setf slot-value-using-class)
* symbol slot
* 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,
VARIANCES FROM COMMONSQL
CLSQL starts with in transaction AUTOCOMMIT mode. To begin a transaction,
diff --git
a/db-mysql/mysql-objects.lisp
b/db-mysql/mysql-objects.lisp
index a118f479f2a12949a516cbe4f2ec9cbb0f6e535a..29013c7a852a882ffa5fd685305c04abb199df8a 100644
(file)
--- a/
db-mysql/mysql-objects.lisp
+++ b/
db-mysql/mysql-objects.lisp
@@
-25,9
+25,21
@@
(declare (ignore database))
(if val 1 0))
(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 '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))))
diff --git
a/db-oracle/oracle-objects.lisp
b/db-oracle/oracle-objects.lisp
index a5583ee4ea6c142dfa318541add6833af6f3973b..ac8544556246a9be5f6e8aceaa88880b49f45f7a 100644
(file)
--- a/
db-oracle/oracle-objects.lisp
+++ b/
db-oracle/oracle-objects.lisp
@@
-71,6
+71,11
@@
(declare (ignore args database))
"CHAR(1)")
(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))
(defmethod read-sql-value (val type
database (db-type (eql :oracle)))
;;(format t "value is \"~A\" of type ~A~%" val (type-of val))
@@
-97,6
+102,12
@@
(when (char-equal #\t (schar val 0))
t))
(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))
(defmethod read-sql-value (val (type (eql 'bigint))
database (db-type (eql :oracle)))
(declare (ignore database))
diff --git
a/doc/intro.xml
b/doc/intro.xml
index a717241b043dd73ce0dddeb80a158595961dc49c..c68cc5296d4c12ef0dfb2c7ae16b529926d0d1b8 100644
(file)
--- a/
doc/intro.xml
+++ b/
doc/intro.xml
@@
-132,7
+132,7
@@
socket connections.</para></listitem>
<listitem><para>&sqlite;.</para></listitem>
<listitem><para>Direct &odbc; interface.</para></listitem>
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>
<listitem><para>Allegro's DB interface (&aodbc;).</para></listitem>
</itemizedlist>
</sect2>
diff --git
a/sql/generic-odbc.lisp
b/sql/generic-odbc.lisp
index 06338ae605013a9fec962504f8deb7d3f65b7f19..5d82fdd38b81c4e0ed66a07d2a4c3d5d8146c590 100644
(file)
--- a/
sql/generic-odbc.lisp
+++ b/
sql/generic-odbc.lisp
@@
-52,6
+52,11
@@
(db-type (eql :postgresql)))
(if (string= "0" val) nil t))
(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
;;; Backend methods
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
diff --git
a/sql/package.lisp
b/sql/package.lisp
index bec620601997d431f14593cd6c63f9bd0bd27be4..0d6d375e1eaf28c2560bf6bb7f15029207b28360 100644
(file)
--- a/
sql/package.lisp
+++ b/
sql/package.lisp
@@
-331,6
+331,7
@@
#:view-table
#:bigint
#:varchar
#:view-table
#:bigint
#:varchar
+ #:generalized-boolean
#:*default-varchar-length*
;; OODML (oodml.lisp)
#:*default-varchar-length*
;; OODML (oodml.lisp)