X-Git-Url: http://git.kpe.io/?p=clsql.git;a=blobdiff_plain;f=sql%2Foodml.lisp;h=78fd88648db8ca12cd081605d7d7bcf84d3c5e6c;hp=d701f0906e3a2352cbf01262c8b4179f6b02990a;hb=b5890c31a60303397efedb2110f46c6388426170;hpb=bb71f27c241187a32c7839aea501114d65e29f85 diff --git a/sql/oodml.lisp b/sql/oodml.lisp index d701f09..78fd886 100644 --- a/sql/oodml.lisp +++ b/sql/oodml.lisp @@ -315,7 +315,23 @@ (declare (ignore database db-type)) (if args (format nil "INT(~A)" (car args)) - "INT")) + "INT")) + +(deftype tinyint () + "An 8-bit integer, this width may vary by SQL implementation." + 'integer) + +(defmethod database-get-type-specifier ((type (eql 'tinyint)) args database db-type) + (declare (ignore args database db-type)) + "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." @@ -499,6 +515,14 @@ (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