This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 200479 - lexer - SQL - \' is not an excape character
Summary: lexer - SQL - \' is not an excape character
Status: RESOLVED FIXED
Alias: None
Product: db
Classification: Unclassified
Component: SQL Editor (show other bugs)
Version: 7.0
Hardware: PC Other
: P3 normal (vote)
Assignee: Libor Fischmeistr
URL:
Keywords: PATCH_AVAILABLE
: 241482 (view as bug list)
Depends on:
Blocks:
 
Reported: 2011-07-28 14:38 UTC by dzielnywoj
Modified: 2014-07-10 08:00 UTC (History)
1 user (show)

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments
proposed patch part 1 v1 (4.00 KB, patch)
2014-06-27 21:32 UTC, matthias42
Details | Diff
proposed patch part 2 v1 (10.29 KB, patch)
2014-06-27 21:33 UTC, matthias42
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description dzielnywoj 2011-07-28 14:38:15 UTC
Here is a sample code:

CREATE OR REPLACE PACKAGE BODY TEST IS

  FUNCTION GETCODE(REC_ID IN INTEGER)
    RETURN VARCHAR2 IS
    RESULTS VARCHAR2(40) := ' ';
    singleValue number;
BEGIN
  singleValue := function2('ddd','\');
  singleValue := singleValue || 'fff';
END GETCODE;

END TEST;
/

in this case, lexer shows us exception on \' and treat all next to it as string.
In SQL \' does not escape '. It should be treated as single slash.
Comment 1 matthias42 2013-01-20 16:44:03 UTC
Actually \ is an escape character - not in SQL standard, but in mysql.

Personally I would like to see:

- # completely dropped as a comment char -- needs adjustments in multiple modules. Problem is # is ambiguous and the meaning can't be deduced from context

- remove \ as a valid escape character (example here)

There are other db specific configurations, but either these are in the execute path (this is where you can be DB specific, as you know the target) or they are not ambiguous like different quoting chars ([] vs "" vs ``).
Comment 2 matthias42 2014-02-08 07:57:23 UTC
*** Bug 241482 has been marked as a duplicate of this bug. ***
Comment 3 matthias42 2014-06-27 21:32:46 UTC
Created attachment 147809 [details]
proposed patch part 1 v1
Comment 4 matthias42 2014-06-27 21:33:15 UTC
Created attachment 147810 [details]
proposed patch part 2 v1
Comment 5 matthias42 2014-06-27 21:37:53 UTC
I attached two patches:

Part 1: remove support for \ as string escape character - this is conflicts with the sql standard

Part 2: The lexer reports <>, <= and similar operators as two tokens - Part 2 fixes this and returns just one token for these sequences
Comment 6 Libor Fischmeistr 2014-07-08 08:21:54 UTC
Patch applied in changeset - http://hg.netbeans.org/core-main/rev/bed2ebf1a1b3

Thank you very much for it Matthias.
Comment 7 Quality Engineering 2014-07-09 02:48:50 UTC
Integrated into 'main-silver', will be available in build *201407090001* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)

Changeset: http://hg.netbeans.org/main-silver/rev/bed2ebf1a1b3
User: Libor Fischmeistr <lfischmeistr@netbeans.org>
Log: #200479: lexer - SQL - \' is not an excape character