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.
This commit is contained in:
Dimitri Fontaine 2019-04-28 22:53:08 +02:00
parent 70b6845852
commit 6dbe62af1c

View File

@ -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))))))