Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 353995

Summary: SqlFormatter is not able to wellform certain queries
Product: z_Archived Reporter: Beat Schwarzentrub <bsh>
Component: ScoutAssignee: Project Inbox <scout.core-inbox>
Status: CLOSED WONTFIX QA Contact:
Severity: minor    
Priority: P3 CC: Andreas.Hoegger
Version: unspecified   
Target Milestone: ---   
Hardware: All   
OS: All   
Whiteboard:
Attachments:
Description Flags
JUnit test cases none

Description Beat Schwarzentrub CLA 2011-08-05 09:03:55 EDT
Build Identifier: 3.7.0.2011-Jun 2011

PROBLEM DESCRIPTION:
The class SqlFormatter can be used to wellform SQL queries. Scout itself uses it to write failed queries to the error log.

However, there are certain keywords that make the parser fail and return the rest of the query "unparsed". For debugging purposes, it would be helpful when the parser could understand those keywords (as the are quite common).

EVALUATION:
The current version of the parser does not seem to consider any kind of "SqlStyle", so I assume it is intended to parse "Oracle SQL" only.
The parser is pattern based, but those pattern do not cover the full Oracle SQL grammar [1].

[1] http://download.oracle.com/docs/cd/E11882_01/server.112/e17118/statements_10002.htm

PROPOSED SOLUTION:
Add missing keywords to increase the percentage of "parsable" queries.

The attachment contains a JUnit test demonstrating some of the failing cases (remove the @Ignore annotation to execute those tests).

Reproducible: Always
Comment 1 Beat Schwarzentrub CLA 2011-08-05 09:04:27 EDT
Created attachment 200976 [details]
JUnit test cases
Comment 2 Andreas Hoegger CLA 2015-04-13 10:24:30 EDT
Historically removed...