r9739: 7 Jul 2004 Kevin Rosenberg <kevin@rosenberg.net>
authorKevin M. Rosenberg <kevin@rosenberg.net>
Wed, 7 Jul 2004 18:03:23 +0000 (18:03 +0000)
committerKevin M. Rosenberg <kevin@rosenberg.net>
Wed, 7 Jul 2004 18:03:23 +0000 (18:03 +0000)
        * sql/ooddl.lisp: Added SMALLINT type
        * sql/generic-postgresql.lisp: Added INT2 as SMALLINT type
        * db-mysql/mysql-objects.lisp: Added SMALLINT type
        * sql/package.lisp: Export SMALLINT
        * sql/expressions.lisp: Add MYSQL's UNSIGNED and ZEROFILL as
        db-constraints

ChangeLog
db-mysql/mysql-objects.lisp
sql/expressions.lisp
sql/generic-postgresql.lisp
sql/oodml.lisp
sql/package.lisp

index 59866b9bb7d27461bf8eacf051df2ed04ed50034..6bdb6fad15a72541a7aba27bed33a1b085d27c4b 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+7 Jul 2004 Kevin Rosenberg <kevin@rosenberg.net>
+       * sql/ooddl.lisp: Added SMALLINT type
+       * sql/generic-postgresql.lisp: Added INT2 as SMALLINT type
+       * db-mysql/mysql-objects.lisp: Added SMALLINT type
+       * sql/package.lisp: Export SMALLINT
+       * sql/expressions.lisp: Add MYSQL's UNSIGNED and ZEROFILL as
+       db-constraints
+       
 6 Jul 2004 Marcus Pearce <m.t.pearce@city.ac.uk> 
        * sql/expressions.lisp: add AUTO-INCREMENT and UNIQUE to the 
        recognised column constraints for CREATE-TABLE and the :DB-CONSTRAINTS 
 6 Jul 2004 Marcus Pearce <m.t.pearce@city.ac.uk> 
        * sql/expressions.lisp: add AUTO-INCREMENT and UNIQUE to the 
        recognised column constraints for CREATE-TABLE and the :DB-CONSTRAINTS 
index 29013c7a852a882ffa5fd685305c04abb199df8a..5ddad8b5d73817da2aaded534fb153b30e3f10ce 100644 (file)
   (declare (ignore args database))
   "DATETIME")
 
   (declare (ignore args database))
   "DATETIME")
 
+(defmethod database-get-type-specifier ((type (eql 'smallint)) args database
+                                       (db-type (eql :mysql)))
+  (declare (ignore args database))
+  "SMALLINT")
+
 (defmethod database-output-sql-as-type ((type (eql 'boolean)) val database
                                        (db-type (eql :mysql)))
   (declare (ignore database))
 (defmethod database-output-sql-as-type ((type (eql 'boolean)) val database
                                        (db-type (eql :mysql)))
   (declare (ignore database))
index ace360378f240fb47b0bf126466d2383b5412b5b..2a0085f6d3f4dd53f6f7122ef51f418f2b81a894 100644 (file)
@@ -842,6 +842,8 @@ uninclusive, and the args from that keyword to the end."
    (cons (symbol-name-default-case "NULL") "NULL") 
    (cons (symbol-name-default-case "PRIMARY") "PRIMARY") 
    (cons (symbol-name-default-case "KEY") "KEY")
    (cons (symbol-name-default-case "NULL") "NULL") 
    (cons (symbol-name-default-case "PRIMARY") "PRIMARY") 
    (cons (symbol-name-default-case "KEY") "KEY")
+   (cons (symbol-name-default-case "UNSIGNED") "UNSIGNED") 
+   (cons (symbol-name-default-case "ZEROFILL") "ZEROFILL") 
    (cons (symbol-name-default-case "AUTO-INCREMENT") "AUTO_INCREMENT")
    (cons (symbol-name-default-case "UNIQUE") "UNIQUE")))
 
    (cons (symbol-name-default-case "AUTO-INCREMENT") "AUTO_INCREMENT")
    (cons (symbol-name-default-case "UNIQUE") "UNIQUE")))
 
index cf3fac370c5dfa8c0e0448290b2607f2f4bcf34c..43a92012532c85bfdc51098c00bfb95e8e18601b 100644 (file)
   (declare (ignore database))
   (if args
       (format nil "CHAR(~A)" (car args))
   (declare (ignore database))
   (if args
       (format nil "CHAR(~A)" (car args))
-      "VARCHAR"))
+    "VARCHAR"))
+
+(defmethod database-get-type-specifier ((type (eql 'smallint)) args database
+                                       (db-type (eql :postgresql)))
+  (declare (ignore args database))
+  "INT2")
 
 (defmethod database-get-type-specifier ((type (eql 'wall-time)) args database
                                        (db-type (eql :postgresql)))
 
 (defmethod database-get-type-specifier ((type (eql 'wall-time)) args database
                                        (db-type (eql :postgresql)))
index d701f0906e3a2352cbf01262c8b4179f6b02990a..499a4ed64a95190896eaafa2cd68e23937a4d851 100644 (file)
   (declare (ignore database db-type))
   (if args
       (format nil "INT(~A)" (car args))
   (declare (ignore database db-type))
   (if args
       (format nil "INT(~A)" (car args))
-      "INT"))
+    "INT"))
+
+(deftype smallint () 
+  "An integer smaller than a 32-bit integer, this width may vary by SQL implementation."
+  'integer)
+
+(defmethod database-get-type-specifier ((type (eql 'smallint)) args database db-type)
+  (declare (ignore args database db-type))
+  "INT")
 
 (deftype bigint () 
   "An integer larger than a 32-bit integer, this width may vary by SQL implementation."
 
 (deftype bigint () 
   "An integer larger than a 32-bit integer, this width may vary by SQL implementation."
        (parse-integer val)))
     (number val)))
 
        (parse-integer val)))
     (number val)))
 
+(defmethod read-sql-value (val (type (eql 'smallint)) database db-type)
+  (declare (ignore database db-type))
+  (etypecase val
+    (string
+     (unless (string-equal "NIL" val)
+       (parse-integer val)))
+    (number val)))
+
 (defmethod read-sql-value (val (type (eql 'bigint)) database db-type)
   (declare (ignore database db-type))
   (etypecase val
 (defmethod read-sql-value (val (type (eql 'bigint)) database db-type)
   (declare (ignore database db-type))
   (etypecase val
index 011353b5b3227b2513c31b7747586e7bce76af2e..8d5c33dc292f2c1795f930ee416952cea9693c5b 100644 (file)
         #:bigint
         #:varchar
         #:generalized-boolean
         #:bigint
         #:varchar
         #:generalized-boolean
+        #:smallint
         #:*default-string-length*
 
         ;; OODML (oodml.lisp) 
         #:*default-string-length*
 
         ;; OODML (oodml.lisp)