We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
hello, i try to use mysql comments flow to provide same functionality to mssql:
(defmethod add-comments-to-postgresql ((catalog catalog) (mssql copy-mssql)) "Add table and column comments from MSSQL to PostgreSQL." (loop :for (table-name comment) :in (list-mssql-table-comments mssql) :do (when (and table-name comment) (let ((pg-table (find-table (catalog->pg catalog) table-name))) (when pg-table (execute (format nil "COMMENT ON TABLE ~a IS '~a';" (escape-identifier (table-name pg-table)) (escape-string comment))))))) (loop :for (table-name column-name comment) :in (list-mssql-columns-comments mssql) :do (when (and table-name column-name comment) (let* ((pg-table (find-table (catalog->pg catalog) table-name)) (pg-column (find-column pg-table column-name))) (when (and pg-table pg-column) (execute (format nil "COMMENT ON COLUMN ~a.~a IS '~a';" (escape-identifier (table-name pg-table)) (escape-identifier (column-name pg-column)) (escape-string comment)))))))) (defun list-mssql-table-comments (mssql) "Return comments on MSSQL tables." (loop :for (table-name comment) :in (mssql-query " SELECT LOWER(so.name) AS table_name, -- Convert table names to lowercase CAST(ep.value AS NVARCHAR(MAX)) AS comment FROM sys.extended_properties ep JOIN sys.objects so ON ep.major_id = so.object_id LEFT JOIN sys.columns sc ON so.object_id = sc.object_id AND ep.minor_id = sc.column_id WHERE sc.name IS NULL ") :when (and table-name comment (not (string= comment ""))) :collect (list table-name comment))) (defun list-mssql-columns-comments (mssql) "Return comments on MSSQL columns." (loop :for (table-name column-name comment) :in (mssql-query " SELECT LOWER(so.name) AS table name, -- Convert table names to lowercase LOWER(sc.name) AS column name, -- Convert column names to lowercase CAST(ep.value AS NVARCHAR(MAX)) AS comment FROM sys.extended_properties ep JOIN sys.objects so ON ep.major_id = so.object_id LEFT JOIN sys.columns sc ON so.object id = sc.object id AND ep.minor id = sc.column id WHERE sc.name IS NOT NULL ") :when (and table name column name comment (not (string= comment ""))) :collect (list table name column name comment))) (defun escape-identifier (identifier) "Escape SQL identifiers to handle special characters properly." (format nil "\"~a\"" identifier)) (defun escape-string (string) "Escape SQL strings to handle special characters properly." (replace-regexp-in-string "'" "''" string))
I need to verify if is it right way to follow and to know how handle mssql connection: please let me know, your comments can be very helpful thank you
The text was updated successfully, but these errors were encountered:
No branches or pull requests
hello, i try to use mysql comments flow to provide same functionality to mssql:
I need to verify if is it right way to follow and to know how handle mssql connection: please let me know, your comments can be very helpful thank you
The text was updated successfully, but these errors were encountered: