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 234246 - SQL Splitter is broken for quoted strings and should support changing the delimiter in comment
Summary: SQL Splitter is broken for quoted strings and should support changing the del...
Status: RESOLVED FIXED
Alias: None
Product: db
Classification: Unclassified
Component: Code (show other bugs)
Version: 7.3.1
Hardware: PC Windows 7 x64
: P2 normal (vote)
Assignee: matthias42
URL:
Keywords: PATCH_AVAILABLE
Depends on:
Blocks:
 
Reported: 2013-08-12 02:07 UTC by rgoldberg
Modified: 2015-01-27 04:37 UTC (History)
0 users

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments
proposed patch part1 v1: Fix handling of DELIMITER inside quoted strings (includes unittests, that fail without the patch) (7.94 KB, patch)
2014-08-24 13:54 UTC, matthias42
Details | Diff
proposed patch part2 v1: DELIMITER used in a comment is recognized (includes unittes) (5.82 KB, patch)
2014-08-24 13:55 UTC, matthias42
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description rgoldberg 2013-08-12 02:07:26 UTC
It is not possible to run PL/SQL blocks with standard semicolon (;) intra-block statement delimiters, since the Netbeans DB platform considers every semicolon to demarcate the end of a top-level block.

There is the proprietary delimiter command which changes the block delimiter for NetBeans, but that isn't useful when working with others who don't use NetBeans, or for using in SQL*Plus, etc.

For example, if I use "delimiter /" in a sql file and run it in SQL*Plus, I get the following error:

SP2-0734: unknown command beginning "delimiter ..." - rest of line ignored.

Can you please add non-proprietary support for standard PL/SQL statement & block terminators?

You'd just have to parse for "begin" and "end" statements the denote blocks.

If that's too difficult, can you make the comment "--delimiter" work just like "delimiter"?

If so, then I could use "--delimiter /", which would make NetBeans behave like SQL*Plus, without generating the aforementioned error in SQL*Plus.

Thanks.
Comment 1 rgoldberg 2013-08-12 02:10:23 UTC
Alternatively, you could just make slash (/) the default delimiter.

That might cause issues for non-Oracle DBs, or for non-SQL*Plus clients; I'm not familiar enough with other software to know how they handle slashes.
Comment 2 matthias42 2014-08-24 13:52:56 UTC
Raising priority, as the problem can only be worked around by not using netbeans. Currently this: 

create table xy (id int, "title;" varchar(255));

can't be executed from within netbeans. The SQL Splitter ignores the quotes and splits this single statement into two:

create table xy (id int, "title
" varchar(255))

both are broken.
Comment 3 matthias42 2014-08-24 13:54:32 UTC
Created attachment 148866 [details]
proposed patch part1 v1: Fix handling of DELIMITER inside quoted strings (includes unittests, that fail without the patch)
Comment 4 matthias42 2014-08-24 13:55:43 UTC
Created attachment 148867 [details]
proposed patch part2 v1: DELIMITER used in a comment is recognized (includes unittes)
Comment 5 matthias42 2015-01-25 19:45:45 UTC
The patches were applied as:

http://hg.netbeans.org/core-main/rev/b8719ed6a560
http://hg.netbeans.org/core-main/rev/5c5c98ebe403

The result in a fixed delimiter behavior (delimiter inside quoted strings is ignored) and it is now possible to set the delimiter inside a comment. So the most compatible way to change the delimiter is:

-- DELIMITER /

Please help with QA - when the nightly build is ready a link will be added to this bug. Please check if your problem is fixed there. If so, please change the status of this bug to "VERIFIED".
Comment 6 Quality Engineering 2015-01-27 04:37:00 UTC
Integrated into 'main-silver', will be available in build *201501270002* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)

Changeset: http://hg.netbeans.org/main-silver/rev/b8719ed6a560
User: Matthias Blaesing <matthias42@netbeans.org>
Log: #234246 Part1: Fix handling of DELIMITER inside quoted strings/identifiers