From 0f58a3c84d3694fda01ba1fbf0ccc4f2ea205461 Mon Sep 17 00:00:00 2001 From: Dimitri Fontaine Date: Fri, 31 Aug 2018 22:51:41 -0700 Subject: [PATCH] Assorted fixes: catalogs SQLtypes and MySQL decoding as. It turns out that when trying to debug "decoding as" the SQLtype listing support in sqltype-list was found broken, so this patch fixes it. Then goes on to fix the DECODING AS filters support, which we have switched to using the better regexp-or-string filter struct but forgot to update the matching code accordingly. Fixes #665. --- src/sources/mysql/mysql.lisp | 8 +------- src/utils/catalog.lisp | 6 ++++-- 2 files changed, 5 insertions(+), 9 deletions(-) diff --git a/src/sources/mysql/mysql.lisp b/src/sources/mysql/mysql.lisp index 1710c8c..7cc9555 100644 --- a/src/sources/mysql/mysql.lisp +++ b/src/sources/mysql/mysql.lisp @@ -235,13 +235,7 @@ Illegal ~a character starting at position ~a~@[: ~a~].~%" (defun apply-decoding-as-filters (table-name filters) "Return a generialized boolean which is non-nil only if TABLE-NAME matches one of the FILTERS." - (flet ((apply-filter (filter) - ;; we close over table-name here. - (typecase filter - (string (string-equal filter table-name)) - (list (destructuring-bind (type val) filter - (ecase type - (:regex (cl-ppcre:scan val table-name)))))))) + (flet ((apply-filter (filter) (matches filter table-name))) (some #'apply-filter filters))) (defmethod instanciate-table-copy-object ((copy copy-mysql) (table table)) diff --git a/src/utils/catalog.lisp b/src/utils/catalog.lisp index 76a4857..c61ce8f 100644 --- a/src/utils/catalog.lisp +++ b/src/utils/catalog.lisp @@ -204,7 +204,7 @@ (defmethod sqltype-list ((table table) &key) "Return the list of sqltypes for SCHEMA." - (apply #'append (mapcar #'sqltype-list (table-column-list table)))) + (mapcar #'sqltype-list (table-column-list table))) (defmethod sqltype-list ((schema schema) &key) "Return the list of sqltypes for SCHEMA." @@ -215,7 +215,9 @@ (defmethod sqltype-list ((catalog catalog) &key) "Return the list of sqltypes for CATALOG." (remove-duplicates - (apply #'append (mapcar #'sqltype-list (catalog-schema-list catalog))) + (remove-if #'null + (apply #'append + (mapcar #'sqltype-list (catalog-schema-list catalog)))) :test #'string-equal :key #'sqltype-name)) (defmethod table-list ((schema schema) &key)