You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@netbeans.apache.org by GitBox <gi...@apache.org> on 2022/12/29 10:39:34 UTC

[GitHub] [netbeans] SimonVanacco opened a new issue, #5159: String escaping in SQL files results in broken color highlighting

SimonVanacco opened a new issue, #5159:
URL: https://github.com/apache/netbeans/issues/5159

   ### Apache NetBeans version
   
   Apache NetBeans 16
   
   ### What happened
   
   Backslash escaping is not detected by the color highlighting in SQL Files : 
   
   ![image](https://user-images.githubusercontent.com/5305627/209939532-851d1ce4-7195-48ed-934b-f71175bdbb09.png)
    
   
   I figure this is a bug because SQL does not produces any error when parsing these files, meaning these are acceptable ways of escaping SQL queries, which is not reflected correctly by the color highlighting
   
   ### How to reproduce
   
   Write this SQL il any .sql file open in NetBeans and see the code color break : 
   
   ```sql
   INSERT IGNORE INTO categorie (id, parent_id, nom, content, root, lft, rgt, lvl) VALUES
   (1, NULL, 'Test1', 'This won\'t be correctly escaped', 12000, 1, 2, 0),
   (2, NULL, "Test2", "This won\'t either", 12001, 1, 2, 0);
   ```
   
   ### Did this work correctly in an earlier version?
   
   No / Don't know
   
   ### Operating System
   
   Ubuntu 22.10
   
   ### JDK
   
   OpenJDK 17
   
   ### Apache NetBeans packaging
   
   Apache NetBeans provided installer
   
   ### Anything else
   
   _No response_
   
   ### Are you willing to submit a pull request?
   
   No
   
   ### Code of Conduct
   
   Yes


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For additional commands, e-mail: notifications-help@netbeans.apache.org

For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists


[GitHub] [netbeans] matthiasblaesing commented on issue #5159: String escaping in SQL files results in broken color highlighting

Posted by GitBox <gi...@apache.org>.
matthiasblaesing commented on issue #5159:
URL: https://github.com/apache/netbeans/issues/5159#issuecomment-1367362546

   This is a problem for lexers as MySQL decided to introduce a language not compatible with SQL. SQL-99 defines a string as delimited by single quotes, where the quote can be escaped by doubling it. See here:
   
   https://ronsavage.github.io/SQL/sql-99.bnf.html#character%20string%20literal
   https://ronsavage.github.io/SQL/sql-99.bnf.html#quote%20symbol
   
   So from an SQL grammar perspective the first value set holds a string literal, that ends directly before the t and is which is followed by the identifier `t`. The second value set does not hold any string, but the two identifiers `Test` and `This won\'t either`.
   
   I think I looked into this in the past and did not come up with a clean solution. If you can come up how to implement a lexer, that handles both cases without breaking existing samples, I'm happy to hear it, but I doubt it.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For additional commands, e-mail: notifications-help@netbeans.apache.org

For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists