In MS SQL, this is a valid comment:
--select * from table
However, SynEdit doesn't highlight it as a comment. Only if a insert a space after the -- does it recognise it as a comment. In MySQL, the space is required, but not in MS SQL.
In MS SQL, this is a valid comment:
--select * from table
However, SynEdit doesn't highlight it as a comment. Only if a insert a space after the -- does it recognise it as a comment. In MySQL, the space is required, but not in MS SQL.
PS: I first assumed this was a SynEdit bug, so I posted it on their repo. https://github.com/SynEdit/SynEdit/issues/42
What disturbing is: after "--" the line will be gray and italic, it seems to be a comment, but at run it turns out, that there is an error, because it's not a comment. At first I didn't know what the problem is, and finally found, that a space is still missing.
Why is space expected? And if it is expected, it would be good if formatting would change only after adding the space.
https://dev.mysql.com/doc/refman/5.7/en/comments.html
In MySQL, the -- (double-dash) comment style requires the second dash to be followed by at least one whitespace or control character (such as a space, tab, newline, and so on).
But the space seems to be MySQL specific. Standard SQL does not require it. Here's the explanation from MySQL: https://dev.mysql.com/doc/refman/5.7/en/ansi-diff-comments.html
I see, thanks. However it would not be a problem, if in the Query window it would work as comment also without a space. (The only danger is, that somebody writes SQL code in HeidiSQL (with "--" comments) and tries to run it in another environment. What runs here would not run there. So really, it would cause some compatibility issue.)
But if "-- " is required for comment, it would expected that only after it changes the formatting to comment style, not after "--".
BTW: The MySQL Comment Syntax description seems to be erroneous. It says: "(double-dash) comment style requires the second dash to be followed by at least one whitespace or control character (such as a space, tab, NEWLINE, and so on)" Newline is funny in a single line comment. :)
The issue in HeidiSQL is its wrong hightlighting. See issue #549, and issue 42 in SynEdit.
Please login to leave a reply, or register at first.