New issue
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
DB-Manager: strip comments from SQL #9180
DB-Manager: strip comments from SQL #9180
Conversation
@@ -595,8 +595,14 @@ def createView(self): | |||
def _getSqlQuery(self): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this function is used to store queries in preset or in file. They are many usages. So we will loose comments in saved file.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Gustry ok, I'll move it down into the executor
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Gustry, looking better I thing you are wrong, the original behavior was altering the query by replacing newlines with spaces, and that was the source of the issue: https://github.com/qgis/QGIS/pull/9180/files#diff-9020444f364248acb9ad107f6fb38ba0L598
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
getSqlQuery
is used when we store the query as file:
query = self._getSqlQuery() |
Sorry if I didn't understand. I will look later.
@Gustry can I merge? |
As I said, the In DB Manager: -- this is a comment
SELECT * FROM foo; Save this query as a preset or as a file, it becomes: SELECT * FROM foo; IMHO, we need another function like BTW, I noticed another one regression from QGIS 2, comments on the same line are not working. SELECT * --all fields
FROM foo; is not working in QGIS 3.4 while it's working fine in QGIS 2.18 and PgAdmin3 and 4. |
Superceeded by: #9183 |
Fixes #21271