Add QueryBuilder::addComment() to attach SQL comments to generated queries - #7345
Add QueryBuilder::addComment() to attach SQL comments to generated queries#7345jdecool wants to merge 1 commit into
Conversation
|
There hasn't been any activity on this pull request in the past 90 days, so it has been marked as stale and it will be closed automatically if no further activity occurs in the next 7 days. |
|
Keep it open. What do you think about this feature @derrabus ? |
|
There's already #7083, although the author is not responding anymore. My problem with your version is the wording: SQL has no concept named "tags". There are comments and I'm fine adding an abstraction for comments to the query builder. |
|
Thanks for your answer. I will update this PR if #7083 be closed for inactivity. |
fd75656 to
3df7ebc
Compare
derrabus
left a comment
There was a problem hiding this comment.
What happens if I pass a string with a line feed to the builder?
Also, please add funktional tests that show me that a query constructed this way ist still understood by the database.
00c9c1a to
19f2bfb
Compare
|
I've updated the PR. It should fixed the CI. I've also updated the code to allow multiline comment |
The MR title and description wording should probably be changed as well. |
This implementation adds a addComment() method to the QueryBuilder class, which allows adding SQL comment tags to generated queries for debugging, logging, and analysis purposes.
19f2bfb to
e3b300c
Compare
|
@derrabus this PR has just been updated |
Summary
This implementation adds an
addComment()method to theQueryBuilderclass, which allows attaching SQL comments to generated queries for debugging, logging, and analysis purposes.Comments are emitted as standard SQL comments preceding the statement, so they show up in slow query logs and query analysis tools alongside the statement they belong to.
It's a similar concept to EF Core Query Tags