From 6dbe62af1cc7a0c0cb4e702ca07530809b6531d0 Mon Sep 17 00:00:00 2001 From: Dimitri Fontaine Date: Sun, 28 Apr 2019 22:53:08 +0200 Subject: [PATCH] Attempt to fix MS SQL drop view for Mat Views facility. It seems that the current open-coding of the materialized views data structure is still causing some confusion, so use the same code as in the MySQL support in the MS SQL parts of the code when trying to fix #950. See #950. --- src/sources/mssql/mssql-schema.lisp | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/src/sources/mssql/mssql-schema.lisp b/src/sources/mssql/mssql-schema.lisp index 7986425..3c71f4c 100644 --- a/src/sources/mssql/mssql-schema.lisp +++ b/src/sources/mssql/mssql-schema.lisp @@ -242,14 +242,10 @@ (let ((views (remove-if #'null views-alist :key #'cdr))) (when views (let ((sql - (with-output-to-string (sql) - (format sql "DROP VIEW ") - (loop :for view-definition :in views - :for i :from 0 - :do (destructuring-bind (name . def) view-definition - (declare (ignore def)) - (format sql - "~@[, ~]~@[~s.~]~s" - (not (zerop i)) (car name) (cdr name))))))) - (log-message :info "PostgreSQL Source: ~a" sql) + (format nil "DROP VIEW ~{~a~^, ~};" + (mapcar (lambda (qname) + (format nil "~@[~s.~]~a" + (car qname) (cdr qname))) + (mapcar #'car views))))) + (log-message :info "MSSQL: ~a" sql) (mssql-query sql))))))