iuyoy / highlight-string-code

Highlight string as specific language. 在其他代码中高亮 SQL、HTML、CSS或者JS
https://marketplace.visualstudio.com/items?itemName=iuyoy.highlight-string-code
MIT License
17 stars 4 forks source link

Bug? Sub selects require their own semicolons #7

Closed finn-matti closed 2 years ago

finn-matti commented 3 years ago

This sql makes it necessary to include three semicolons in the end to terminate syntax highlighting:

                SELECT
                    CONCAT(
                        z.expected,
                        IF(
                            z.got-1>z.expected,
                            CONCAT(' bis ',z.got-1),
                            ''
                        )
                    ) AS missing
                FROM (
                    SELECT
                        @rownum:=@rownum+1 AS expected,
                        IF(
                            @rownum=CAST(SUBSTR(bestellId, 2) AS UNSIGNED),
                            0,
                            @rownum:=CAST(SUBSTR(bestellId, 2) AS UNSIGNED)
                        ) AS got
                    FROM (
                        SELECT @rownum:=$lastId
                    ) AS a
                    JOIN $tname
                    ORDER BY CAST(SUBSTR(bestellId, 2) AS UNSIGNED)
                    -- TODO: exclude lower ids (> minIds)
                    -- WHERE CAST(SUBSTR(bestellId, 2) AS UNSIGNED) > $lastId
                    ) AS z
                WHERE z.got!=0;;;

Mysql is not my strong suit, so I'm unsure if this is correct behavior. What I can tell is, that adding semicolons in the end of every sub select and the root statement is not working/produces an sql syntax error.

iuyoy commented 3 years ago

Hi finn-matti, I can't get the same issue with your code in Python. What language are you using? image

finn-matti commented 2 years ago

Sorry, this is so long ago, that I can't remember this issue at all. Please close if you think it was a mistake on my part. I sadly don't have the time to investigate.

iuyoy commented 2 years ago

Never mind.