apache / apache/netbeans

String escaping in SQL files results in broken color highlighting

Open
#5,159 1 comment 0 reactions 0 assignees View on GitHub
Contribution welcome kind:bug
Dominant language
Java
Stars
3.1k
Forks
935
Avg merge
2d 3h
Merged PRs (30d)
17

Description

### 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

Contributor guide

Open the contributing guide

Research direction

Reproduce the issue by opening a .sql file in NetBeans and entering the provided INSERT statements with backslash-escaped quotes. Start by tracing the SQL syntax-highlighting entry point and compare handling of escaped strings with ordinary quoted strings. Done means escaped quotes no longer break color highlighting.

Written by the indexing model from the issue text.

Assessment

Tech stack
sql
Domain
tooling
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.