Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 353995 - SqlFormatter is not able to wellform certain queries
Summary: SqlFormatter is not able to wellform certain queries
Status: CLOSED WONTFIX
Alias: None
Product: z_Archived
Classification: Eclipse Foundation
Component: Scout (show other bugs)
Version: unspecified   Edit
Hardware: All All
: P3 minor (vote)
Target Milestone: ---   Edit
Assignee: Project Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-08-05 09:03 EDT by Beat Schwarzentrub CLA
Modified: 2021-08-19 11:03 EDT (History)
1 user (show)

See Also:


Attachments
JUnit test cases (5.19 KB, application/x-zip-compressed)
2011-08-05 09:04 EDT, Beat Schwarzentrub CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
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...