Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Parsing - keep comments #1721

PowalaX started this conversation in General
Discussion options

Goal: SQL Rewrite with comments

Sample:
SELECT NAME, ADDRESS, COL1 /* Important comment!*/ FROM OLD_TABLE WHERE SSN IN ('1', '2');

After rewrite:
SELECT NAME, ADDRESS, COL1 /* Important comment!*/ FROM NEW_TABLE WHERE SSN IN ('3', '4');

(SQL building with jSQLParser is clear.)
How can I use it with jSQLParser?

You must be logged in to vote

Replies: 1 comment

Comment options

Greetings.

Look at JSQLFormatter, where I create a map of the comments first based on its position considering only non-whitespace characters. Using that map you can re-insert the comments after de-parsing.

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Converted from issue

This discussion was converted from issue #1719 on January 26, 2023 11:23.

AltStyle によって変換されたページ (->オリジナル) /