Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Settings.parseRetainCommentsBetweenQueries #12538

Closed
lukaseder opened this issue Oct 19, 2021 · 1 comment
Closed

Add Settings.parseRetainCommentsBetweenQueries #12538

lukaseder opened this issue Oct 19, 2021 · 1 comment

Comments

@lukaseder
Copy link
Member

lukaseder commented Oct 19, 2021

When the parser is used to translate SQL scripts (e.g. via the ParserCLI or website), it is often desirable to not touch any comments that may be used to describe parts of the script, e.g.

-- ==========================================
-- header
-- created 2000-01-01
-- ==========================================

-- Change Request #14813
-- ------------------------------------------
CREATE TABLE x123 (i int);
CREATE TABLE x456 (j int);
-- Special table
CREATE TABLE x789 (k int);

-- Change Request #153819
-- ------------------------------------------
ALTER TABLE x789 ADD x int;

All the whitespace and comments that are located in between statements could be parsed and retained by jOOQ's parser. For now, it would still be difficult to retain comments within a statement as our query object model doesn't allow for representing arbitrary whitespace and comments, but on the top level, that could work.

@lukaseder lukaseder added this to the Version 3.16.0 milestone Oct 19, 2021
@lukaseder lukaseder added this to To do in 3.16 Other improvements via automation Oct 19, 2021
@lukaseder lukaseder changed the title Add Settings.parseRetainCommentsBetweenStatements Add Settings.parseRetainCommentsBetweenQueries Oct 21, 2021
@lukaseder
Copy link
Member Author

The feature works, now for some whitespace management

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
No open projects
Development

No branches or pull requests

1 participant