From 606f6b3eb642523512d12927ff83120b688e8bf9 Mon Sep 17 00:00:00 2001 From: "Kevin M. Rosenberg" Date: Sun, 23 May 2004 06:35:34 +0000 Subject: [PATCH] r9446: * db-mysql/mysql-objects.lisp: New file * sql/objects.lisp: Move MySQL specific code to mysql-objects.lisp --- ChangeLog | 3 +++ clsql-mysql.asd | 3 ++- db-mysql/mysql-objects.lisp | 28 ++++++++++++++++++++++++++++ sql/objects.lisp | 13 ++----------- 4 files changed, 35 insertions(+), 12 deletions(-) create mode 100644 db-mysql/mysql-objects.lisp diff --git a/ChangeLog b/ChangeLog index 7cc79de..c3143fc 100644 --- a/ChangeLog +++ b/ChangeLog @@ -3,11 +3,14 @@ * sql/classes.lisp: honor case of string tables when outputting queries * sql/objects.lisp: Add database type to default database-get-type-specifier method * sql/sql.lisp: Add database type to default database-abort-transaction method + * db-mysql/mysql-objects.lisp: New file + * sql/objects.lisp: Move MySQL specific code to mysql-objects.lisp * sql/utils.lisp: Add GETENV function which will be used to get ORACLE_HOME from environment * test/test-fdml.lisp: String table names are now case sensitive, so convert to default db case for FDML/SELECT/25 +>>>>>>> .r9445 22 May 2004 Kevin Rosenberg * Version 2.10.20 released: Oracle backend now fails 6 out of 200 tests * TODO: Added 2 variances from CommonSQL. Add tests for owner phrases diff --git a/clsql-mysql.asd b/clsql-mysql.asd index b20b4a0..fe661dc 100644 --- a/clsql-mysql.asd +++ b/clsql-mysql.asd @@ -90,4 +90,5 @@ (:file "mysql-loader" :depends-on ("mysql-package" "mysql")) (:file "mysql-client-info" :depends-on ("mysql-loader")) (:file "mysql-api" :depends-on ("mysql-client-info")) - (:file "mysql-sql" :depends-on ("mysql-api")))))) + (:file "mysql-sql" :depends-on ("mysql-api")) + (:file "mysql-objects" :depends-on ("mysql-sql")))))) diff --git a/db-mysql/mysql-objects.lisp b/db-mysql/mysql-objects.lisp new file mode 100644 index 0000000..ae24cac --- /dev/null +++ b/db-mysql/mysql-objects.lisp @@ -0,0 +1,28 @@ +;;;; -*- Mode: LISP; Syntax: ANSI-Common-Lisp; Base: 10 -*- +;;;; ************************************************************************* +;;;; FILE IDENTIFICATION +;;;; +;;;; Name: mysql-objects.lisp +;;;; Purpose: CLSQL Object layer for MySQL +;;;; Created: May 2004 +;;;; +;;;; $Id: mysql-sql.lisp 9403 2004-05-19 23:46:45Z kevin $ +;;;; +;;;; 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. +;;;; ************************************************************************* + +(in-package #:clsql-mysql) + +(defmethod database-get-type-specifier ((type (eql 'wall-time)) args (database mysql-database)) + (declare (ignore args)) + "DATETIME") + +(defmethod database-output-sql-as-type ((type (eql 'boolean)) val (database mysql-database)) + (if val 1 0)) + +(defmethod read-sql-value (val (type (eql 'boolean)) (database mysql-database)) + (etypecase val + (string (if (string= "0" val) nil t)) + (integer (if (zerop val) nil t)))) diff --git a/sql/objects.lisp b/sql/objects.lisp index b90a6d1..2111b7a 100644 --- a/sql/objects.lisp +++ b/sql/objects.lisp @@ -560,8 +560,6 @@ strings." (case (database-underlying-type database) ((:postgresql :postgresql-socket) "TIMESTAMP WITHOUT TIME ZONE") - (:mysql - "DATETIME") (t "TIMESTAMP"))) (defmethod database-get-type-specifier ((type (eql 'duration)) args database) @@ -637,11 +635,8 @@ strings." (prin1-to-string val))) (defmethod database-output-sql-as-type ((type (eql 'boolean)) val database) - (case (database-underlying-type database) - (:mysql - (if val 1 0)) - (t - (if val "t" "f")))) + (declare (ignore database)) + (if val "t" "f")) (defmethod database-output-sql-as-type ((type (eql 'string)) val database) (declare (ignore database)) @@ -717,10 +712,6 @@ strings." (defmethod read-sql-value (val (type (eql 'boolean)) database) (case (database-underlying-type database) - (:mysql - (etypecase val - (string (if (string= "0" val) nil t)) - (integer (if (zerop val) nil t)))) (:postgresql (if (eq :odbc (database-type database)) (if (string= "0" val) nil t) -- 2.34.1