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

希望改进一下自动生成SQL的多余换行问题:Encountered unexpected token: "\n\n\n" #5391

Closed
ilxqx opened this issue Jun 8, 2023 · 4 comments

Comments

@ilxqx
Copy link

ilxqx commented Jun 8, 2023

当前使用版本(必填,否则不予处理)

3.5.3.1

该问题是如何引起的?(确定最新版也有问题再提!!!)

这个问题是因为我引入了最新的JSqlParser4.6版本引起来,该版本新增了一个处理,超过两个空行将视为语句中断,即会被识别成多条语句即使没有;

我知道目前版本引入的4.5的JSqlParser,这个版本确实不存在问题。但是还是希望能够解决一下这个问题

重现步骤(如果有就写完整)

可以看一个目前MybatisPlus框架生成的SQL样式:

INSERT INTO mrqc_hospitalization_medical_record  ( id,


medical_record_number,
created_at,
updated_at )  VALUES  ( ?,


?,
?,
? )

这个样式确实不敢恭维,其中存在很多空行,而我项目确实又需要引入JSqlParser4.6版本,所以这里就会出现问题了

报错信息

Encountered unexpected token: "\n\n\n"

@986510453 986510453 pinned this issue Jun 21, 2023
@wangwenyao
Copy link

遇到了同样的问题,没有必要用换行符,使用空格不也可以吗,日志打印SQL换行也不方便查看

@hcl04
Copy link
Contributor

hcl04 commented Jul 13, 2023

这个问题主要的解决应该由 SqlParser 处理,SQL 标准里没有多空行等同 SQL 中断的说法,我们会尝试调整下 SQL 样式,你们也可以同时可以向 SqlParser 作者反馈下

@hcl04 hcl04 unpinned this issue Jul 13, 2023
@ilxqx
Copy link
Author

ilxqx commented Jul 17, 2023

@hcl04 已经提过了,SqlParser作者说得 MybatisPlus库处理一下😂😂:
JSQLParser/JSqlParser#1804

@nieqiurong
Copy link
Contributor

#5345 合并至此处讨论

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

No branches or pull requests

4 participants