Remove CVS $Id$ keyword
[clsql.git] / db-mysql / mysql-objects.lisp
1 ;;;; -*- Mode: LISP; Syntax: ANSI-Common-Lisp; Base: 10 -*-
2 ;;;; *************************************************************************
3 ;;;; FILE IDENTIFICATION
4 ;;;;
5 ;;;; Name:     mysql-objects.lisp
6 ;;;; Purpose:  CLSQL Object layer for MySQL
7 ;;;; Created:  May 2004
8 ;;;;
9 ;;;; CLSQL users are granted the rights to distribute and use this software
10 ;;;; as governed by the terms of the Lisp Lesser GNU Public License
11 ;;;; (http://opensource.franz.com/preamble.html), also known as the LLGPL.
12 ;;;; *************************************************************************
13
14 (in-package #:clsql-mysql)
15
16 (defmethod database-get-type-specifier ((type (eql 'wall-time)) args database
17                                         (db-type (eql :mysql)))
18   (declare (ignore args database))
19   "DATETIME")
20
21 (defmethod database-get-type-specifier ((type (eql 'smallint)) args database
22                                         (db-type (eql :mysql)))
23   (declare (ignore args database))
24   "SMALLINT")
25
26 (defmethod database-get-type-specifier ((type (eql 'mediumint)) args database
27                                         (db-type (eql :mysql)))
28   (declare (ignore args database))
29   "MEDIUMINT")
30
31 (defmethod database-get-type-specifier ((type (eql 'tinyint)) args database
32                                         (db-type (eql :mysql)))
33   (declare (ignore args database))
34   "TINYINT")
35
36 (defmethod database-output-sql-as-type ((type (eql 'boolean)) val database
37                                         (db-type (eql :mysql)))
38   (declare (ignore database))
39   (if val 1 0))
40
41 (defmethod database-output-sql-as-type ((type (eql 'generalized-boolean)) val database
42                                         (db-type (eql :mysql)))
43   (declare (ignore database))
44   (if val 1 0))
45
46 (defmethod read-sql-value (val (type (eql 'boolean)) database
47                            (db-type (eql :mysql)))
48   (declare (ignore database))
49   (etypecase val
50     (string (if (string= "0" val) nil t))
51     (integer (if (zerop val) nil t))))
52
53 (defmethod read-sql-value (val (type (eql 'generalized-boolean)) database
54                            (db-type (eql :mysql)))
55   (declare (ignore database))
56   (etypecase val
57     (string (if (string= "0" val) nil t))
58     (integer (if (zerop val) nil t))))