X-Git-Url: http://git.kpe.io/?p=clsql.git;a=blobdiff_plain;f=db-mysql%2Fmysql-objects.lisp;h=0a9e7b324e1c1bd8c46cc1f40dc8d15fdfaf1dd7;hp=76ce5e5b910c59021f2b8f68e93812ad6427c9fd;hb=4f756ab532ff033a34597a1c8030379e252952ca;hpb=e567409d9fff3f7231c2a0bb69b345e19de2b246 diff --git a/db-mysql/mysql-objects.lisp b/db-mysql/mysql-objects.lisp index 76ce5e5..0a9e7b3 100644 --- a/db-mysql/mysql-objects.lisp +++ b/db-mysql/mysql-objects.lisp @@ -6,8 +6,6 @@ ;;;; Purpose: CLSQL Object layer for MySQL ;;;; Created: May 2004 ;;;; -;;;; $Id$ -;;;; ;;;; CLSQL users are granted the rights to distribute and use this software ;;;; as governed by the terms of the Lisp Lesser GNU Public License ;;;; (http://opensource.franz.com/preamble.html), also known as the LLGPL. @@ -15,46 +13,13 @@ (in-package #:clsql-mysql) -(defmethod database-get-type-specifier ((type (eql 'wall-time)) args database - (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 +(defmethod database-get-type-specifier ((type symbol) args database (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)) - (etypecase val - (string (if (string= "0" val) nil t)) - (integer (if (zerop val) nil t)))) + (declare (ignore args database db-type)) + (case type + (wall-time "DATETIME") + (tinyint "TINYINT") + (smallint "SMALLINT") + (mediumint "MEDIUMINT") + (t (call-next-method)))) -(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))))