From 5398a720dd42b3c2787ff67414e6ce424bc34e1b Mon Sep 17 00:00:00 2001 From: "Kevin M. Rosenberg" Date: Sun, 16 May 2004 08:12:44 +0000 Subject: [PATCH] r9370: * sql/db-interface.lisp: Add new db-type-has-union? since Mysql 3.23 does not support unions. * sql/test-init.lisp: Don't try union tests on database backends which do not support it. --- ChangeLog | 4 ++++ db-mysql/mysql-sql.lisp | 3 +++ sql/db-interface.lisp | 6 ++++++ sql/package.lisp | 1 + tests/test-init.lisp | 3 +++ 5 files changed, 17 insertions(+) diff --git a/ChangeLog b/ChangeLog index 35637e5..e800941 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,9 @@ 15 May 2004 Kevin Rosenberg (kevin@rosenberg.net) * Version 2.10.18 + * sql/db-interface.lisp: Add new db-type-has-union? + since Mysql 3.23 does not support unions. + * sql/test-init.lisp: Don't try union tests on database + backends which do not support it. * db-oracle/*.lisp: initial port to UFFI * sql/objects.lisp: implement UPDATE-OBJECT-JOINS, implement REFRESH for SELECT. diff --git a/db-mysql/mysql-sql.lisp b/db-mysql/mysql-sql.lisp index cf85c59..08f50fb 100644 --- a/db-mysql/mysql-sql.lisp +++ b/db-mysql/mysql-sql.lisp @@ -454,6 +454,9 @@ (defmethod db-type-has-boolean-where? ((db-type (eql :mysql))) nil) +(defmethod db-type-has-union? ((db-type (eql :mysql))) + (not (eql (schar mysql::*mysql-client-info* 0) #\3))) + (defmethod db-type-transaction-capable? ((db-type (eql :mysql)) database) (let ((tuple (car (database-query "SHOW VARIABLES LIKE 'HAVE_INNODB'" database :auto nil)))) (and tuple (string-equal "YES" (second tuple))))) diff --git a/sql/db-interface.lisp b/sql/db-interface.lisp index 84702b9..6243630 100644 --- a/sql/db-interface.lisp +++ b/sql/db-interface.lisp @@ -244,6 +244,12 @@ of TYPE_NAME (keyword) PRECISION SCALE NULLABLE.")) t) (:documentation "T [default] if database-type supports boolean WHERE clause, such as 'WHERE MARRIED'.")) +(defgeneric db-type-has-union? (db-type) + (:method (db-type) + (declare (ignore db-type)) + t) + (:documentation "T [default] if database-type supports boolean UNION.")) + (defgeneric db-backend-has-create/destroy-db? (db-type) (:method (db-type) (declare (ignore db-type)) diff --git a/sql/package.lisp b/sql/package.lisp index 1a11f94..cb6c2de 100644 --- a/sql/package.lisp +++ b/sql/package.lisp @@ -136,6 +136,7 @@ #:db-backend-has-create/destroy-db? #:db-type-has-views? + #:db-type-has-union? #:db-type-has-subqueries? #:db-type-has-boolean-where? #:db-type-transaction-capable? diff --git a/tests/test-init.lisp b/tests/test-init.lisp index 7d7273f..70d54d7 100644 --- a/tests/test-init.lisp +++ b/tests/test-init.lisp @@ -558,6 +558,9 @@ (clsql-sys:in test :fdml/select/22 :fdml/query/5 :fdml/query/7 :fdml/query/8)) (push (cons test "not supported by mysql") skip-tests)) + ((and (null (clsql-sys:db-type-has-union? db-underlying-type)) + (clsql-sys:in test :fdml/query/6)) + (push (cons test "union not supported") skip-tests)) (t (push test-form test-forms))))) (values (nreverse test-forms) (nreverse skip-tests)))) -- 2.34.1