Add directory for MacPorts mysql5 port
[clsql/s11.git] / db-mysql / mysql-objects.lisp
blob76ce5e5b910c59021f2b8f68e93812ad6427c9fd
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 ;;;; $Id$
10 ;;;;
11 ;;;; CLSQL users are granted the rights to distribute and use this software
12 ;;;; as governed by the terms of the Lisp Lesser GNU Public License
13 ;;;; (http://opensource.franz.com/preamble.html), also known as the LLGPL.
14 ;;;; *************************************************************************
16 (in-package #:clsql-mysql)
18 (defmethod database-get-type-specifier ((type (eql 'wall-time)) args database
19 (db-type (eql :mysql)))
20 (declare (ignore args database))
21 "DATETIME")
23 (defmethod database-get-type-specifier ((type (eql 'smallint)) args database
24 (db-type (eql :mysql)))
25 (declare (ignore args database))
26 "SMALLINT")
28 (defmethod database-get-type-specifier ((type (eql 'mediumint)) args database
29 (db-type (eql :mysql)))
30 (declare (ignore args database))
31 "MEDIUMINT")
33 (defmethod database-get-type-specifier ((type (eql 'tinyint)) args database
34 (db-type (eql :mysql)))
35 (declare (ignore args database))
36 "TINYINT")
38 (defmethod database-output-sql-as-type ((type (eql 'boolean)) val database
39 (db-type (eql :mysql)))
40 (declare (ignore database))
41 (if val 1 0))
43 (defmethod database-output-sql-as-type ((type (eql 'generalized-boolean)) val database
44 (db-type (eql :mysql)))
45 (declare (ignore database))
46 (if val 1 0))
48 (defmethod read-sql-value (val (type (eql 'boolean)) database
49 (db-type (eql :mysql)))
50 (declare (ignore database))
51 (etypecase val
52 (string (if (string= "0" val) nil t))
53 (integer (if (zerop val) nil t))))
55 (defmethod read-sql-value (val (type (eql 'generalized-boolean)) database
56 (db-type (eql :mysql)))
57 (declare (ignore database))
58 (etypecase val
59 (string (if (string= "0" val) nil t))
60 (integer (if (zerop val) nil t))))