X-Git-Url: http://git.kpe.io/?p=clsql.git;a=blobdiff_plain;f=db-mysql%2Fmysql-objects.lisp;h=76ce5e5b910c59021f2b8f68e93812ad6427c9fd;hp=a118f479f2a12949a516cbe4f2ec9cbb0f6e535a;hb=refs%2Ftags%2Fv3.8.6;hpb=5148be446aee32ec705beac3fbba35f499df4fd4 diff --git a/db-mysql/mysql-objects.lisp b/db-mysql/mysql-objects.lisp index a118f47..76ce5e5 100644 --- a/db-mysql/mysql-objects.lisp +++ b/db-mysql/mysql-objects.lisp @@ -16,18 +16,45 @@ (in-package #:clsql-mysql) (defmethod database-get-type-specifier ((type (eql 'wall-time)) args database - (db-type (eql :mysql))) + (db-type (eql :mysql))) (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-get-type-specifier ((type (eql 'mediumint)) args database + (db-type (eql :mysql))) + (declare (ignore args database)) + "MEDIUMINT") + +(defmethod database-get-type-specifier ((type (eql 'tinyint)) args database + (db-type (eql :mysql))) + (declare (ignore args database)) + "TINYINT") + (defmethod database-output-sql-as-type ((type (eql 'boolean)) val database - (db-type (eql :mysql))) + (db-type (eql :mysql))) + (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)) + (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))))